---
sourceDocument: Brazil Build or modify applications
sourceDocumentLink: https://www.servicenow.com/docs/r/application-development

 Release :

    - brazil

ft:locale :

    - en-US

ft:publication_title :

    - Brazil Build or modify applications

ft:clusterId :

    - cadev

bundleId :

    - cadev

workflow :

    - Development, Data, and Analytics


---

# Theming model

# Theming model {#ariaid-title1}

Release version: Brazil  
Updated September 29, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 3 minutes to read
Summarize  
![AI sparkle icon](https://servicenow.com/docs/portal-asset/ai-sparkle-icon) Summarized using AI  
This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.  

## Summary of Theming model

The Lux theming model enables ServiceNow customers to customize the look and feel of their applications via a streamlined brand configuration rather than manual CSS overrides.
This model generates all color, radius, and font tokens from a small set of brand inputs, allowing for consistent and accessible design across tenants without requiring app source changes or redeployments.
Show full answer Show less  

## Key Features

* **Brand Configuration Driven:** Customers define base colors (primary, accent, neutral) and shape properties in a `theme.js` file. These inputs expand into comprehensive color scales (50--950) for both light and dark modes, ensuring contrast and accessibility.
* **Token Generation Pipeline:** The pipeline reads brand config and token overrides from theme records at runtime, generates accessible color scales, validated fonts, and token overrides, then emits these as inline styles into the document head.
* **Integration with Tailwind CSS:** Tokens are registered as base CSS and prefixed component overrides, making them available as utility classes and CSS custom properties accessible inside every shadow root component.
* **Runtime Theme Overrides:** Admins can override tokens per tenant using the `tokenoverrides` field on `sysaixtheme` records and multi-theme user assignments, allowing tenant-specific theming without rebuilding the app.
* **Color Scheme and Density Attributes:** Light and dark modes are controlled via `data-theme` attributes, and UI density is controlled with `data-density`. These attributes adjust color schemes and global spacing dynamically, with user preferences persisting across reloads.

## Practical Implications

* Developers should modify `theme.js` or `tailwind.app.css` for source-level theme changes requiring rebuilds; admins use theme records for tenant-specific overrides without redeploys.
* Semantic tokens are preferred in component styles over raw color stops to ensure resilience against rebranding.
* Theming effects apply globally and propagate through shadow DOM boundaries, ensuring consistent styling across all UI components.
* Components that need to respond to color scheme changes should manage their own attributes, as the generated CSS applies document-level rules that override host styles inside shadow roots.  
Lux generates every color, radius, and font token from a small brand configuration, and a theme record can override any of those tokens per tenant.

Identify which side a given change belongs to before making it:

* theme.js and tailwind.app.css are developer work. They ship with the app's source, are the same for every tenant, and changing either requires a rebuild.
* The `token_overrides` field on a `sys_aix_theme` record and the multi-theme rows that control which theme a given user gets are admin configuration. They change what a tenant sees without an app source change or a redeploy.

Both are combined in the same generated CSS, which is why one topic covers them.

## Brand config instead of component CSS {#theming-model__theming-model-brand-config-instead-of-component-css}

You don't restyle a Lux app by overriding component CSS. You declare a brand config and the framework generates every color, radius, and font token from it. A scaffolded Lux app's whole theme file is a handful of lines of brand input:

    // theme.js
    export const AppTheme = {
      primary_color: '#032D42',
      accent_color: '#63DF4E',
      neutral_colors: {
        use_hex_value: true,
        hex_value: '#F8F7F4'
      },
      shape: {
        selector_radius: '0.75rem',
        field_radius: '0.5rem',
        boxes_radius: '1rem',
        border_width: '1px'
      }
    };

`primary_color`, `accent_color`, and `neutral_colors` are base colors, not tokens. Each expands into an 11-stop scale from `50` through `950`, generated once for light mode and once for dark, so contrast holds in both. Semantic tokens map to those stops and are what components consume.

In component styles, use a semantic token instead of a raw stop. Semantic tokens survive a rebrand; raw stops do not.

## Token pipeline {#theming-model__theming-model-token-pipeline}

Theming is a pipeline of CSS custom properties that flows from brand configuration into every shadow root:

1. Brand config in. The theme object's colors, shape, fonts, and token overrides are read. They come from the theme record on the instance at request time, or from the app's own theme module.
2. Generation. A generator turns them into accessible color scales, validated `@font-face` rules, up to four font preload links, and a token-override block.
3. Into the document head. Those blocks are emitted as inline `<style>` elements in the server-rendered document, alongside the framework's static token mappings.
4. Into Tailwind. A Tailwind plugin registers the same tokens as base CSS and as prefixed component overrides. The tokens are then reachable as utility classes rather than only as `var()` calls.
5. Into every shadow root. The compiled stylesheet is adopted into each `AIUXElement`'s shadow root. CSS custom properties inherit through shadow boundaries, so a token registered at the document root is readable by every component that adopted the sheet.

Note:  
If required theme values aren't provided, the generator falls back to the corresponding values from `DEFAULT_THEME`. This verifies the generated CSS has the color scales needed to resolve semantic tokens correctly. For primary and accent colors, this applies when values are omitted or `undefined`; the neutral scale also falls back when its configuration cannot be resolved.

## Color scheme and density attributes {#theming-model__theming-model-color-scheme-and-density-attributes}

Light, dark, and density are attributes rather than themes. Color scheme lives on `data-theme` on the document element, and density on `data-density`. Both are orthogonal to which theme record resolved.

The Lux framework exposes a service for flipping color scheme at runtime, and the user's choice persists across reloads. Most apps don't write that themselves, the nav layout ships a theme toggle you turn on
with a feature flag.

Density scales spacing, item heights, and sidebar widths globally, because every Tailwind spacing utility resolves through one spacing unit token. Switching density rescales the whole UI with no component-level change. The
three modes and their values can be found in .  
Important:  
A component that needs to react to color scheme rather than set it should reflect its own attribute onto its host and style against that. The generated theme CSS declares `[data-theme]` rules at the document level, which outrank a `:host` rule for the same token. An override written against `data-theme` inside a shadow root does not apply.
**Related concepts**   

* [Configuration model](https://www.servicenow.com/docs/GMie8eKbnJlCpmbXGwkzcw "Lux makes a component's behavior configurable at three levels: code, admin policy, and individual preference without three separate systems to learn. You add one decorator, @config, to a class field to opt a property into all of it.")  
**Related reference**   

* [theme.js configuration reference](https://www.servicenow.com/docs/zlZhfv0iZfhkfW0ayAaUiA "A Lux application declares its brand in one file at the project root, and the framework generates every color, radius, and font token from it. Restyling a Lux application goes through that file rather than through component CSS.")  
**Related topics**   

* ../reference/design-tokens.html

