Globals Reference

Code Mode lets you edit a Descope style as raw JSON instead of using the GUI. This page lists globals object keys, which include the colors and typography keys that apply to every screen and component in a style.

For component-level keys, like badges, logos, and input states, see Components Reference.

Where to Edit These Values

  1. Open the Styles tab in the Descope Console.
  2. Select a style file, then toggle Code Mode on.
  3. Edit globals.colors or globals.typography directly, or change a value in the GUI first to reveal its corresponding key in Code Mode.

Structure

Every style's globals follow this shape. Each block below is a real, complete example, not a placeholder:

{
  "globals": {
    "colors": {
      "primary": {
        "main": "#6D829CFF",
        "light": "#ACB8C7",
        "dark": "#404E5F",
        "highlight": "#EBEEF2",
        "contrast": "#FFFFFF"
      }
    },
    "fonts": {
      "font1": {
        "label": "Roboto",
        "family": ["Roboto", "ui-sans-serif", "system-ui", "Arial", "sans-serif"],
        "url": "https://fonts.googleapis.com/css?family=Roboto:100,200,300,400,500,600,700,800,900"
      }
    },
    "typography": {
      "h1": {
        "font": "var(--descope-fonts-font2-family)",
        "size": "60px",
        "weight": "300"
      }
    },
    "spacing": { "xs": "2px", "sm": "4px", "md": "8px", "lg": "16px", "xl": "32px" },
    "radius": { "xs": "5px", "sm": "10px", "md": "15px", "lg": "20px", "xl": "25px", "2xl": "30px", "3xl": "35px" },
    "border": { "xs": "1px", "sm": "2px", "md": "3px", "lg": "4px", "xl": "5px" },
    "shadow": {
      "narrow": { "sm": "0 1px 2px -1px", "md": "0 2px 4px -2px", "lg": "0 4px 6px -4px", "xl": "0 8px 10px -6px", "2xl": "0 16px 16px -8px" }
    },
    "direction": "ltr"
  }
}

Colors

There are six color palettes. Each one maps to a section of the Colors panel in the GUI, and each uses the same five shade keys.

KeyGUI labelTypical use
primaryPrimaryYour main brand color, used for buttons, links, and focus states
secondarySecondarySecondary actions and accents
successSuccessSuccess messages and confirmations
warningWarningWarnings and cautionary states
errorErrorError messages and destructive actions
surfaceGreysNeutral tones used for backgrounds, borders, and surfaces

Each palette above takes the same five shade keys:

Shade keyDescription
mainThe base color for the palette
lightA lighter variant of main
darkA darker variant of main
highlightUsed for hover and highlight states
contrastA contrasting color, typically used for text or icons placed on top of main

Full path format: globals.colors.<palette>.<shade>. For example: globals.colors.primary.main.

{
  "globals": {
    "colors": {
      "primary": {
        "main": "#124990FF",
        "dark": "#0B2C56",
        "light": "#1966CA",
        "highlight": "#3D87E7",
        "contrast": "#FFFFFF"
      },
      "secondary": {
        "main": "#BCAECAFF",
        "dark": "#715988",
        "light": "#FFFFFF",
        "highlight": "#FFFFFF",
        "contrast": "#000000"
      },
      "surface": {
        "main": "#EBEBEBFF",
        "dark": "#8D8D8D",
        "light": "#FFFFFF",
        "highlight": "#FFFFFF",
        "contrast": "#000000"
      },
      "success": {
        "main": "#00B100FF",
        "dark": "#006A00",
        "light": "#00F800",
        "highlight": "#40FF40",
        "contrast": "#FFFFFF"
      },
      "warning": {
        "main": "#F8E71CFF",
        "dark": "#A19505",
        "light": "#FBF287",
        "highlight": "#FFFEF2",
        "contrast": "#000000"
      },
      "error": {
        "main": "#C71D12FF",
        "dark": "#77110B",
        "light": "#EE4C42",
        "highlight": "#F59892",
        "contrast": "#FFFFFF"
      }
    }
  }
}

Typography

Typography is built from two font family slots and seven preset text variants.

Font families

globals.fonts holds two slots, each a full object rather than a single value:

PropertyDescription
labelDisplay name shown in the GUI font picker
familyOrdered CSS font stack (the chosen font plus system fallbacks)
urlOnly present for custom or Google-hosted fonts. A stylesheet URL the flow loads to fetch the font file
{
  "globals": {
    "fonts": {
      "font1": {
        "label": "Roboto",
        "family": ["Roboto", "ui-sans-serif", "system-ui", "Arial", "sans-serif"],
        "url": "https://fonts.googleapis.com/css?family=Roboto:100,200,300,400,500,600,700,800,900"
      },
      "font2": {
        "label": "Sans Serif",
        "family": ["ui-sans-serif", "system-ui", "-apple-system", "Arial", "sans-serif"]
      }
    }
  }
}

