Styles

Colors

We define three sets of color token types, reference/palette tokens, system tokens, and application tokens.

Reference or palette tokens (e.g. --ref-palette-X) are a set of base colors that get updated on Chrome color theme change and should not be directly used.

System tokens (e.g. --sys-color-X) are a set of semantic tokens (use is often clear from name e.g. --sys-color-error-container). They reference palette tokens and incorporate light / dark mode switches and should be used in the code directly. You can view all system tokens in their light and dark variant when running the component server with npm run components-server under Theme Colors.

Application tokens (e.g. --app-color-X) reference palette tokens, and add more semantic meaning and handle exception cases, where system tokens are not enough. Should be defined for both light and dark modes. An example CL that adds application tokens can be found here.

Each token follows a naming structure that describes its role. Important keywords that are used for color roles are defined in the following table:

RoleDescription
SurfaceUniversal background colors
Primary, Secondary, TertiaryColors that are used to emphasize or de-emphasize elements
ContainersBackground colors for components
OnFor text on top a surface/container that is used
VariantColor that is used in combination with the “non-variant” counterpart, that should be de-emphasized

Custom Color Theming

DevTools adapts its own theme depending on Chrome's custom theming feature. On theme changes, the reference tokens are automatically updated to align with Chrome's theme change. Since all system tokens) make use of reference tokens, they are updated, too.

Chrome‘s theming differentiates between two default color schemes (a blue default and a grey default), and a number of accent color schemes (blue, purple, yellow, and so on). In DevTools, the default schemes are defined as baseline-grayscale and baseline-default css classes in themeColors.css. The accent color schemes don’t require extra color definitions and will adapt with the reference colors.

If DevTools doesn't receive any theming information from Chrome, it defaults to use the blue default scheme.

Usage

Defaults

Below, we present harmonious color combinations suitable for various scenarios, covering default choices for backgrounds, text, and icons.

Default colors
  • background: --sys-color-cdt-base-container
  • text default: --sys-color-on-surface
  • text fainter (use rarely): --sys-color-on-surface-subtle
  • icon: --sys-color-on-surface-subtle
  • divider lines: --sys-color-divider
Selected colors

(when DevTools is focused window)

  • background: --sys-color-tonal-container
  • text: --sys-color-on-tonal-container

(when DevTools is unfocused)

  • background: --sys-color-neutral-container
  • text: --sys-color-on-surface
Disabled colors
  • background: --sys-color-state-disabled-container
  • text: --sys-color-state-disabled
  • icons: --sys-color-state-disabled
Warning colors
  • background: --sys-color-surface-yellow
  • text: --sys-color-on-surface-yellow
  • icons: --sys-color-orange-bright
Error colors
  • background: --sys-color-surface-error
  • text: --sys-color-error
  • icons: --sys-color-error-bright
State layer colors
  • hovered: --sys-color-state-hover-on-subtle
  • keyboard focus outline: --sys-color-state-focus-ring
  • active: --sys-color-state-ripple-primary, --sys-color-state-ripple-neutral-on-subtle or --sys-color-state-ripple-on-prominent (see explanation below)

Ripple colors are for the transparent state layer of the pressed state (active). They have different intensity and are used for different base colors:

  • --sys-color-state-ripple-primary is used when elements with the primary color are pressed. Primary buttons use this ripple color for example. -on-prominent is a bit stronger than it's counter parts, making it more visible on primary.
  • --sys-color-state-ripple-neutral-on-subtle is used on light surfaces, grays or transparent backgrounds. This should be the default “pressed” color for everything else.
  • --sys-color-state-ripple-on-prominent is used for inverted components (that are using --sys-color-inverse-surface and --sys-color-inverse-on-surface colors).

Usage of colors by category

In the following we present general guidelines and examples on color choices by category (background, text, icon, and syntax highlighting).

Background colors

All backgrounds should be either a surface or a container.

  • default toolbar color: --sys-color-cdt-base-container
  • secondary toolbar color (e.g. Sources sidebar section headers like ‘Watch’ or ‘Breakpoints’): --sys-color-surface2
  • default data grid row color: --sys-color-cdt-base-container
  • alternating grid row color: --sys-color-surface1
  • warning message: --sys-color-surface-yellow
  • error message: --sys-color-surface-error
  • info message: --sys-color-cdt-base-container
  • info bar background: --sys-color-neutral-container
Text colors

Text should generally use on-surface, on-container.

  • regular: --sys-color-on-surface
  • fainter: --sys-color-on-surface-subtle
  • disabled: --sys-color-state-disabled
Icon colors

Regular (dark grey) icons should also use on-something colors:

  • default: --sys-color-on-surface-subtle
  • on hover: --sys-color-on-surface
  • disabled: --sys-color-state-disabled

