Theming
One seed color themes every Chameleon component, in light and dark, at the contrast you choose. Color, type, and shape each have a tab below, and Tokens is the reference for the names you set. React and Blazor show how to apply a theme in those frameworks.
Theming options
Chameleon generates a complete color theme from one seed color. Every component paints its surfaces and marks with named color roles from that theme, never a raw hex value.
Generate a theme
generateThemeCssFromHex turns a seed into a stylesheet of --ct-sys-color-* properties. Adopt it once, and every component uses it:
import { generateThemeCssFromHex } from "@materia-technologies-inc/chameleon-components-web";
const css = generateThemeCssFromHex("#6750a4");
const sheet = new CSSStyleSheet();
sheet.replaceSync(css.system);
document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];
The system stylesheet follows the operating system's light or dark setting, so you don't maintain a separate dark theme. The result also carries light and dark, each a block of the same properties for one scheme. To pin a region to one scheme, put its block in a rule for that region, as sheet.replaceSync(css.system + `.sidebar { ${css.dark} }`) does. This stylesheet has no .theme-light or .theme-dark class: only generateThemeSheet emits those.
The seed can also be an HCT color, with generateThemeCssFromHct, or an ARGB number, with generateThemeCssFromArgb.
Options
Pass an options object that names only the fields you change:
import { generateThemeCssFromHex, ColorThemeVariant } from "@materia-technologies-inc/chameleon-components-web";
const css = generateThemeCssFromHex("#6750a4", {
variant: ColorThemeVariant.Vibrant,
contrast: 0.5,
});
| Option | What it sets | Default |
|---|---|---|
variant |
How Chameleon derives the palette from the seed | ColorThemeVariant.Expressive |
contrast |
From -1 to 1; the standard levels are 0, 0.5, and 1 |
0 |
spec |
The Material color specification | ColorSpecification.MaterialExpressive2025 |
selector |
The selector the system stylesheet targets |
:root |
compat |
Whether system also works in browsers without light-dark() |
true |
The variants give the same seed a different character. Each is a ColorThemeVariant constant or its string value:
neutralandmonochrome: restrained, for editorial layoutstonal-spot: the classic Material 3 lookcontentandfidelity: stay close to the exact seed hueexpressiveandvibrant: energetic, for hero sections and launchesfruit-saladandrainbow: several hues, best used sparinglychord: three hues, the seed plus two more, 80 and 160 degrees around the color wheel. Chord is added by Chameleon, while all other themes come from Material.
A higher contrast regenerates the scheme rather than darkening it. Chameleon computes every Material on- role against its own background, so text stays legible at every level, in every variant. The information, success, and warning roles take the error roles' tones with their own hue, so their contrast follows error's.
A contrast below 0 lowers contrast, and Chameleon declares those levels non-conforming: they're outside its WCAG conformance. Don't use them in an interface that has to be accessible.
With compat on, system declares the light values, then the dark values for prefers-color-scheme: dark, then both together through light-dark() where the browser supports it. There, color-scheme: dark on any element darkens its subtree. Set compat: false for a smaller stylesheet that needs light-dark(), which every major browser has supported since 2024.
For the raw values instead of a stylesheet, generateDynamicThemeFromHex returns six maps of token name to hex: light and dark, each at standard, medium, and high contrast.
Chameleon's color utilities compute all of this. They're built on Google's Material Color Utilities, and Compared with Material lists where they differ.
Follow the user's contrast setting
generateThemeSheet builds a stylesheet that can also follow the user's contrast setting. Give it two contrast levels, and it adds the higher one under prefers-contrast: more, so the page switches when the user asks their operating system for more contrast:
import { generateThemeSheet, ContrastLevel } from "@materia-technologies-inc/chameleon-components-web";
const sheetCss = generateThemeSheet(
[{ selector: ":root", seed: "#6750a4" }],
{ contrasts: [ContrastLevel.Standard, ContrastLevel.High] },
);
Adopt sheetCss the way the first example adopts css.system. A stylesheet holds two levels at most: the one the page starts at, and the one prefers-contrast: more switches to. generateThemeCssFromHex builds one level only.
The accent families
The roles follow the Material 3 color system. Three accent families carry your brand emphasis, in descending prominence: primary, secondary, and tertiary. Each is a complete set, not a single swatch:
- the base role (
primary): a solid, high-emphasis fill - its
on-role (on-primary): text and icons on the base - a container role (
primary-container): a softer, lower-emphasis fill - the container's
on-role (on-primary-container): text and icons on the container
Use primary for the most important action, secondary for supporting emphasis, and tertiary for accents that break up a primary-heavy layout.
The status families
Four status families carry meaning, in the same base, on-, container, and on-container shape: error, information, success, and warning. Use them for feedback, such as a failed field, an informational banner, a confirmation, or a caution, and never for decoration.
Surfaces and depth
Backgrounds come from the surface roles. background is the page, and surface and surface-variant are the default component grounds. Depth comes from stepping through the surface-container tiers, from surface-container-lowest through -low, -container, and -high to -highest, each a touch more prominent than the last. surface-dim and surface-bright bracket the range for full-bleed grounds.
A raised card is a higher container tier, not a drop shadow. It re-themes with the seed, reads correctly in dark mode, and never muddies contrast.
Lines and inversion
outline draws prominent borders and dividers, and outline-variant draws quieter separators. inverse-surface and its on- role flip the scheme. Use them for elements that must stand apart from the page, such as a snackbar.
The pairing rule
An on- role only ever sits on its matching base. on-primary goes on primary, on-surface on a surface, and on-error-container on error-container. Chameleon computes every Material on- role for contrast against its own base, and the status roles follow error's contrast, so if you follow the rule, text stays legible in every variant, light or dark.
.card {
background-color: var(--ct-sys-color-surface-container-high);
color: var(--ct-sys-color-on-surface);
}
.card .cta {
background-color: var(--ct-sys-color-primary);
color: var(--ct-sys-color-on-primary);
}
.card .note {
background-color: var(--ct-sys-color-error-container);
color: var(--ct-sys-color-on-error-container);
}
Write your own CSS with roles, correctly paired, and never a literal color. Your interface then recolors the moment the seed changes.
Hover and pressed
A hovered or pressed control lays a translucent overlay over its background, 8% on hover and 10% when pressed, which can pull text below 4.5:1. Keyboard focus shows as a ring, not an overlay, so hover and focus never stack; a press paints on top of hover. The pressed roles are solved for a mouse press over hover, 10% over 8%, about 17.2% in all; a touch or keyboard press (10% alone) is lighter. For the text roles that need it, the theme adds roles that hold 4.5:1 under the overlay:
on-primary-container,on-secondary-container,on-tertiary-container,on-error-container, and the three status container roles each get-hover,-pressed, and-state-layer, the overlay's color.on-primary,on-secondary,on-tertiary,on-error, and the three status roles, text on their own fill, get the same three.on-surface,on-surface-variant,primary,secondary,tertiary, anderroreach get-hoverand-pressed.on-primary-containerandon-secondary-containereach get-selected,-selected-hover, and-selected-pressed, for text on a selected data grid row, whose fill is the container mixed with 15%on-surface.on-surfacegets-selected-hover,-selected-pressed, and-selected-state-layer, for a selected row in a standard table, which has no fill, so the row is whatever surface it sits on mixed with 15%on-surface.
Components use them on their own. Use them in your own CSS wherever you paint a hover or pressed overlay:
.tag {
background-color: var(--ct-sys-color-secondary-container);
color: var(--ct-sys-color-on-secondary-container);
}
.tag:hover {
background-color: color-mix(
in srgb,
var(--ct-sys-color-on-secondary-container-state-layer) 8%,
var(--ct-sys-color-secondary-container)
);
color: var(--ct-sys-color-on-secondary-container-hover);
}
Each role keeps its text role's hue and moves its tone only as far as 4.5:1 needs, so in most themes it equals the resting color. A stylesheet generated by an earlier release lacks them, so regenerate any theme stylesheet you stored. Compared with Material explains how they're computed.
Chameleon's type scale is a small, fixed set of roles, five styles in three sizes each. Choose a role for what a piece of text is, and the role sets its size, weight, line height, and tracking together. A theme chooses two fonts, and every role uses one of them.
The scale
There are five roles, each in three sizes:
| Role | Sizes | Use it for |
|---|---|---|
display |
large, medium, small | The largest text on a page, such as hero headings |
headline |
large, medium, small | Section headings and prominent short text |
title |
large, medium, small | Card titles, dialog titles, and subheadings |
body |
large, medium, small | Running prose: paragraphs and descriptions |
label |
large, medium, small | Buttons, chips, captions, and other interface text |
Apply it
Each role and size is a set of tokens, --ct-sys-typescale-<role>-<size>-*, for the size, weight, line height, tracking, and font. Read them in your own CSS:
.callout {
font-family: var(--ct-sys-typescale-title-large-font);
font-size: var(--ct-sys-typescale-title-large-size);
line-height: var(--ct-sys-typescale-title-large-line-height);
font-weight: var(--ct-sys-typescale-title-large-weight);
letter-spacing: var(--ct-sys-typescale-title-large-tracking);
}
Fonts
A theme sets two fonts. The brand font sets the display, headline, and large title roles. The plain font sets the medium and small titles, body text, and labels. Each is one custom property. Set it on the root, or on any element whose contents should use it:
:root {
--ct-ref-typeface-brand: "Fraunces", Georgia, serif;
--ct-ref-typeface-plain: "Inter", system-ui, sans-serif;
}
| Font | Property | Roles |
|---|---|---|
| Brand | --ct-ref-typeface-brand |
display, headline, title large |
| Plain | --ct-ref-typeface-plain |
title medium and small, body, label |
Every role, and every component's text, reads one of the two, so changing them changes the whole interface. Both default to Noto Sans. Load the font files the way you load any web font: Chameleon only names the families. To give each theme its own pair, set them inside each theme's selector.
Heading level is not type style
An element's heading level is about document structure, and its type style is about how it looks. A visually large hero might be an <h1> styled as display small, while a small section label might still need to be an <h2> for the outline, styled as a label.
Choose the heading level for a correct document outline, with one <h1> and no skipped levels, and the type style for the weight the design calls for. Don't use a bigger heading tag to get bigger text: that breaks the outline screen readers rely on.
Chameleon draws the smooth superellipse corners that Material 3 Expressive calls for, such as the continuous squircle, rather than plain rounded rectangles. It draws them the same way in every browser.
Superellipse corners
A superellipse corner is one of a family of curves between a sharp right angle and a full ellipse. A high parameter gives the plump, continuous squircle; a low one makes the corner scoop inward. CSS is standardizing these shapes through the corner-shape property, and Chameleon follows its model: a squircle is superellipse(2), a bevel is superellipse(0), and a scoop is superellipse(-1).
Not every browser supports corner-shape yet. Chameleon draws the corners itself, so a component's corners look the same in Safari and Firefox as they do in Chrome.
Set the shape
Corner shape is a theme token, --ct-sys-corner-shape. Set it once to restyle every component that reads it. To change one component, set its own --ct-<component>-corner-shape token:
/* Every component */
:root {
--ct-sys-corner-shape: squircle;
}
/* Just the buttons in the hero */
.hero {
--ct-button-corner-shape: superellipse(3);
}
The named values map onto the specification's superellipse parameter, from concave to convex:
| Token value | Superellipse | Corner |
|---|---|---|
notch |
superellipse(-infinity) |
Concave right angle |
scoop |
superellipse(-1) |
Concave curve |
bevel |
superellipse(0) |
Diagonal slice |
round |
superellipse(1) |
Elliptical curve, the default |
squircle |
superellipse(2) |
The continuous Material 3 Expressive squircle |
square |
superellipse(infinity) |
Sharp right angle |
For anything in between, write the function directly, such as superellipse(1.5) or superellipse(3).
Chameleon's one public styling surface is CSS custom properties whose names begin --ct-. Every color, corner, and type value a component reads resolves through a --ct-* token. You retheme by setting those properties, globally, on a subtree, or on one element, and never by reaching inside a component. This tab lists what the names are and which of them are stable.
The --ct- prefix
--ct- stands for "Chameleon token", and it's the only prefix to use in your own CSS. Custom properties that begin --_ are private to a component's shadow root and aren't API.
Three token tiers
There are three tiers of custom property, and only the first two are public.
| Tier | Shape | Public? | Set it to |
|---|---|---|---|
| System | --ct-sys-<family>-<role> |
Yes | Retheme a whole family at once, such as every surface, the corner shape, or the type scale |
| Per-component | --ct-<component>-<token> |
Yes | Override one component's token without touching the rest of the theme |
| Private | --_<token> |
No | Never: it's internal to a component's shadow root |
System tokens are the design system's vocabulary, such as --ct-sys-color-primary, --ct-sys-corner-radius-large, and --ct-sys-typescale-body-large-size. Per-component tokens narrow the same idea to one component, such as --ct-button-corner-shape and --ct-button-elevated-container-color. A per-component token, where it exists, falls back to a system token. One system change then ripples through every component. A per-component override changes only its component.
Token names
The component comes first, and a variant follows it. A component with variants spells them --ct-<component>-<variant>-<token>, so every token a component owns sorts together. --ct-button-corner-shape sits beside --ct-button-elevated-container-color and --ct-button-filled-container-color. Type --ct-button- in your editor, and it completes the whole button surface.
The element decides, not how the name reads. A plain tooltip and a rich tooltip are separate elements, so their tokens are --ct-plain-tooltip-* and --ct-rich-tooltip-*. A basic dialog and a full-screen dialog are one element, cw-dialog, with two variants, so theirs are --ct-dialog-basic-* and --ct-dialog-full-screen-*. When you're unsure, check whether the tag exists: there's a cw-plain-tooltip, and there's no cw-basic-dialog.
The resolution chain
Each token resolves through nested CSS var() fallbacks. Inside a component's shadow root, a private property holds the chain, and every visual property reads that private property. Here is the chain for the elevated button's container color:
/* Illustrative: emitted inside the button's shadow root */
:host {
--_container-color: var(
--ct-button-elevated-container-color, /* 1. per-component (public) */
var(--ct-sys-color-surface-container-low, /* 2. system (public) */
#f8f1fa) /* 3. built-in fallback */
);
background-color: var(--_container-color);
}
CSS takes the first property in the chain that has a value:
- If you set
--ct-button-elevated-container-color, it wins, and only elevated buttons change. - Otherwise
--ct-sys-color-surface-container-lowapplies. Your theme sets it, so it follows the seed and the light or dark scheme. - If you set neither, the built-in hex keeps the component rendering.
The same chain makes global, scoped, and per-instance theming work with no special cases.
A hover or pressed text token has one more link: it falls back to the component's resting text token before the hover or pressed color role. So a resting text color you set applies on hover and pressed too, as it is. Set the hover and pressed tokens as well when your color needs adjusting under the overlay. A hover or pressed color role falls back to its resting role, so a theme stylesheet that predates those roles still renders.
System token families
| Family | Prefix | Roles |
|---|---|---|
| Color | --ct-sys-color-* |
The Material 3 roles plus Chameleon's status roles: primary, on-primary, primary-container, secondary*, tertiary*, error*, information*, success*, warning*, the surface* tiers, outline, outline-variant, inverse-*, the *-fixed roles, scrim, and shadow, plus Chameleon's hover, pressed, and selected roles, such as on-secondary-container-hover, on-secondary-container-pressed, on-secondary-container-state-layer, and on-secondary-container-selected |
| Corner radius | --ct-sys-corner-radius-* |
none, extra-small, small, medium, large, large-increased, extra-large, and full |
| Corner shape | --ct-sys-corner-shape |
The superellipse family: round, squircle, scoop, bevel, and the rest |
| Typography | --ct-sys-typescale-<role>-<size>-* |
display, headline, title, body, and label, each large, medium, and small, with -size, -weight, -line-height, -tracking, and -font |
| Elevation | --ct-sys-elevation-* |
level0 to level5 |
| Motion | --ct-sys-motion-* |
Durations and easing curves |
| State | --ct-sys-state-* |
The state-layer opacity for hover, focus, pressed, and dragged. The hover and pressed color roles assume the defaults, 8% and 10% |
Only the color family comes from your seed, as the Color tab describes. The others have built-in Material 3 Expressive defaults: set them at any scope to retheme, or leave them unset.
Three scopes of theming
A component always reads through the chain, so the same tokens theme at three scopes. No component needs to opt in.
Global: set system tokens on :root, or adopt a generated theme stylesheet, and every component picks them up:
:root {
--ct-sys-corner-shape: squircle;
}
Scoped: set tokens on a class or container, and only that subtree changes. A system token set here overrides the global one for its descendants:
.dashboard {
--ct-sys-corner-shape: round;
--ct-sys-typescale-body-medium-size: 15px;
}
To change a color role on a subtree, generate the override instead of setting it in CSS, as Overriding a color role on part of a page describes.
Per instance: set a per-component token on one element, and only that element changes:
#save {
--ct-button-corner-shape: squircle;
}
Global and scoped overrides usually set system tokens, which cascade to every component beneath them. Per-instance overrides usually set per-component tokens, the first link in the chain. All three work together, and the first property in the chain that has a value wins.
Overriding a color role on part of a page
A system color role has state roles solved from it: the hover, pressed and state-layer colors that keep text at 4.5:1 under its overlay. State roles are text colors. The text on a fill or container, such as on-primary and on-primary-container, has -hover, -pressed and -state-layer roles. The text on surfaces, on-surface, on-surface-variant, primary, secondary, tertiary and error, has -hover and -pressed: primary-hover is primary text on a hovered surface, not a state of the primary fill.
Setting the role alone in CSS, as .promo { --ct-sys-color-primary: green; } does, leaves those state roles at the theme's values, so a button's hover and pressed text can lose contrast. Generate the override instead. generateOverrideSheet writes the roles you change and every state role solved from them, light and dark, computed the way the theme sheet computes its own:
import { generateOverrideSheet, generateThemeSheet } from "@materia-technologies-inc/chameleon-components-web";
const theme = { seed: "#6750a4" };
const sheet = new CSSStyleSheet();
sheet.replaceSync(
generateThemeSheet([{ selector: ":root", ...theme }]) +
generateOverrideSheet({
theme,
selector: ".promo",
overrides: { primary: { light: "#1b6c3a", dark: "#8fd8a0" } },
}),
);
document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];
- Pass the same theme.
themetakes the seed, variant, specification and contrast levels the page's theme sheet was generated with. The state roles are computed against that theme's colors. - Name roles without the prefix.
overridestakesprimary,surface-containerand the other resting roles, typed asSystemColorRole. A plain string sets both schemes;{ light }or{ dark }sets one and keeps the theme's value, its own override included, in the other. - What it reaches. Changing a fill or container, such as
primary, also recomputes the state roles of the text on it (on-primary-hover,-pressedand-state-layer). Changing a surface, such assurface-container, recomputes every surface-text state role and a standard table's selected-row roles. - Development builds warn. A theme sheet records the value each role's state roles were computed for, as
--ct-sys-color-<role>-solved, whether it comes fromgenerateThemeSheet,generateThemeCssFromHexorgenerateDynamicThemeTokensFromHex. Where a component sits under a role that differs from its record, the development build logs a console warning naming the role and the element that sets it, once per page for each role and value: one CSS rule on many elements warns once. A sheet fromgenerateOverrideSheetwrites matching records, so it doesn't warn. A theme sheet adopted after the page's components connect is checked when another component connects, or once a second after the first check. A sheet adopted later than that, on a page that connects nothing afterward, isn't checked. Production builds never check. - Regenerate every stored sheet together. Records inherit. A stylesheet you generated and stored before this release has none, so nested inside a regenerated one it reads the outer sheet's records, and the development build warns for every role it changes.
- Forcing classes. Where a browser supports
light-dark(), the override follows.theme-lightand.theme-darkwherever they are, as the theme does. In an older browser, it follows a forcing class on the element it applies to, as<div class="promo theme-dark">, the same reach the theme sheet's own fallback has. If the theme sheet uses other forcing classes, pass the same ones asforcing.generateThemeCssFromHexemits neither class: pin a region with itsdarkorlightblock. - As values.
resolveOverrideRolesreturns the same roles as a map of light and dark values, for code that sets them some other way.
What is stable, what is not
The prefix draws the line.
Stable, so depend on these:
- Every system token name:
--ct-sys-color-*,--ct-sys-corner-radius-*,--ct-sys-corner-shape,--ct-sys-typescale-*,--ct-sys-elevation-*,--ct-sys-motion-*, and--ct-sys-state-*. - Every per-component token name,
--ct-<component>-<token>. The React and Blazor docs list the same--ct-*names, so the token contract is identical for all frameworks.
Not stable, so never depend on these:
- Any
--_*property. It's the private left-hand side of a chain, such as--_container-color, and any release can rename, split, or remove it. Production builds also shorten these names. Set the--ct-*token it falls back to instead.
The rule in one line: if it starts with --ct-, it's API; if it starts with --_, it isn't.
React apps theme Chameleon with the same functions as web components, imported from the React package. There's no theme component, provider, or hook to add.
Apply a theme at startup
Adopt the theme before the first render, where you create the root, and the first paint is already in your colors:
import { createRoot } from "react-dom/client";
import { generateThemeCssFromHex } from "@materia-technologies-inc/chameleon-components-react";
import { App } from "./App";
const theme = new CSSStyleSheet();
theme.replaceSync(generateThemeCssFromHex("#6750a4").system);
document.adoptedStyleSheets = [...document.adoptedStyleSheets, theme];
createRoot(document.getElementById("root")!).render(<App />);
The system stylesheet follows the operating system's light or dark setting. The options, variants, and contrast levels are on the Color tab, and work the same way here.
Change the theme while the app runs
Keep one stylesheet and replace its contents when the seed changes. Every component on the page recolors, without a rerender.
import { useEffect } from "react";
import { generateThemeCssFromHex } from "@materia-technologies-inc/chameleon-components-react";
let theme: CSSStyleSheet | undefined;
export function useSeedColor(seed: string) {
useEffect(() => {
if (!theme) {
theme = new CSSStyleSheet();
document.adoptedStyleSheets = [...document.adoptedStyleSheets, theme];
}
theme.replaceSync(generateThemeCssFromHex(seed).system);
}, [seed]);
}
The stylesheet is made inside the effect, which runs only in the browser, so the hook also works in an app that renders on the server.
Follow the user's contrast setting
generateThemeSheet and ContrastLevel come from the same package. Adopt the stylesheet it returns the same way, and the page switches to the higher contrast level when the user asks their operating system for more contrast.
Blazor apps theme Chameleon through IChameleonThemeService, which AddChameleonServices() registers. Inject it into a component and call it.
Apply a theme from one seed color
ApplyFromHexAsync() generates a theme and applies it to the whole page, replacing the theme an earlier call applied. Call it from OnAfterRenderAsync() in a component that renders interactively, for example in your layout when Routes has an interactive render mode. Under static rendering OnAfterRenderAsync() never runs, so the theme is never applied:
@using Chameleon.Blazor
@inject IChameleonThemeService ThemeService
@code {
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await ThemeService.ApplyFromHexAsync("#6750a4");
}
}
}
The theme follows the operating system's light or dark setting. Call ApplyFromHexAsync() again with another seed, and every component on the page recolors.
The optional parameters set the theme's character, as on the Color tab:
await ThemeService.ApplyFromHexAsync(
"#6750a4",
variant: ColorThemeVariant.Vibrant,
contrast: ContrastLevel.Medium.Value);
| Parameter | What it sets | Default |
|---|---|---|
variant |
How Chameleon derives the palette from the seed | ColorThemeVariant.Expressive |
specification |
The Material color specification | ColorSpecification.MaterialExpressive2025 |
contrast |
From -1 to 1; the standard levels are ContrastLevel.Standard, Medium, and High |
0 |
Generate a stylesheet
GenerateThemeSheetAsync() returns the theme as stylesheet text, for you to put on the page. It takes one or more ThemeSpec values, each a selector and a seed color, so one stylesheet can theme several regions:
@using Chameleon.Blazor
@inject IChameleonThemeService ThemeService
<style>@((MarkupString)themeCss)</style>
<div data-theme="brand">
<CbButton>Brand action</CbButton>
</div>
@code {
private string themeCss = "";
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
themeCss = await ThemeService.GenerateThemeSheetAsync(
[
new ThemeSpec(":root", "#6750a4"),
new ThemeSpec("[data-theme=\"brand\"]", "#b3261e") { Variant = ColorThemeVariant.Vibrant },
],
ContrastLevel.Standard);
StateHasChanged();
}
}
}
Where two themes share a selector, the later one wins.
Follow the user's contrast setting
Give a ThemeSpec two contrast levels in Contrasts, and its stylesheet switches to the higher one when the user asks their operating system for more contrast:
new ThemeSpec(":root", "#6750a4")
{
Contrasts = [ContrastLevel.Standard.Value, ContrastLevel.High.Value],
}