Each slot's family array generates the --descope-fonts-font1-family and --descope-fonts-font2-family CSS variables. Typography and component tokens reference these with var(...). To add a custom font, follow the Custom Fonts steps in the GUI first. Code Mode only shows the result. It isn't the place to write new @font-face rules directly.

Text variants

Each variant accepts the same three properties: font, size, and weight.

JSON keyGUI label
h1Heading 1
h2Heading 2
h3Heading 3
subtitle1Subtitle 1
subtitle2Subtitle 2
body1Body 1
body2Body 2

Property reference:

PropertyTypeExample
fontCSS variable referencevar(--descope-fonts-font2-family)
sizePixel value, as a string"60px"
weightCSS font-weight value, as a string"300"

Font weight values

The GUI exposes nine named weight increments. In Code Mode, set the raw numeric value:

GUI labelweight value
Thin100
Extra Light200
Light300
Regular400
Medium500
Semi Bold600
Bold700
Extra Bold800
Black900

A variant only needs the properties you're overriding. Anything you omit falls back to the style's default:

{
  "globals": {
    "fonts": {
      "font1": {
        "family": [
          "Poppins",
          "ui-sans-serif",
          "system-ui",
          "-apple-system",
          "BlinkMacSystemFont",
          "Segoe UI",
          "Roboto",
          "Helvetica Neue",
          "Arial",
          "Noto Sans",
          "sans-serif",
          "Apple Color Emoji",
          "Segoe UI Emoji",
          "Segoe UI Symbol",
          "Noto Color Emoji"
        ],
        "label": "Poppins",
        "url": "https://fonts.googleapis.com/css?family=Poppins:100,200,300,400,500,600,700,800,900"
      },
      "font2": {
        "family": [
          "ui-sans-serif",
          "system-ui",
          "-apple-system",
          "BlinkMacSystemFont",
          "Segoe UI",
          "Roboto",
          "Helvetica Neue",
          "Arial",
          "Noto Sans",
          "sans-serif",
          "Apple Color Emoji",
          "Segoe UI Emoji",
          "Segoe UI Symbol",
          "Noto Color Emoji"
        ],
        "label": "Sans Serif"
      }
    },
    "typography": {
      "h1": {
        "font": "var(--descope-fonts-font1-family)"
      },
      "h2": {
        "size": "40px",
        "weight": "700"
      },
      "h3": {
        "size": "30px"
      },
      "body1": {
        "size": "15px"
      },
      "body2": {
        "size": "12px"
      },
      "subtitle2": {
        "size": "22px"
      },
      "subtitle1": {
        "size": "24px"
      }
    }
  }
}

Spacing

globals.spacing defines five step sizes used for padding, gaps, and margins across components. Components use them as var(--descope-spacing-<key>):

KeyValue
xs2px
sm4px
md8px
lg16px
xl32px

Corner Radius

globals.radius defines seven roundness steps, used as var(--descope-radius-<key>):

KeyValue
xs5px
sm10px
md15px
lg20px
xl25px
2xl30px
3xl35px

Border Width

globals.border defines five stroke widths, used as var(--descope-border-<key>):

KeyValue
xs1px
sm2px
md3px
lg4px
xl5px

Shadow

globals.shadow defines two families of shadow fragments, narrow and wide. Each one has five sizes: sm, md, lg, xl, and 2xl. These are partial box-shadow values (offset and blur, no color). A component combines one of these with its own -shadow-color variable when it renders:

{
  "globals": {
    "shadow": {
      "wide": { "sm": "0 2px 3px -0.5px", "md": "0 4px 6px -1px" },
      "narrow": { "sm": "0 1px 2px -1px", "md": "0 2px 4px -2px" }
    }
  }
}

A component typically layers both, for example:

"--descope-container-box-shadow": "var(--descope-shadow-wide-lg) var(--descope-container-shadow-color), var(--descope-shadow-narrow-lg) var(--descope-container-shadow-color)"

Direction

globals.direction is a single value, "ltr" or "rtl", that drives the --descope-direction variable most components inherit for host-direction. Set this once to flip layout for right-to-left languages, instead of overriding direction on each component.

Applying a Color to a Component

Colors defined in globals.colors are used elsewhere in the theme through CSS variable references, not hard-coded values. For example, a notification card references the error palette like this:

{
  "components": {
    "notificationCard": {
      "mode": {
        "error": {
          "--descope-notification-card-background-color": "var(--descope-colors-error-main)",
          "--descope-notification-card-border-color": "var(--descope-colors-error-light)"
        }
      }
    }
  }
}

This is why editing a globals.colors shade updates every component that references it. The color only lives in one place. See Advanced Styling Examples for more patterns like this at the component level.

Was this helpful?

On this page