For colored icons, please use icon application color tokens: --app-. In case you need to add a new icon application color token, reference --sys-color-something-bright

Syntax highlighting

Syntax highlighting should use --sys-color-token-X colors.

Dos and Don'ts

Dos
  • Use system colors (--sys-color-X)
  • Use application colors (--app-color-X) for rare deviations
Don'ts
  • Don't use reference palette colors (--ref-palette-X)
  • Don't use syntax tokens for anything other than highlighting code

Token reference

Note: You can view all system tokens in their light and dark variant when running the component server with npm run components-server under Theme Colors.

Sys color tokenCSSFigmaUsage
base--sys-color-basesys/base
base-container--sys-color-base-containersys/base-container
base-container-elevated--sys-color-base-container-elevatedsys/base-container-elevated
blue--sys-color-bluesys/blue
blue-bright--sys-color-blue-brightsys/blue-brightBright blue for icons
cdt-base--sys-color-cdt-basesys/cdt-baseDefault DevTools surface background
cdt-base-container--sys-color-cdt-base-containersys/cdt-base-containerDefault DevTools container background
cyan--sys-color-cyansys/cyan
cyan-bright--sys-color-cyan-brightsys/cyan-brightBright cyan for icons
divider--sys-color-dividersys/dividerColor for dividers
divider-on-tonal-container--sys-color-divider-on-tonal-containersys/divider-on-tonal-containerColor for dividers on top of a container with tonal colors
divider-prominent--sys-color-divider-prominentsys/divider-prominent
error--sys-color-errorsys/error
error-bright--sys-color-error-brightsys/error-brightBright red for icons
error-container--sys-color-error-containersys/error-container
error-outline--sys-color-error-outlinesys/error-outline
gradient-primary--sys-color-gradient-primarysys/gradient-primary
gradient-tertiary--sys-color-gradient-tertiarysys/gradient-tertiary
green--sys-color-greensys/green
green-bright--sys-color-green-brightsys/green-bright
inverse-on-surface--sys-color-inverse-on-surfacesys/inverse-on-surface
inverse-primary--sys-color-inverse-primarysys/inverse-primary
inverse-surface--sys-color-inverse-surfacesys/inverse-surface
neutral-bright--sys-color-neutral-brightsys/neutral-bright
neutral-container--sys-color-neutral-containersys/neutral-container
neutral-outline--sys-color-neutral-outlinesys/neutral-outline
omnibox-container--sys-color-omnibox-containersys/omnibox-container
on-base--sys-color-on-basesys/on-base
on-base-divider--sys-color-on-base-dividersys/on-base-divider
on-blue--sys-color-on-bluesys/on-blue
on-cyan--sys-color-on-cyansys/on-cyan
on-error--sys-color-on-errorsys/on-error
on-error-container--sys-color-on-error-containersys/on-error-container
on-green--sys-color-on-greensys/on-green
on-orange--sys-color-on-orangesys/on-orange
on-pink--sys-color-on-pinksys/on-pink
on-primary--sys-color-on-primarysys/on-primary
on-purple--sys-color-on-purplesys/on-purple
on-secondary--sys-color-on-secondarysys/on-secondary
on-surface--sys-color-on-surfacesys/on-surface
on-surface-error--sys-color-on-surface-errorsys/on-surface-error
on-surface-green--sys-color-on-surface-greensys/on-surface-green
on-surface-primary--sys-color-on-surface-primarysys/on-surface-primary
on-surface-secondary--sys-color-on-surface-secondarysys/on-surface-secondary
on-surface-subtle--sys-color-on-surface-subtlesys/on-surface-subtle
on-surface-yellow--sys-color-on-surface-yellowsys/on-surface-yellow
on-tertiary--sys-color-on-tertiarysys/on-tertiary
on-tertiary-container--sys-color-on-tertiary-containersys/on-tertiary-container
on-tonal-container--sys-color-on-tonal-containersys/on-tonal-container
on-yellow--sys-color-on-yellowsys/on-yellow
on-yellow-container--sys-color-on-yellow-containersys/on-yellow-container
orange--sys-color-orangesys/orange
orange-bright--sys-color-orange-brightsys/orange-bright
outline--sys-color-outlinesys/outline
pink--sys-color-pinksys/pink
pink-bright--sys-color-pink-brightsys/pink-bright
primary--sys-color-primarysys/primary
primary-bright--sys-color-primary-brightsys/primary-bright
purple--sys-color-purplesys/purple
purple-bright--sys-color-purple-brightsys/purple-bright
secondary--sys-color-secondarysys/secondary
state-disabled--sys-color-state-disabledsys/state-disabled
state-disabled-container--sys-color-state-disabled-containersys/state-disabled-container
state-focus-highlight--sys-color-state-focus-highlightsys/state-focus-highlight
state-focus-ring--sys-color-state-focus-ringsys/state-focus-ring
state-focus-select--sys-color-state-focus-selectsys/state-focus-select
state-header-hover--sys-color-state-header-hoversys/state-header-hover
state-hover-bright-blend-protection--sys-color-state-hover-bright-blend-protectionsys/state-hover-bright-blend-protection
state-hover-dim-blend-protection--sys-color-state-hover-dim-blend-protectionsys/state-hover-dim-blend-protection
state-hover-on-prominent--sys-color-state-hover-on-prominentsys/state-hover-on-prominent
state-hover-on-subtle--sys-color-state-hover-on-subtlesys/state-hover-on-subtle
state-on-header-hover--sys-color-state-on-header-hoversys/state-on-header-hover
state-ripple-neutral-on-prominent--sys-color-state-ripple-neutral-on-prominentsys/state-ripple-neutral-on-prominent
state-ripple-neutral-on-subtle--sys-color-state-ripple-neutral-on-subtlesys/state-ripple-neutral-on-subtle
state-ripple-primary--sys-color-state-ripple-primarysys/state-ripple-primary
surface--sys-color-surfacesys/surfaceUniversal surface color
surface1--sys-color-surface1sys/surface1Universal surface color
surface2--sys-color-surface2sys/surface2Universal surface color
surface3--sys-color-surface3sys/surface3Universal surface color
surface4--sys-color-surface4sys/surface4Universal surface color
surface5--sys-color-surface5sys/surface5Universal surface color
surface-error--sys-color-surface-errorsys/surface-errorSurface for error backgrounds
surface-green--sys-color-surface-greensys/surface-green
surface-variant--sys-color-surface-variantsys/surface-variant
surface-yellow--sys-color-surface-yellowsys/surface-yellowYellow surface colors used e.g. for warnings
surface-yellow-high--sys-color-surface-yellow-highsys/surface-yellow-high
tertiary--sys-color-tertiarysys/tertiary
tertiary-container--sys-color-tertiary-containersys/tertiary-containerBackground color for de-emphasizing a container next to a primary and secondary container
token-atom--sys-color-token-atomsys/token-atomSyntax highlighting
token-attribute--sys-color-token-attributesys/token-attributeSyntax highlighting
token-attribute-value--sys-color-token-attribute-valuesys/token-attribute-valueSyntax highlighting
token-builtin--sys-color-token-builtinsys/token-builtinSyntax highlighting
token-comment--sys-color-token-commentsys/token-commentSyntax highlighting for comments
token-definition--sys-color-token-definitionsys/token-definitionSyntax highlighting
token-deleted--sys-color-token-deletedsys/token-deletedSyntax highlighting
token-inserted--sys-color-token-insertedsys/token-insertedSyntax highlighting
token-keyword--sys-color-token-keywordsys/token-keywordSyntax highlighting for keywords
token-meta--sys-color-token-metasys/token-metaSyntax highlighting
token-number--sys-color-token-numbersys/token-numberSyntax highlighting for numbers
token-property--sys-color-token-propertysys/token-propertySyntax highlighting for properties
token-property-special--sys-color-token-property-specialsys/token-property-specialSyntax highlighting
token-pseudo-element--sys-color-token-pseudo-elementsys/token-pseudo-elementSyntax highlighting for pseudo elements
token-string--sys-color-token-stringsys/token-stringSyntax highlighting for strings
token-string-special--sys-color-token-string-specialsys/token-string-specialSyntax highlighting
token-subtle--sys-color-token-subtlesys/token-subtleSyntax highlighting
token-tag--sys-color-token-tagsys/token-tagSyntax highlighting
token-type--sys-color-token-typesys/token-typeSyntax highlighting
token-variable--sys-color-token-variablesys/token-variableSyntax highlighting for variables
token-variable-special--sys-color-token-variable-specialsys/token-variable-special
tonal-container--sys-color-tonal-containersys/tonal-containerBackground color for selected containers
tonal-outline--sys-color-tonal-outlinesys/tonal-outlineOutline color for selected containers with --sys-color-tonal-container
yellow--sys-color-yellowsys/yellow
yellow-bright--sys-color-yellow-brightsys/yellow-brightYellow color for icons
yellow-container--sys-color-yellow-containersys/yellow-container
yellow-outline--sys-color-yellow-outlinesys/yellow-outlineYellow outline for containers using --sys-color-yellow-container

Edge cases

In rare edge cases, you might want to define new tokens. If you do so, don‘t define --sys-color-X tokens, since these are reserved for Material’s design system, but instead create an application token --app-color-X. Be aware that you need to define light, dark and dynamic theme colors for this new token. An example CL that adds application tokens can be found here.

Resources