Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

feat(web): fresher, neutral colour system with generated colour ramps (#16098)

moaaz6249566df9c7
diff --git a/brain/knowledge/design-system/colour.md b/brain/knowledge/design-system/colour.md
index 26005cf4853..b83a072d7d6 100644
--- a/brain/knowledge/design-system/colour.md
+++ b/brain/knowledge/design-system/colour.md
@@ -8,7 +8,7 @@ Five scales of twelve steps, plus six exceptions. **There is no semantic layer**
*is* the meaning, in both themes, and the table below is the contract.
```
---gray-1 … --gray-12 the neutral, tinted toward the brand hue
+--gray-1 … --gray-12 the neutral, pure grey whatever the brand
--accent-1 … --accent-12 the brand
--success- / --warning- / --danger- 1 … 12
```
@@ -23,9 +23,9 @@ Five scales of twelve steps, plus six exceptions. **There is no semantic layer**
| 6 | subtle border — dividers and hairlines |
| 7 | component border |
| 8 | strong border, and the focus ring |
-| 9 | solid fill — a button, a filled shape; and, on `gray` only, the one ink allowed to be quiet, for decoration that owes 3:1 rather than 4.5:1 (a chevron, an empty-state glyph). `accent-9` is the tenant's hex, so it owes nothing as ink |
-| 10 | defined, but no call site uses it: a solid hovers as step 9 at 90% opacity, because `accent-9` is the tenant's hex and step 10 is not derived from it |
-| 11 | low-contrast text, **and every thin coloured mark** — status dots, meter lines; a filled block such as a health bar is step 9 |
+| 9 | solid fill — a button, a filled shape, a progress bar, a chart series, a status dot; and, on `gray` only, the one ink allowed to be quiet, for decoration that owes 3:1 rather than 4.5:1 (a chevron, an empty-state glyph). `accent-9` is the tenant's hex, so it owes nothing as ink |
+| 10 | a small mark that has to be seen on its own — a status dot, a step-complete line. It keeps 3:1 on the page in both themes for any seed, which step 9 (the admin's own colour) cannot promise |
+| 11 | low-contrast text, and icons that sit in a line of text (a trash icon, a warning triangle) |
| 12 | high-contrast text |
Steps **1 and 12 are an inverse pair**: `bg-gray-12 text-gray-1` is a dark chip in light mode and a
@@ -34,9 +34,10 @@ divider need no names: they are `gray-12`, `accent-8`, `gray-2` and `gray-6`. A
the thing it hovers: a row on the page hovers to `gray-3` or `gray-4`, a `gray-3` component to `gray-4`. A
chip inside a row that hovers or selects sits on `gray-5`, so neither state swallows it.
-A thin mark (a dot, a meter line) is step 11, because step 11 already owes 4.5:1 on every ground in both
-themes and matches the label beside it. A filled block, such as a health bar, is step 9: at that size
-step 11 reads dark in light mode and washed out in dark, and the solid is what the block is.
+Colour that is a *shape* rather than text is a solid. A fill — a progress bar, a chart line or area, a health
+bar — is step 9. A small status dot is step 10, which the generator keeps at 3:1 on the page even when an admin
+picks a pale colour. Step 11 is a text shade: drawn as a dot or a bar it reads dark and dead, so it stays for text
+and for icons inside a line of text.
## The six exceptions
@@ -51,10 +52,20 @@ inside an island, can do it, it is not an exception.
| `--on-danger` | white in both themes; `gray-1` measures under 4.5:1 on the dark `danger-9`. With a status seed, it is measured against the seed like `--on-accent` |
| `--scrim` | black at an alpha in both themes; not a member of any scale |
+Every coloured scale (accent, success, warning, danger) comes from one generator, `brandColors.ramp`
+(`@activepieces/shared`). Given a hex, it finds the nearest of our colour families by hue and walks that family's shades:
+light steps 1–12 are the shades `25 50 100 150 200 250 300 400 · 600 700 900` (step 9 is the hex itself), dark
+steps 1–8 use the family's 950–700 hue and chroma on a deep ladder (`14 17 20.5 24 27.5 31 38 47`), and dark 10–12
+are 400, 300 and 100. The family's hue drift and chroma follow the hex, so a custom teal behaves like our teal.
+Step 11 is then lowered (light) or raised (dark) until it reads 4.5:1 on every ground and on its own tint, and step
+10 until it reads 3:1 on the page. The defaults in `styles.css` are this generator's output for violet (`#6e41e2`),
+red, amber and green; `status-scales.test.ts` fails if
+the CSS and the generator drift apart.
+
`success-9` and `warning-9` are bright in both themes, so the health bars read as green and amber; in light mode `warning-9` is lighter than `warning-8`, the one place a light ramp is not monotonic.
-In light mode the page (`gray-1`) is very slightly tinted and panels are pure white, so a card lifts off
-the page by a 1.05:1 step. That is designed, not a patch.
+In light mode the page (`gray-1`) is an off-white and panels are pure white, so a card lifts off
+the page by a hair (about 1.02:1); borders and shadows carry the rest. That is designed, not a patch.
## Light and dark
@@ -62,35 +73,43 @@ Light and dark are **authored independently**; dark is not an inversion of light
ramp crowds the dark steps together. Dark mode is the `[data-theme='dark']` binding block in `styles.css`,
not overrides in components.
+## The greys are not tinted, and they are light
+
+The grey scale never takes the brand hue. Every step is a literal `oklch(L% 0 0)`, so every
+grey is a true neutral in both themes and sits beside any tenant's colour without turning the whole UI purple, green
+or blue. The brand reaches the UI only through the accent scale.
+
+Each grey step's lightness is anchored on the token its call sites used before the step system (sidebar `98.2%`,
+chip `97%`, border `92.2%`, muted text `52%`, strong text `16%` in light), so the app keeps its old weight. Step 11
+sits at the lightest value that still reads 4.5:1 on every chip ground; do not lighten it further.
+
+Dark follows the same rules as light: neutral greys, and swatches from the same colour families. Its greys
+are deep (`gray-1` 11%, `gray-2` 16.2%) so the sidebar, page and panels separate. Its swatch marks are the family's
+500 at 80% chroma with the family's 950 as the label, calmer than light mode's 600 on a near-black ground.
+
## White-labelling
-A platform's `primaryColor` drives the brand. `brandColors.cssVariables` turns it into a
-**fixed four-key seed** written on `<html>` in both themes: `--brand-h`, `--brand-c`, `--accent-9` (the
-tenant's hex, with a `#` added if it was missing) and `--on-accent` (white or black, whichever measures higher against it). The rest
-of the accent scale and the grey tint derive from hue and chroma in CSS, through plain `var()` inside
-`oklch()` — no relative colour syntax. The three status hues default to literals on `:root`: a tenant's purple must not tint
-the danger red. A black, grey or white brand colour has no hue, so it gets `--brand-c: 0` and
-the accent scale and grey tint render neutral. Each colour in the *Colors* block has a live preview under its picker (its button and key steps, in the viewer's own theme; `color-preview.tsx`). The label on every seeded solid is white or black, whichever measures higher, which always clears 4.5:1.
-
-An admin can also **seed each status scale**: danger, warning and success, set under Platform → General →
-*Colors* and stored under `themeColors.status` (`danger`, `warning`, `success`).
-`brandColors.statusCssVariables` gives each chosen hex the same four keys (`--danger-h`, `--danger-c`,
-`--danger-seed` for step 9, `--on-danger-seed` for its label); a scale with no seed keeps its stock values,
-because every seeded step falls back to them. Only the lightness ladder is ours, so step 11 keeps 4.5:1 at
-any hue: `test/styles/status-scales.test.ts` sweeps every hue in both themes. The status hues are still
-never *derived* from the brand. Only an explicit seed moves them. The `theme` flag serves `themeColors.status`
-as `statusColors`. The seeds live under their own key because the previous form wrote `danger`, `warn` and
-`success` with pre-filled defaults the admin never chose; those fields, like the rest of `themeColors`, are
-kept as stored and never rendered, so nothing has to guess which values were real.
+A platform's `primaryColor` drives the accent scale; the optional danger, warning and success colours
+(`themeColors.status`, served by the `theme` flag as `statusColors`) each drive their own scale. They are never
+derived from one another. `brandColors.cssVariables` and `brandColors.statusCssVariables` run the generator on the
+chosen hex and write every step for both themes on `<html>` (`--accent-light-3`, `--accent-dark-3`, …), plus the
+label (`--on-accent`, `--on-danger-seed`, …: white or black, whichever measures higher). Each theme block reads
+`--accent-3: var(--accent-light-3, <stock value>)`, so a platform with no colour chosen gets the stock ramp and an
+island (`data-theme`) picks its own theme's half. A black, grey or white colour renders a neutral ramp. Each colour
+in the *Colors* block has a live preview under its picker (`color-preview.tsx`). The seeds live under their own key
+because the previous form wrote `danger`, `warn` and `success` with pre-filled defaults the admin never chose; those
+fields, like the rest of `themeColors`, are kept as stored and never rendered.
## Categorical colour
A scale answers *"what does this mean?"*. For *"which one is this?"* — projects, notes, avatars, chart
series, tag categories — use the twelve-hue swatch set: `swatch-1` … `swatch-12`, each with `-mark`,
-`-surface`, `-ink`, `-line` and `-on`. Every member is solved to the same contrast (3.2:1 on white for a
-mark) under a shared chroma ceiling, rather than to the same lightness and chroma, and a
-`@media (color-gamut: p3)` block re-runs the solve against the wider gamut, so most hues gain chroma and
-the sRGB-starved ones (teal, cyan, blue) gain the most.
+`-surface`, `-ink`, `-line` and `-on`, all generated by `brandColors.swatches()` from one of our colour families
+(purple, fuchsia, pink, red, orange, yellow, lime, green, emerald, cyan, blue, indigo). The mark is the most vivid
+shade whose label still reads at 4.5:1: the 500 with the family's own 950 as the letter where that reads (the warm
+and green families), otherwise the 600 with a white letter. Dark mode takes a calmer 500/400 at 85% chroma with the
+950 letter. The surface, line and ink are the same steps the ramps use (3, 5 or 7, and 11), so swatch text reads at
+4.5:1 on its own tint. The CSS values are the generator's output, and `status-scales.test.ts` fails if they drift.
Store the **name** (`ColorName.YELLOW`), never the rendered value, so the value is free to differ per
theme. A name maps to the same swatch for projects (`PROJECT_COLOR_SWATCH`) and notes. There are four warm
@@ -107,6 +126,14 @@ resolves in the island's light values. `className` styles the plate and `innerCl
inside it (a percentage padding would resolve against the plate's *parent*). `PieceIcon` is a tooltip wrapper
over it.
+- **`tint` gives the plate a flat wash of the logo's own colour** (`lib/logo-tint.ts`). The logo is loaded once with
+ CORS, sampled at 24px, and its visible, *coloured* pixels are averaged in OKLab, weighted by chroma, so white and
+ transparent areas do not dilute it and a dark but colourful logo (Slack) still counts. Fewer than 8% coloured
+ pixels means no tint (GitHub, OpenAI). The tint is always `oklch(96.5% 0.022 <hue>)`: one lightness and chroma
+ for every logo, so no piece reads louder than another. The plate is a light island, so it is the same in dark
+ mode, which is what broke the old `ImageWithColorBackground` (it mixed with `#fff` on a themed ground). A host
+ without CORS just gets no tint; the logo still renders. On for `PieceIcon` and canvas step logos.
+
Our *own* logo is not a plate: `activepieces-wordmark.tsx` inlines it so the lettering is `currentColor`.
It renders only while the platform uses the stock logo; an uploaded logo renders as-is.
@@ -128,7 +155,7 @@ the wrapper clips) and `imageClassName` the image. On failure it renders a monog
- **The wordmark's mark** — keeps the literal Activepieces purple; the lettering is `currentColor`.
- **The builder minimap** — fills each block with the average colour of its step's logo, so a long flow
stays readable at thumbnail size. It composites through `--panel` and falls back to `--gray-11`. This is
- the only place colour is still sampled from an image; do not add another.
+ one of two places colour is sampled from an image; the other is the piece-logo tint (`lib/logo-tint.ts`). Do not add a third.
- **Older effects** — the `.recurring-chip`, gradient-border and note-scrollbar colours in `styles.css`, and
the sheen, shimmer and ripple glows in `tag-with-bright.tsx`, `automatic-trial-activation.tsx`,
`automations-empty-state.tsx` and `theme-provider.tsx`. They predate the scales and read the same in both
@@ -147,8 +174,8 @@ the wrapper clips) and `imageClassName` the image. On failure it renders a monog
inside. `<LogoPlate>` and the plan card are the two.
- **A surface that is dark in both themes is a dark island** — `data-theme="dark"` on it, then ordinary
steps inside (the terminal, the function tooltip, anything on `--scrim`). Never `bg-gray-12`: that is the
- inverse ground, near-white in dark mode, and step 11 is not tuned for it. The seed defaults sit on `:root`
- only, so an island keeps the tenant's brand (seeds are written on `<html>`, so every island inherits them); `dark:` resolves to the nearest island, one level deep.
+ inverse ground, near-white in dark mode, and step 11 is not tuned for it. A chosen colour is written on `<html>` as
+ both themes' values, so an island keeps the tenant's brand and picks its own theme's half; `dark:` resolves to the nearest island, one level deep.
- **Read `resolvedTheme`, never `preference`,** to decide what something looks like. `preference` can
be `'system'`, and comparing it to `'dark'` is how the code editors ended up light in a dark app.
- **Never tint a surface or border with a solid at an opacity.** `bg-accent-9/10` is `accent-3` and `border-danger-9/40` is
diff --git a/brain/knowledge/design-system/index.md b/brain/knowledge/design-system/index.md
index cd8d13600f3..c21913102fb 100644
--- a/brain/knowledge/design-system/index.md
+++ b/brain/knowledge/design-system/index.md
@@ -16,15 +16,16 @@ _Avoid_: "palette" (that is the swatch set), "ramp"
**Exception** — one of the six named tokens that exist because no step can do their job (`--panel`,
`--on-accent`, `--on-success`, `--on-warning`, `--on-danger`, `--scrim`).
-**Seed colour** — a hex a platform picks. `primaryColor` seeds the accent scale and the grey tint; the optional
+**Seed colour** — a hex a platform picks. `primaryColor` seeds the accent scale (the greys stay neutral); the optional
danger, warning and success colours (`themeColors.status`) each seed their own scale.
-**Seed** — the four-key set `brandSeed` writes on `<html>` from a seed colour: for the brand `--brand-h`,
-`--brand-c`, `--accent-9`, `--on-accent`; for a status scale `--danger-h`, `--danger-c`, `--danger-seed`,
-`--on-danger-seed` (and the same for warning and success). Everything else derives from them in CSS.
+**Ramp** — the twelve steps of one scale for both themes, generated from a seed colour by `brandColors.ramp`
+(nearest colour family, contrast-checked steps 10 and 11). `brandSeed` writes a chosen colour's ramp on `<html>`
+as `--accent-light-N` / `--accent-dark-N` (and the same for danger, warning, success); the CSS defaults are the
+generator's output for the stock colours.
-**Mark** — a coloured shape carrying no text: a status dot, a meter, a progress bar. Step 11, except a
-filled block such as a health bar, which is the solid, step 9.
+**Mark** — a coloured shape carrying no text. A small status dot is step 10; a fill such as a progress bar,
+meter or chart series is step 9.
**Swatch** — the twelve-hue *categorical* set (`swatch-1` … `swatch-12`), for "which one is this?"
rather than "what does this mean?" — projects, avatars, chart series. Not a scale.
@@ -46,7 +47,7 @@ themes, because we cannot recolour someone else's artwork. `<LogoPlate>` renders
## Key files
- `packages/web/src/styles.css` — the scales, exceptions, swatches and both theme blocks
-- `packages/core/shared/src/lib/core/common/` — `brandColors.cssVariables` and `statusCssVariables` (compute the seeds; `lib/brand-seed.ts` writes them) and
+- `packages/core/shared/src/lib/core/common/` — `brandColors.ramp`, `cssVariables` and `statusCssVariables` (generate the ramps; `lib/brand-seed.ts` writes them) and
`swatchUtils`
- `packages/web/src/components/custom/logo-plate.tsx` — the one way to render a third-party logo
- `packages/web/src/lib/syntax-theme.ts` — the one place the code and JSON viewers pick a theme
diff --git a/bun.lock b/bun.lock
index 6c245989173..4fdd24c2244 100644
--- a/bun.lock
+++ b/bun.lock
@@ -165,7 +165,7 @@
},
"packages/core/shared": {
"name": "@activepieces/shared",
- "version": "0.191.0",
+ "version": "0.192.0",
"dependencies": {
"@activepieces/core-execution": "workspace:*",
"@activepieces/core-formula": "workspace:*",
diff --git a/packages/core/shared/package.json b/packages/core/shared/package.json
index 31e3c92607a..b9cadc19473 100644
--- a/packages/core/shared/package.json
+++ b/packages/core/shared/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/shared",
- "version": "0.191.2",
+ "version": "0.192.0",
"type": "commonjs",
"sideEffects": false,
"main": "./dist/src/index.js",
diff --git a/packages/core/shared/src/lib/core/common/brand-colors.ts b/packages/core/shared/src/lib/core/common/brand-colors.ts
index f765c2495e6..c619971dc00 100644
--- a/packages/core/shared/src/lib/core/common/brand-colors.ts
+++ b/packages/core/shared/src/lib/core/common/brand-colors.ts
@@ -1,19 +1,275 @@
-const REFERENCE_CHROMA = 0.2281
-const MIN_CHROMA_SCALE = 0.4
-const MAX_CHROMA_SCALE = 1
const ACHROMATIC_CHROMA = 0.02
-const DEFAULT_BRAND_HUE = 288.86
+const MAX_CHROMA_RATIO = 1.25
const DEFAULT_ACCENT_SOLID = '#6e41e2'
const WHITE = '#ffffff'
const BLACK = '#000000'
-const STATUS_SCALE_DEFAULTS: Record<StatusScale, { hue: number, referenceChroma: number, solid: string }> = {
- danger: { hue: 25, referenceChroma: 0.1994, solid: '#c11825' },
- warning: { hue: 75, referenceChroma: 0.1591, solid: '#f9ad28' },
- success: { hue: 150, referenceChroma: 0.16, solid: '#33ac5a' },
+const TEXT_CONTRAST = 4.5
+const MARK_CONTRAST = 3
+const LIGHTNESS_STEP = 0.5
+const STEPS = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] as const
+const LIGHT_GROUNDS = [100, 99.3, 98.2, 97, 95.5, 93.8]
+const DARK_GROUNDS = [11, 16.2, 19.5, 23.5, 27.5]
+const LIGHT_MARK_GROUNDS = [100, 99.3, 98.2]
+const DARK_MARK_GROUNDS = [11, 16.2]
+const LIGHT_SHADES: Record<RampStep, number> = { 1: 25, 2: 50, 3: 100, 4: 150, 5: 200, 6: 250, 7: 300, 8: 400, 9: 600, 10: 600, 11: 700, 12: 900 }
+const DARK_SHADES: Record<RampStep, number> = { 1: 950, 2: 950, 3: 950, 4: 900, 5: 900, 6: 800, 7: 800, 8: 700, 9: 600, 10: 400, 11: 300, 12: 100 }
+const DARK_SURFACES: Partial<Record<RampStep, { lightness: number, chromaShare: number }>> = {
+ 1: { lightness: 14, chromaShare: 0.35 },
+ 2: { lightness: 17, chromaShare: 0.5 },
+ 3: { lightness: 20.5, chromaShare: 0.6 },
+ 4: { lightness: 24, chromaShare: 0.65 },
+ 5: { lightness: 27.5, chromaShare: 0.7 },
+ 6: { lightness: 31, chromaShare: 0.72 },
+ 7: { lightness: 38, chromaShare: 0.75 },
+ 8: { lightness: 47, chromaShare: 0.8 },
+}
+const SCALE_ANCHORS: Record<RampScale, { family: ColorFamily, shade: number }> = {
+ accent: { family: 'violet', shade: 600 },
+ danger: { family: 'red', shade: 600 },
+ warning: { family: 'amber', shade: 500 },
+ success: { family: 'green', shade: 600 },
}
const STATUS_SCALES = ['danger', 'warning', 'success'] as const
+const COLOR_FAMILIES: Record<ColorFamily, FamilyShade[]> = {
+ red: [
+ { shade: 50, lightness: 97.1, chroma: 0.013, hue: 17.38 },
+ { shade: 100, lightness: 93.6, chroma: 0.032, hue: 17.717 },
+ { shade: 200, lightness: 88.5, chroma: 0.062, hue: 18.334 },
+ { shade: 300, lightness: 80.8, chroma: 0.114, hue: 19.571 },
+ { shade: 400, lightness: 70.4, chroma: 0.191, hue: 22.216 },
+ { shade: 500, lightness: 63.7, chroma: 0.237, hue: 25.331 },
+ { shade: 600, lightness: 57.7, chroma: 0.245, hue: 27.325 },
+ { shade: 700, lightness: 50.5, chroma: 0.213, hue: 27.518 },
+ { shade: 800, lightness: 44.4, chroma: 0.177, hue: 26.899 },
+ { shade: 900, lightness: 39.6, chroma: 0.141, hue: 25.723 },
+ { shade: 950, lightness: 25.8, chroma: 0.092, hue: 26.042 },
+ ],
+ orange: [
+ { shade: 50, lightness: 98.0, chroma: 0.016, hue: 73.684 },
+ { shade: 100, lightness: 95.4, chroma: 0.038, hue: 75.164 },
+ { shade: 200, lightness: 90.1, chroma: 0.076, hue: 70.697 },
+ { shade: 300, lightness: 83.7, chroma: 0.128, hue: 66.29 },
+ { shade: 400, lightness: 75.0, chroma: 0.183, hue: 55.934 },
+ { shade: 500, lightness: 70.5, chroma: 0.213, hue: 47.604 },
+ { shade: 600, lightness: 64.6, chroma: 0.222, hue: 41.116 },
+ { shade: 700, lightness: 55.3, chroma: 0.195, hue: 38.402 },
+ { shade: 800, lightness: 47.0, chroma: 0.157, hue: 37.304 },
+ { shade: 900, lightness: 40.8, chroma: 0.123, hue: 38.172 },
+ { shade: 950, lightness: 26.6, chroma: 0.079, hue: 36.259 },
+ ],
+ amber: [
+ { shade: 50, lightness: 98.7, chroma: 0.022, hue: 95.277 },
+ { shade: 100, lightness: 96.2, chroma: 0.059, hue: 95.617 },
+ { shade: 200, lightness: 92.4, chroma: 0.12, hue: 95.746 },
+ { shade: 300, lightness: 87.9, chroma: 0.169, hue: 91.605 },
+ { shade: 400, lightness: 82.8, chroma: 0.189, hue: 84.429 },
+ { shade: 500, lightness: 76.9, chroma: 0.188, hue: 70.08 },
+ { shade: 600, lightness: 66.6, chroma: 0.179, hue: 58.318 },
+ { shade: 700, lightness: 55.5, chroma: 0.163, hue: 48.998 },
+ { shade: 800, lightness: 47.3, chroma: 0.137, hue: 46.201 },
+ { shade: 900, lightness: 41.4, chroma: 0.112, hue: 45.904 },
+ { shade: 950, lightness: 27.9, chroma: 0.077, hue: 45.635 },
+ ],
+ yellow: [
+ { shade: 50, lightness: 98.7, chroma: 0.026, hue: 102.212 },
+ { shade: 100, lightness: 97.3, chroma: 0.071, hue: 103.193 },
+ { shade: 200, lightness: 94.5, chroma: 0.129, hue: 101.54 },
+ { shade: 300, lightness: 90.5, chroma: 0.182, hue: 98.111 },
+ { shade: 400, lightness: 85.2, chroma: 0.199, hue: 91.936 },
+ { shade: 500, lightness: 79.5, chroma: 0.184, hue: 86.047 },
+ { shade: 600, lightness: 68.1, chroma: 0.162, hue: 75.834 },
+ { shade: 700, lightness: 55.4, chroma: 0.135, hue: 66.442 },
+ { shade: 800, lightness: 47.6, chroma: 0.114, hue: 61.907 },
+ { shade: 900, lightness: 42.1, chroma: 0.095, hue: 57.708 },
+ { shade: 950, lightness: 28.6, chroma: 0.066, hue: 53.813 },
+ ],
+ lime: [
+ { shade: 50, lightness: 98.6, chroma: 0.031, hue: 120.757 },
+ { shade: 100, lightness: 96.7, chroma: 0.067, hue: 122.328 },
+ { shade: 200, lightness: 93.8, chroma: 0.127, hue: 124.321 },
+ { shade: 300, lightness: 89.7, chroma: 0.196, hue: 126.665 },
+ { shade: 400, lightness: 84.1, chroma: 0.238, hue: 128.85 },
+ { shade: 500, lightness: 76.8, chroma: 0.233, hue: 130.85 },
+ { shade: 600, lightness: 64.8, chroma: 0.2, hue: 131.684 },
+ { shade: 700, lightness: 53.2, chroma: 0.157, hue: 131.589 },
+ { shade: 800, lightness: 45.3, chroma: 0.124, hue: 130.933 },
+ { shade: 900, lightness: 40.5, chroma: 0.101, hue: 131.063 },
+ { shade: 950, lightness: 27.4, chroma: 0.072, hue: 132.109 },
+ ],
+ green: [
+ { shade: 50, lightness: 98.2, chroma: 0.018, hue: 155.826 },
+ { shade: 100, lightness: 96.2, chroma: 0.044, hue: 156.743 },
+ { shade: 200, lightness: 92.5, chroma: 0.084, hue: 155.995 },
+ { shade: 300, lightness: 87.1, chroma: 0.15, hue: 154.449 },
+ { shade: 400, lightness: 79.2, chroma: 0.209, hue: 151.711 },
+ { shade: 500, lightness: 72.3, chroma: 0.219, hue: 149.579 },
+ { shade: 600, lightness: 62.7, chroma: 0.194, hue: 149.214 },
+ { shade: 700, lightness: 52.7, chroma: 0.154, hue: 150.069 },
+ { shade: 800, lightness: 44.8, chroma: 0.119, hue: 151.328 },
+ { shade: 900, lightness: 39.3, chroma: 0.095, hue: 152.535 },
+ { shade: 950, lightness: 26.6, chroma: 0.065, hue: 152.934 },
+ ],
+ emerald: [
+ { shade: 50, lightness: 97.9, chroma: 0.021, hue: 166.113 },
+ { shade: 100, lightness: 95.0, chroma: 0.052, hue: 163.051 },
+ { shade: 200, lightness: 90.5, chroma: 0.093, hue: 164.15 },
+ { shade: 300, lightness: 84.5, chroma: 0.143, hue: 164.978 },
+ { shade: 400, lightness: 76.5, chroma: 0.177, hue: 163.223 },
+ { shade: 500, lightness: 69.6, chroma: 0.17, hue: 162.48 },
+ { shade: 600, lightness: 59.6, chroma: 0.145, hue: 163.225 },
+ { shade: 700, lightness: 50.8, chroma: 0.118, hue: 165.612 },
+ { shade: 800, lightness: 43.2, chroma: 0.095, hue: 166.913 },
+ { shade: 900, lightness: 37.8, chroma: 0.077, hue: 168.94 },
+ { shade: 950, lightness: 26.2, chroma: 0.051, hue: 172.552 },
+ ],
+ teal: [
+ { shade: 50, lightness: 98.4, chroma: 0.014, hue: 180.72 },
+ { shade: 100, lightness: 95.3, chroma: 0.051, hue: 180.801 },
+ { shade: 200, lightness: 91.0, chroma: 0.096, hue: 180.426 },
+ { shade: 300, lightness: 85.5, chroma: 0.138, hue: 181.071 },
+ { shade: 400, lightness: 77.7, chroma: 0.152, hue: 181.912 },
+ { shade: 500, lightness: 70.4, chroma: 0.14, hue: 182.503 },
+ { shade: 600, lightness: 60.0, chroma: 0.118, hue: 184.704 },
+ { shade: 700, lightness: 51.1, chroma: 0.096, hue: 186.391 },
+ { shade: 800, lightness: 43.7, chroma: 0.078, hue: 188.216 },
+ { shade: 900, lightness: 38.6, chroma: 0.063, hue: 188.416 },
+ { shade: 950, lightness: 27.7, chroma: 0.046, hue: 192.524 },
+ ],
+ cyan: [
+ { shade: 50, lightness: 98.4, chroma: 0.019, hue: 200.873 },
+ { shade: 100, lightness: 95.6, chroma: 0.045, hue: 203.388 },
+ { shade: 200, lightness: 91.7, chroma: 0.08, hue: 205.041 },
+ { shade: 300, lightness: 86.5, chroma: 0.127, hue: 207.078 },
+ { shade: 400, lightness: 78.9, chroma: 0.154, hue: 211.53 },
+ { shade: 500, lightness: 71.5, chroma: 0.143, hue: 215.221 },
+ { shade: 600, lightness: 60.9, chroma: 0.126, hue: 221.723 },
+ { shade: 700, lightness: 52.0, chroma: 0.105, hue: 223.128 },
+ { shade: 800, lightness: 45.0, chroma: 0.085, hue: 224.283 },
+ { shade: 900, lightness: 39.8, chroma: 0.07, hue: 227.392 },
+ { shade: 950, lightness: 30.2, chroma: 0.056, hue: 229.695 },
+ ],
+ sky: [
+ { shade: 50, lightness: 97.7, chroma: 0.013, hue: 236.62 },
+ { shade: 100, lightness: 95.1, chroma: 0.026, hue: 236.824 },
+ { shade: 200, lightness: 90.1, chroma: 0.058, hue: 230.902 },
+ { shade: 300, lightness: 82.8, chroma: 0.111, hue: 230.318 },
+ { shade: 400, lightness: 74.6, chroma: 0.16, hue: 232.661 },
+ { shade: 500, lightness: 68.5, chroma: 0.169, hue: 237.323 },
+ { shade: 600, lightness: 58.8, chroma: 0.158, hue: 241.966 },
+ { shade: 700, lightness: 50.0, chroma: 0.134, hue: 242.749 },
+ { shade: 800, lightness: 44.3, chroma: 0.11, hue: 240.79 },
+ { shade: 900, lightness: 39.1, chroma: 0.09, hue: 240.876 },
+ { shade: 950, lightness: 29.3, chroma: 0.066, hue: 243.157 },
+ ],
+ blue: [
+ { shade: 50, lightness: 97.0, chroma: 0.014, hue: 254.604 },
+ { shade: 100, lightness: 93.2, chroma: 0.032, hue: 255.585 },
+ { shade: 200, lightness: 88.2, chroma: 0.059, hue: 254.128 },
+ { shade: 300, lightness: 80.9, chroma: 0.105, hue: 251.813 },
+ { shade: 400, lightness: 70.7, chroma: 0.165, hue: 254.624 },
+ { shade: 500, lightness: 62.3, chroma: 0.214, hue: 259.815 },
+ { shade: 600, lightness: 54.6, chroma: 0.245, hue: 262.881 },
+ { shade: 700, lightness: 48.8, chroma: 0.243, hue: 264.376 },
+ { shade: 800, lightness: 42.4, chroma: 0.199, hue: 265.638 },
+ { shade: 900, lightness: 37.9, chroma: 0.146, hue: 265.522 },
+ { shade: 950, lightness: 28.2, chroma: 0.091, hue: 267.935 },
+ ],
+ indigo: [
+ { shade: 50, lightness: 96.2, chroma: 0.018, hue: 272.314 },
+ { shade: 100, lightness: 93.0, chroma: 0.034, hue: 272.788 },
+ { shade: 200, lightness: 87.0, chroma: 0.065, hue: 274.039 },
+ { shade: 300, lightness: 78.5, chroma: 0.115, hue: 274.713 },
+ { shade: 400, lightness: 67.3, chroma: 0.182, hue: 276.935 },
+ { shade: 500, lightness: 58.5, chroma: 0.233, hue: 277.117 },
+ { shade: 600, lightness: 51.1, chroma: 0.262, hue: 276.966 },
+ { shade: 700, lightness: 45.7, chroma: 0.24, hue: 277.023 },
+ { shade: 800, lightness: 39.8, chroma: 0.195, hue: 277.366 },
+ { shade: 900, lightness: 35.9, chroma: 0.144, hue: 278.697 },
+ { shade: 950, lightness: 25.7, chroma: 0.09, hue: 281.288 },
+ ],
+ violet: [
+ { shade: 50, lightness: 96.9, chroma: 0.016, hue: 293.756 },
+ { shade: 100, lightness: 94.3, chroma: 0.029, hue: 294.588 },
+ { shade: 200, lightness: 89.4, chroma: 0.057, hue: 293.283 },
+ { shade: 300, lightness: 81.1, chroma: 0.111, hue: 293.571 },
+ { shade: 400, lightness: 70.2, chroma: 0.183, hue: 293.541 },
+ { shade: 500, lightness: 60.6, chroma: 0.25, hue: 292.717 },
+ { shade: 600, lightness: 54.1, chroma: 0.281, hue: 293.009 },
+ { shade: 700, lightness: 49.1, chroma: 0.27, hue: 292.581 },
+ { shade: 800, lightness: 43.2, chroma: 0.232, hue: 292.759 },
+ { shade: 900, lightness: 38.0, chroma: 0.189, hue: 293.745 },
+ { shade: 950, lightness: 28.3, chroma: 0.141, hue: 291.089 },
+ ],
+ purple: [
+ { shade: 50, lightness: 97.7, chroma: 0.014, hue: 308.299 },
+ { shade: 100, lightness: 94.6, chroma: 0.033, hue: 307.174 },
+ { shade: 200, lightness: 90.2, chroma: 0.063, hue: 306.703 },
+ { shade: 300, lightness: 82.7, chroma: 0.119, hue: 306.383 },
+ { shade: 400, lightness: 71.4, chroma: 0.203, hue: 305.504 },
+ { shade: 500, lightness: 62.7, chroma: 0.265, hue: 303.9 },
+ { shade: 600, lightness: 55.8, chroma: 0.288, hue: 302.321 },
+ { shade: 700, lightness: 49.6, chroma: 0.265, hue: 301.924 },
+ { shade: 800, lightness: 43.8, chroma: 0.218, hue: 303.724 },
+ { shade: 900, lightness: 38.1, chroma: 0.176, hue: 304.987 },
+ { shade: 950, lightness: 29.1, chroma: 0.149, hue: 302.717 },
+ ],
+ fuchsia: [
+ { shade: 50, lightness: 97.7, chroma: 0.017, hue: 320.058 },
+ { shade: 100, lightness: 95.2, chroma: 0.037, hue: 318.852 },
+ { shade: 200, lightness: 90.3, chroma: 0.076, hue: 319.62 },
+ { shade: 300, lightness: 83.3, chroma: 0.145, hue: 321.434 },
+ { shade: 400, lightness: 74.0, chroma: 0.238, hue: 322.16 },
+ { shade: 500, lightness: 66.7, chroma: 0.295, hue: 322.15 },
+ { shade: 600, lightness: 59.1, chroma: 0.293, hue: 322.896 },
+ { shade: 700, lightness: 51.8, chroma: 0.253, hue: 323.949 },
+ { shade: 800, lightness: 45.2, chroma: 0.211, hue: 324.591 },
+ { shade: 900, lightness: 40.1, chroma: 0.17, hue: 325.612 },
+ { shade: 950, lightness: 29.3, chroma: 0.136, hue: 325.661 },
+ ],
+ pink: [
+ { shade: 50, lightness: 97.1, chroma: 0.014, hue: 343.198 },
+ { shade: 100, lightness: 94.8, chroma: 0.028, hue: 342.258 },
+ { shade: 200, lightness: 89.9, chroma: 0.061, hue: 343.231 },
+ { shade: 300, lightness: 82.3, chroma: 0.12, hue: 346.018 },
+ { shade: 400, lightness: 71.8, chroma: 0.202, hue: 349.761 },
+ { shade: 500, lightness: 65.6, chroma: 0.241, hue: 354.308 },
+ { shade: 600, lightness: 59.2, chroma: 0.249, hue: 0.584 },
+ { shade: 700, lightness: 52.5, chroma: 0.223, hue: 3.958 },
+ { shade: 800, lightness: 45.9, chroma: 0.187, hue: 3.815 },
+ { shade: 900, lightness: 40.8, chroma: 0.153, hue: 2.432 },
+ { shade: 950, lightness: 28.4, chroma: 0.109, hue: 3.907 },
+ ],
+ rose: [
+ { shade: 50, lightness: 96.9, chroma: 0.015, hue: 12.422 },
+ { shade: 100, lightness: 94.1, chroma: 0.03, hue: 12.58 },
+ { shade: 200, lightness: 89.2, chroma: 0.058, hue: 10.001 },
+ { shade: 300, lightness: 81.0, chroma: 0.117, hue: 11.638 },
+ { shade: 400, lightness: 71.2, chroma: 0.194, hue: 13.428 },
+ { shade: 500, lightness: 64.5, chroma: 0.246, hue: 16.439 },
+ { shade: 600, lightness: 58.6, chroma: 0.253, hue: 17.585 },
+ { shade: 700, lightness: 51.4, chroma: 0.222, hue: 16.935 },
+ { shade: 800, lightness: 45.5, chroma: 0.188, hue: 13.697 },
+ { shade: 900, lightness: 41.0, chroma: 0.159, hue: 10.272 },
+ { shade: 950, lightness: 27.1, chroma: 0.105, hue: 12.094 },
+ ],
+}
+
+const SWATCH_FAMILIES: ColorFamily[] = ['purple', 'fuchsia', 'pink', 'red', 'orange', 'yellow', 'lime', 'green', 'emerald', 'cyan', 'blue', 'indigo']
+const LIGHT_SWATCH_MARKS: SwatchCandidate[] = [
+ { shade: 500, chromaShare: 1 },
+ { shade: 600, chromaShare: 1 },
+ { shade: 700, chromaShare: 1 },
+]
+const DARK_SWATCH_MARKS: SwatchCandidate[] = [
+ { shade: 500, chromaShare: 0.85 },
+ { shade: 400, chromaShare: 0.85 },
+ { shade: 300, chromaShare: 0.85 },
+]
+
+const COLOR_FAMILY_NAMES: ColorFamily[] = ['red', 'orange', 'amber', 'yellow', 'lime', 'green', 'emerald', 'teal', 'cyan', 'sky', 'blue', 'indigo', 'violet', 'purple', 'fuchsia', 'pink', 'rose']
+
function clamp({ value, min, max }: { value: number, min: number, max: number }): number {
return Math.min(max, Math.max(min, value))
}
@@ -111,27 +367,11 @@ function cssVariables({
}: {
primaryColor: string
}): Record<string, string> {
- const parsed = parseHex(primaryColor)
- if (parsed === null) {
- return {
- '--brand-h': String(DEFAULT_BRAND_HUE),
- '--brand-c': '1',
- '--accent-9': DEFAULT_ACCENT_SOLID,
- '--on-accent': onPrimaryFor({ hex: DEFAULT_ACCENT_SOLID }),
- }
- }
-
- const solid = withHash({ hex: primaryColor })
- const { hue, chromaScale } = scaleSeed({
- srgb: parsed,
- fallbackHue: DEFAULT_BRAND_HUE,
- referenceChroma: REFERENCE_CHROMA,
- })
+ const solid = parseHex(primaryColor) === null ? DEFAULT_ACCENT_SOLID : withHash({ hex: primaryColor })
+ const generated = ramp({ hex: solid, scale: 'accent' })
return {
- '--brand-h': String(hue),
- '--brand-c': String(chromaScale),
- '--accent-9': solid,
- '--on-accent': onPrimaryFor({ hex: solid }),
+ ...rampVariables({ scale: 'accent', generated }),
+ '--on-accent': generated.onSolid,
}
}
@@ -143,29 +383,25 @@ function statusCssVariables({
return Object.fromEntries(
STATUS_SCALES.flatMap((scale) => {
const hex = statusColors[scale]
- const parsed = hex === undefined ? null : parseHex(hex)
- if (hex === undefined || parsed === null) {
+ if (hex === undefined || parseHex(hex) === null) {
return []
}
- const solid = withHash({ hex })
- const { hue, chromaScale } = scaleSeed({
- srgb: parsed,
- fallbackHue: STATUS_SCALE_DEFAULTS[scale].hue,
- referenceChroma: STATUS_SCALE_DEFAULTS[scale].referenceChroma,
- })
- const [hueName, chromaName, solidName, onSolidName] = statusVariableNamesFor({ scale })
+ const generated = ramp({ hex: withHash({ hex }), scale })
return [
- [hueName, String(hue)],
- [chromaName, String(chromaScale)],
- [solidName, solid],
- [onSolidName, onPrimaryFor({ hex: solid })],
+ ...Object.entries(rampVariables({ scale, generated })),
+ [`--on-${scale}-seed`, generated.onSolid],
]
}),
)
}
-function statusVariableNames(): string[] {
- return STATUS_SCALES.flatMap((scale) => statusVariableNamesFor({ scale }))
+function variableNames(): string[] {
+ const scales: RampScale[] = ['accent', ...STATUS_SCALES]
+ return [
+ ...scales.flatMap((scale) => STEPS.flatMap((step) => [`--${scale}-light-${step}`, `--${scale}-dark-${step}`])),
+ '--on-accent',
+ ...STATUS_SCALES.map((scale) => `--on-${scale}-seed`),
+ ]
}
function defaultPrimaryColor(): string {
@@ -173,46 +409,258 @@ function defaultPrimaryColor(): string {
}
function defaultStatusColor({ scale }: { scale: StatusScale }): string {
- return STATUS_SCALE_DEFAULTS[scale].solid
+ return anchorHex({ scale })
}
-function statusVariableNamesFor({ scale }: { scale: StatusScale }): [string, string, string, string] {
- return [`--${scale}-h`, `--${scale}-c`, `--${scale}-seed`, `--on-${scale}-seed`]
+function defaultRamp({ scale }: { scale: RampScale }): Ramp {
+ return ramp({ hex: scale === 'accent' ? DEFAULT_ACCENT_SOLID : anchorHex({ scale }), scale })
}
-function scaleSeed({
- srgb,
- fallbackHue,
- referenceChroma,
+function ramp({ hex, scale }: { hex: string, scale: RampScale }): Ramp {
+ const parsed = parseHex(hex) ?? parseHex(DEFAULT_ACCENT_SOLID)
+ const seed = srgbToOklchFull(parsed ?? { r: 0, g: 0, b: 0 })
+ const achromatic = seed.chroma < ACHROMATIC_CHROMA
+ return familyRamp({
+ hex,
+ family: achromatic ? SCALE_ANCHORS[scale].family : nearestFamily({ hue: seed.hue }),
+ anchorShade: SCALE_ANCHORS[scale].shade,
+ exact: scale !== 'accent' && hex.toLowerCase() === anchorHex({ scale }),
+ })
+}
+
+function familyRamp({
+ hex,
+ family,
+ anchorShade,
+ exact,
}: {
- srgb: Srgb
- fallbackHue: number
- referenceChroma: number
-}): { hue: number, chromaScale: number } {
- const { chroma, hue } = srgbToOklch(srgb)
- if (chroma < ACHROMATIC_CHROMA) {
- return { hue: fallbackHue, chromaScale: 0 }
+ hex: string
+ family: ColorFamily
+ anchorShade: number
+ exact: boolean
+}): Ramp {
+ const seed = srgbToOklchFull(parseHex(hex) ?? { r: 0, g: 0, b: 0 })
+ const achromatic = seed.chroma < ACHROMATIC_CHROMA
+ const anchor = shadeOf({ family, shade: anchorShade })
+ const isAnchor = exact
+ const chromaRatio = isAnchor ? 1 : achromatic ? 0 : clamp({ value: seed.chroma / anchor.chroma, min: 0, max: MAX_CHROMA_RATIO })
+ const hueShift = isAnchor || achromatic ? 0 : seed.hue - anchor.hue
+ const build = ({ shades, theme }: { shades: Record<RampStep, number>, theme: RampTheme }): Record<RampStep, string> => {
+ const base = byStep((step) => {
+ const shade = shadeOf({ family, shade: shades[step] })
+ const surface = theme === 'dark' ? DARK_SURFACES[step] : undefined
+ return {
+ lightness: surface?.lightness ?? shade.lightness,
+ chroma: shade.chroma * chromaRatio * (surface?.chromaShare ?? 1),
+ hue: normaliseHue({ hue: shade.hue + hueShift }),
+ }
+ })
+ const tint = base[3]
+ const text = readable({ color: base[11], grounds: [...groundsFor({ theme }), tint], minimum: TEXT_CONTRAST, theme })
+ const mark = readable({ color: base[10], grounds: markGroundsFor({ theme }), minimum: MARK_CONTRAST, theme })
+ return byStep((step) => {
+ if (step === 9) {
+ return hex
+ }
+ return formatOklch({ color: step === 11 ? text : step === 10 ? mark : base[step] })
+ })
}
return {
- hue: round({ value: hue, places: 2 }),
- chromaScale: round({
- value: clamp({
- value: chroma / referenceChroma,
- min: MIN_CHROMA_SCALE,
- max: MAX_CHROMA_SCALE,
- }),
- places: 4,
- }),
+ light: build({ shades: LIGHT_SHADES, theme: 'light' }),
+ dark: build({ shades: DARK_SHADES, theme: 'dark' }),
+ onSolid: onPrimaryFor({ hex }),
+ }
+}
+
+function byStep<T>(make: (step: RampStep) => T): Record<RampStep, T> {
+ return {
+ 1: make(1), 2: make(2), 3: make(3), 4: make(4), 5: make(5), 6: make(6),
+ 7: make(7), 8: make(8), 9: make(9), 10: make(10), 11: make(11), 12: make(12),
+ }
+}
+
+function swatches(): Swatch[] {
+ return SWATCH_FAMILIES.map((family) => {
+ const generated = familyRamp({ hex: oklchToHex({ color: shadeOf({ family, shade: 500 }) }), family, anchorShade: 500, exact: true })
+ const deepest = shadeOf({ family, shade: 950 })
+ return {
+ light: {
+ ...swatchMark({ family, candidates: LIGHT_SWATCH_MARKS, deepest }),
+ surface: generated.light[3],
+ line: generated.light[5],
+ ink: generated.light[11],
+ },
+ dark: {
+ ...swatchMark({ family, candidates: DARK_SWATCH_MARKS, deepest }),
+ surface: generated.dark[3],
+ line: generated.dark[7],
+ ink: generated.dark[11],
+ },
+ }
+ })
+}
+
+function swatchMark({
+ family,
+ candidates,
+ deepest,
+}: {
+ family: ColorFamily
+ candidates: SwatchCandidate[]
+ deepest: OklchColor
+}): { mark: string, on: string } {
+ const white: OklchColor = { lightness: 100, chroma: 0, hue: 0 }
+ const options = candidates.map((candidate) => {
+ const shade = shadeOf({ family, shade: candidate.shade })
+ const mark = { ...shade, chroma: shade.chroma * candidate.chromaShare }
+ const label = luminanceContrast({ first: white, second: mark }) >= luminanceContrast({ first: deepest, second: mark }) ? white : deepest
+ return { mark, label, contrast: luminanceContrast({ first: label, second: mark }) }
+ })
+ const chosen = options.find((option) => option.contrast >= TEXT_CONTRAST) ?? options[options.length - 1]
+ return {
+ mark: formatOklch({ color: chosen.mark }),
+ on: chosen.label === white ? WHITE : formatOklch({ color: chosen.label }),
+ }
+}
+
+function rampVariables({ scale, generated }: { scale: RampScale, generated: Ramp }): Record<string, string> {
+ return Object.fromEntries(
+ STEPS.flatMap((step) => [
+ [`--${scale}-light-${step}`, generated.light[step]],
+ [`--${scale}-dark-${step}`, generated.dark[step]],
+ ]),
+ )
+}
+
+function readable({
+ color,
+ grounds,
+ minimum,
+ theme,
+}: {
+ color: OklchColor
+ grounds: OklchColor[]
+ minimum: number
+ theme: RampTheme
+}): OklchColor {
+ const direction = theme === 'light' ? -LIGHTNESS_STEP : LIGHTNESS_STEP
+ const passes = (candidate: OklchColor): boolean =>
+ grounds.every((ground) => luminanceContrast({ first: candidate, second: ground }) >= minimum)
+ const attempt = (candidate: OklchColor): OklchColor =>
+ passes(candidate) || candidate.lightness <= 0 || candidate.lightness >= 100
+ ? candidate
+ : attempt({ ...candidate, lightness: candidate.lightness + direction })
+ return attempt(color)
+}
+
+function groundsFor({ theme }: { theme: RampTheme }): OklchColor[] {
+ return (theme === 'light' ? LIGHT_GROUNDS : DARK_GROUNDS).map((lightness) => ({ lightness, chroma: 0, hue: 0 }))
+}
+
+function markGroundsFor({ theme }: { theme: RampTheme }): OklchColor[] {
+ return (theme === 'light' ? LIGHT_MARK_GROUNDS : DARK_MARK_GROUNDS).map((lightness) => ({ lightness, chroma: 0, hue: 0 }))
+}
+
+function nearestFamily({ hue }: { hue: number }): ColorFamily {
+ return COLOR_FAMILY_NAMES.reduce<ColorFamily>((best, family) =>
+ hueDistance({ first: shadeOf({ family, shade: 500 }).hue, second: hue }) <
+ hueDistance({ first: shadeOf({ family: best, shade: 500 }).hue, second: hue })
+ ? family
+ : best,
+ COLOR_FAMILY_NAMES[0])
+}
+
+function shadeOf({ family, shade }: { family: ColorFamily, shade: number }): OklchColor {
+ const shades: FamilyShade[] = [
+ { shade: 0, lightness: 100, chroma: 0, hue: COLOR_FAMILIES[family][0].hue },
+ ...COLOR_FAMILIES[family],
+ ]
+ const exact = shades.find((entry) => entry.shade === shade)
+ if (exact) {
+ return { lightness: exact.lightness, chroma: exact.chroma, hue: exact.hue }
+ }
+ const upper = shades.find((entry) => entry.shade > shade) ?? shades[shades.length - 1]
+ const lower = [...shades].reverse().find((entry) => entry.shade < shade) ?? shades[0]
+ const progress = (shade - lower.shade) / (upper.shade - lower.shade)
+ const nearer = progress < 0.5 ? lower : upper
+ return {
+ lightness: lower.lightness + (upper.lightness - lower.lightness) * progress,
+ chroma: lower.chroma + (upper.chroma - lower.chroma) * progress,
+ hue: nearer.chroma === 0 ? (progress < 0.5 ? upper.hue : lower.hue) : nearer.hue,
+ }
+}
+
+function anchorHex({ scale }: { scale: RampScale }): string {
+ return oklchToHex({ color: shadeOf(SCALE_ANCHORS[scale]) })
+}
+
+function hueDistance({ first, second }: { first: number, second: number }): number {
+ const difference = Math.abs(first - second) % 360
+ return difference > 180 ? 360 - difference : difference
+}
+
+function normaliseHue({ hue }: { hue: number }): number {
+ return ((hue % 360) + 360) % 360
+}
+
+function formatOklch({ color }: { color: OklchColor }): string {
+ return `oklch(${round({ value: color.lightness, places: 2 })}% ${round({ value: color.chroma, places: 4 })} ${round({ value: color.hue, places: 2 })})`
+}
+
+function oklchToLinear({ color }: { color: OklchColor }): Srgb {
+ const lightness = color.lightness / 100
+ const a = color.chroma * Math.cos((color.hue * Math.PI) / 180)
+ const b = color.chroma * Math.sin((color.hue * Math.PI) / 180)
+ const l = Math.pow(lightness + 0.3963377774 * a + 0.2158037573 * b, 3)
+ const m = Math.pow(lightness - 0.1055613458 * a - 0.0638541728 * b, 3)
+ const s = Math.pow(lightness - 0.0894841775 * a - 1.291485548 * b, 3)
+ return {
+ r: clamp({ value: 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s, min: 0, max: 1 }),
+ g: clamp({ value: -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s, min: 0, max: 1 }),
+ b: clamp({ value: -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s, min: 0, max: 1 }),
+ }
+}
+
+function luminanceContrast({ first, second }: { first: OklchColor, second: OklchColor }): number {
+ const luminance = (color: OklchColor): number => {
+ const { r, g, b } = oklchToLinear({ color })
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b
+ }
+ const [lighter, darker] = [luminance(first), luminance(second)].sort((x, y) => y - x)
+ return (lighter + 0.05) / (darker + 0.05)
+}
+
+function oklchToHex({ color }: { color: OklchColor }): string {
+ const { r, g, b } = oklchToLinear({ color })
+ const encode = (channel: number): string => {
+ const value = channel <= 0.0031308 ? 12.92 * channel : 1.055 * Math.pow(channel, 1 / 2.4) - 0.055
+ return Math.round(clamp({ value, min: 0, max: 1 }) * 255).toString(16).padStart(2, '0')
}
+ return `#${encode(r)}${encode(g)}${encode(b)}`
+}
+
+function srgbToOklchFull(srgb: Srgb): OklchColor {
+ const lr = toLinear(srgb.r)
+ const lg = toLinear(srgb.g)
+ const lb = toLinear(srgb.b)
+ const l = Math.cbrt(0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb)
+ const m = Math.cbrt(0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb)
+ const s = Math.cbrt(0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb)
+ const { chroma, hue } = srgbToOklch(srgb)
+ return { lightness: (0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s) * 100, chroma, hue }
}
export const brandColors = {
statusScales: STATUS_SCALES,
+ steps: STEPS,
cssVariables,
statusCssVariables,
- statusVariableNames,
+ variableNames,
defaultPrimaryColor,
defaultStatusColor,
+ defaultRamp,
+ ramp,
+ swatches,
contrastRatio,
onPrimaryFor,
}
@@ -231,3 +679,48 @@ type Oklch = {
chroma: number
hue: number
}
+
+type OklchColor = {
+ lightness: number
+ chroma: number
+ hue: number
+}
+
+type RampScale = 'accent' | StatusScale
+
+type RampTheme = 'light' | 'dark'
+
+type RampStep = (typeof STEPS)[number]
+
+type Ramp = {
+ light: Record<RampStep, string>
+ dark: Record<RampStep, string>
+ onSolid: string
+}
+
+type ColorFamily = 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'emerald' | 'teal' | 'cyan' | 'sky' | 'blue' | 'indigo' | 'violet' | 'purple' | 'fuchsia' | 'pink' | 'rose'
+
+type FamilyShade = {
+ shade: number
+ lightness: number
+ chroma: number
+ hue: number
+}
+
+type SwatchCandidate = {
+ shade: number
+ chromaShare: number
+}
+
+type SwatchRoles = {
+ mark: string
+ on: string
+ surface: string
+ line: string
+ ink: string
+}
+
+type Swatch = {
+ light: SwatchRoles
+ dark: SwatchRoles
+}
diff --git a/packages/core/shared/test/common/brand-colors.test.ts b/packages/core/shared/test/common/brand-colors.test.ts
index 1e35f24ca70..2d236ef3430 100644
--- a/packages/core/shared/test/common/brand-colors.test.ts
+++ b/packages/core/shared/test/common/brand-colors.test.ts
@@ -1,31 +1,36 @@
import { brandColors } from '../../src/lib/core/common/brand-colors'
+const LIGHT_GROUNDS = [100, 99.3, 98.2, 97, 95.5, 93.8]
+const DARK_GROUNDS = [11, 16.2, 19.5, 23.5, 27.5]
+
describe('brandColors.cssVariables', () => {
- it('writes exactly the four seed properties', () => {
+ it('writes a light and a dark value for every accent step, plus the label', () => {
const variables = brandColors.cssVariables({ primaryColor: '#6e41e2' })
- expect(Object.keys(variables).sort()).toEqual(['--accent-9', '--brand-c', '--brand-h', '--on-accent'])
+ expect(Object.keys(variables)).toHaveLength(25)
+ expect(variables['--on-accent']).toBe('#ffffff')
+ brandColors.steps.forEach((step) => {
+ expect(variables[`--accent-light-${step}`]).toBeDefined()
+ expect(variables[`--accent-dark-${step}`]).toBeDefined()
+ })
})
- it('renders the tenant hex verbatim as --accent-9', () => {
- expect(brandColors.cssVariables({ primaryColor: '#FF6600' })['--accent-9']).toBe('#FF6600')
+ it('renders the tenant hex verbatim as step 9 in both themes', () => {
+ const variables = brandColors.cssVariables({ primaryColor: '#FF6600' })
+ expect(variables['--accent-light-9']).toBe('#FF6600')
+ expect(variables['--accent-dark-9']).toBe('#FF6600')
})
it('follows the tenant hue', () => {
const orange = brandColors.cssVariables({ primaryColor: '#FF6600' })
const violet = brandColors.cssVariables({ primaryColor: '#6e41e2' })
- expect(orange['--brand-h']).not.toBe(violet['--brand-h'])
+ expect(hueOf({ value: orange['--accent-light-3'] })).not.toBeCloseTo(hueOf({ value: violet['--accent-light-3'] }), 0)
})
- it('keeps the chroma scale of a coloured brand between 0.4 and 1', () => {
- const muted = brandColors.cssVariables({ primaryColor: '#1f2937' })
- const vivid = brandColors.cssVariables({ primaryColor: '#ff00ff' })
- expect(Number(muted['--brand-c'])).toBe(0.4)
- expect(Number(vivid['--brand-c'])).toBeLessThanOrEqual(1)
- })
-
- it('drops all chroma for a black, grey or white brand', () => {
+ it('renders a black, grey or white brand as a neutral ramp', () => {
['#000000', '#333333', '#808080', '#ffffff'].forEach((primaryColor) => {
- expect(brandColors.cssVariables({ primaryColor })['--brand-c']).toBe('0')
+ const variables = brandColors.cssVariables({ primaryColor })
+ expect(chromaOf({ value: variables['--accent-light-3'] })).toBe(0)
+ expect(chromaOf({ value: variables['--accent-dark-11'] })).toBe(0)
})
})
@@ -34,25 +39,14 @@ describe('brandColors.cssVariables', () => {
expect(brandColors.cssVariables({ primaryColor: '#6e41e2' })['--on-accent']).toBe('#ffffff')
})
- it('falls back to the default seed for an unparseable colour', () => {
- expect(brandColors.cssVariables({ primaryColor: 'not-a-colour' })).toEqual({
- '--brand-h': '288.86',
- '--brand-c': '1',
- '--accent-9': '#6e41e2',
- '--on-accent': '#ffffff',
- })
+ it('falls back to the default brand for an unparseable colour', () => {
+ expect(brandColors.cssVariables({ primaryColor: 'not-a-colour' })).toEqual(
+ brandColors.cssVariables({ primaryColor: brandColors.defaultPrimaryColor() }),
+ )
})
it('writes a hex given without its hash as valid css', () => {
- expect(brandColors.cssVariables({ primaryColor: 'ff6600' })['--accent-9']).toBe('#ff6600')
- })
-
- it('reads shorthand hex the same as its long form', () => {
- const short = brandColors.cssVariables({ primaryColor: '#f60' })
- const long = brandColors.cssVariables({ primaryColor: '#ff6600' })
- expect(short['--brand-h']).toBe(long['--brand-h'])
- expect(short['--brand-c']).toBe(long['--brand-c'])
- expect(short['--accent-9']).toBe('#f60')
+ expect(brandColors.cssVariables({ primaryColor: 'ff6600' })['--accent-light-9']).toBe('#ff6600')
})
})
@@ -61,69 +55,100 @@ describe('brandColors.statusCssVariables', () => {
expect(brandColors.statusCssVariables({ statusColors: {} })).toEqual({})
})
- it('writes exactly the four seed properties of each chosen scale', () => {
+ it('writes both themes of every step and the label for each chosen scale only', () => {
const variables = brandColors.statusCssVariables({ statusColors: { danger: '#b91c1c', success: '#16a34a' } })
- expect(Object.keys(variables).sort()).toEqual([
- '--danger-c',
- '--danger-h',
- '--danger-seed',
- '--on-danger-seed',
- '--on-success-seed',
- '--success-c',
- '--success-h',
- '--success-seed',
- ])
+ expect(Object.keys(variables)).toHaveLength(50)
+ expect(variables['--on-danger-seed']).toBeDefined()
+ expect(variables['--warning-light-3']).toBeUndefined()
})
it('renders the chosen hex verbatim as the solid', () => {
- expect(brandColors.statusCssVariables({ statusColors: { warning: '#FACC15' } })['--warning-seed']).toBe('#FACC15')
+ expect(brandColors.statusCssVariables({ statusColors: { warning: '#FACC15' } })['--warning-light-9']).toBe('#FACC15')
})
- it('follows the chosen hue', () => {
- const pink = brandColors.statusCssVariables({ statusColors: { danger: '#db2777' } })
- const red = brandColors.statusCssVariables({ statusColors: { danger: '#dc2626' } })
- expect(pink['--danger-h']).not.toBe(red['--danger-h'])
+ it('measures the label colour against the chosen solid', () => {
+ expect(brandColors.statusCssVariables({ statusColors: { warning: '#facc15' } })['--on-warning-seed']).toBe('#000000')
+ expect(brandColors.statusCssVariables({ statusColors: { danger: '#991b1b' } })['--on-danger-seed']).toBe('#ffffff')
})
- it('keeps the stock scale for its own default solid', () => {
- brandColors.statusScales.forEach((scale) => {
- const variables = brandColors.statusCssVariables({
- statusColors: { [scale]: brandColors.defaultStatusColor({ scale }) },
- })
- expect(Number(variables[`--${scale}-c`])).toBeCloseTo(1, 1)
- })
+ it('ignores an unparseable colour instead of writing a broken ramp', () => {
+ expect(brandColors.statusCssVariables({ statusColors: { danger: 'not-a-colour' } })).toEqual({})
})
+})
- it('drops all chroma for a grey status colour and keeps the stock hue', () => {
- const variables = brandColors.statusCssVariables({ statusColors: { success: '#808080' } })
- expect(variables['--success-c']).toBe('0')
- expect(variables['--success-h']).toBe('150')
+describe('brandColors.variableNames', () => {
+ it('names every property the two writers can set', () => {
+ const everything = {
+ ...brandColors.cssVariables({ primaryColor: '#0ea5e9' }),
+ ...brandColors.statusCssVariables({ statusColors: { danger: '#b91c1c', warning: '#facc15', success: '#16a34a' } }),
+ }
+ expect(brandColors.variableNames().sort()).toEqual(Object.keys(everything).sort())
})
+})
- it('measures the label colour against the chosen solid', () => {
- expect(brandColors.statusCssVariables({ statusColors: { warning: '#facc15' } })['--on-warning-seed']).toBe('#000000')
- expect(brandColors.statusCssVariables({ statusColors: { danger: '#991b1b' } })['--on-danger-seed']).toBe('#ffffff')
+describe('brandColors.defaultRamp', () => {
+ it('keeps the stock status steps', () => {
+ expect(brandColors.defaultRamp({ scale: 'danger' }).light[11]).toBe('oklch(50.5% 0.213 27.52)')
+ expect(brandColors.defaultRamp({ scale: 'warning' }).light[3]).toBe('oklch(96.2% 0.059 95.62)')
+ expect(brandColors.defaultRamp({ scale: 'success' }).light[7]).toBe('oklch(87.1% 0.15 154.45)')
})
- it('ignores an unparseable colour instead of writing a broken seed', () => {
- expect(brandColors.statusCssVariables({ statusColors: { danger: 'not-a-colour' } })).toEqual({})
+ it('uses the default solids as step 9', () => {
+ brandColors.statusScales.forEach((scale) => {
+ expect(brandColors.defaultRamp({ scale }).light[9]).toBe(brandColors.defaultStatusColor({ scale }))
+ })
+ expect(brandColors.defaultRamp({ scale: 'accent' }).light[9]).toBe(brandColors.defaultPrimaryColor())
})
})
-describe('brandColors.defaultPrimaryColor', () => {
- it('is the solid an unparseable primary colour falls back to', () => {
- expect(brandColors.defaultPrimaryColor()).toBe(
- brandColors.cssVariables({ primaryColor: 'not-a-colour' })['--accent-9'],
+describe('brandColors.ramp contrast', () => {
+ const seeds = Array.from({ length: 36 }, (_, index) => index * 10).flatMap((hue) =>
+ [0.06, 0.12, 0.2].flatMap((chroma) => [45, 60, 75, 90].map((lightness) => hexOf({ lightness, chroma, hue }))),
+ )
+ const scales = ['accent', ...brandColors.statusScales] as const
+
+ it('keeps step 11 readable on every ground and on its own tint, in both themes, for any seed', () => {
+ const failures = scales.flatMap((scale) =>
+ seeds.flatMap((hex) => {
+ const ramp = brandColors.ramp({ hex, scale })
+ const light = [...LIGHT_GROUNDS.map(neutral), ramp.light[3]].filter((ground) => contrast({ first: ramp.light[11], second: ground }) < 4.5)
+ const dark = [...DARK_GROUNDS.map(neutral), ramp.dark[3]].filter((ground) => contrast({ first: ramp.dark[11], second: ground }) < 4.5)
+ return [...light, ...dark].map((ground) => `${scale} ${hex} on ${ground}`)
+ }),
+ )
+ expect(failures).toEqual([])
+ })
+
+ it('keeps step 10 at 3:1 on the page in both themes, even for a pale seed', () => {
+ const failures = scales.flatMap((scale) =>
+ [...seeds, '#fde2e2', '#fffbe6', '#ffffff'].flatMap((hex) => {
+ const ramp = brandColors.ramp({ hex, scale })
+ const light = [100, 99.3, 98.2].map(neutral).filter((ground) => contrast({ first: ramp.light[10], second: ground }) < 3)
+ const dark = [11, 16.2].map(neutral).filter((ground) => contrast({ first: ramp.dark[10], second: ground }) < 3)
+ return [...light, ...dark].map((ground) => `${scale} ${hex} on ${ground}`)
+ }),
)
+ expect(failures).toEqual([])
})
})
-describe('brandColors.statusVariableNames', () => {
- it('names every property statusCssVariables can write', () => {
- const everything = brandColors.statusCssVariables({
- statusColors: { danger: '#b91c1c', warning: '#facc15', success: '#16a34a' },
- })
- expect(brandColors.statusVariableNames().sort()).toEqual(Object.keys(everything).sort())
+describe('brandColors.swatches', () => {
+ it('gives every chip a label that reads at 4.5:1 on its mark, in both themes', () => {
+ const failures = brandColors.swatches().flatMap((swatch, index) =>
+ (['light', 'dark'] as const)
+ .filter((theme) => contrast({ first: swatch[theme].on, second: swatch[theme].mark }) < 4.5)
+ .map((theme) => `swatch ${index + 1} ${theme}`),
+ )
+ expect(failures).toEqual([])
+ })
+
+ it('keeps swatch text readable on its own tint, in both themes', () => {
+ const failures = brandColors.swatches().flatMap((swatch, index) =>
+ (['light', 'dark'] as const)
+ .filter((theme) => contrast({ first: swatch[theme].ink, second: swatch[theme].surface }) < 4.5)
+ .map((theme) => `swatch ${index + 1} ${theme}`),
+ )
+ expect(failures).toEqual([])
})
})
@@ -135,10 +160,6 @@ describe('brandColors.onPrimaryFor', () => {
it('picks black on a bright yellow, where white measures 1.9:1', () => {
expect(brandColors.onPrimaryFor({ hex: '#eab308' })).toBe('#000000')
})
-
- it('picks black on the sky blue that fails AA under white', () => {
- expect(brandColors.onPrimaryFor({ hex: '#0ea5e9' })).toBe('#000000')
- })
})
describe('brandColors.contrastRatio', () => {
@@ -146,11 +167,78 @@ describe('brandColors.contrastRatio', () => {
expect(brandColors.contrastRatio({ foreground: '#000000', background: '#ffffff' })).toBeCloseTo(21, 1)
})
- it('measures a colour against itself at 1:1', () => {
- expect(brandColors.contrastRatio({ foreground: '#6e41e2', background: '#6e41e2' })).toBeCloseTo(1, 5)
- })
-
it('reproduces the 5.97:1 that white on the default purple measures', () => {
expect(brandColors.contrastRatio({ foreground: '#ffffff', background: '#6e41e2' })).toBeCloseTo(5.97, 1)
})
})
+
+function neutral(lightness: number): string {
+ return `oklch(${lightness}% 0 0)`
+}
+
+function parse({ value }: { value: string }): { lightness: number, chroma: number, hue: number } {
+ if (value.startsWith('#')) {
+ const linear = [1, 3, 5].map((offset) => {
+ const channel = parseInt(value.slice(offset, offset + 2), 16) / 255
+ return channel <= 0.04045 ? channel / 12.92 : Math.pow((channel + 0.055) / 1.055, 2.4)
+ })
+ const l = Math.cbrt(0.4122214708 * linear[0] + 0.5363325363 * linear[1] + 0.0514459929 * linear[2])
+ const m = Math.cbrt(0.2119034982 * linear[0] + 0.6806995451 * linear[1] + 0.1073969566 * linear[2])
+ const s = Math.cbrt(0.0883024619 * linear[0] + 0.2817188376 * linear[1] + 0.6299787005 * linear[2])
+ return { lightness: (0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s) * 100, chroma: 0, hue: 0 }
+ }
+ const match = value.match(/oklch\(([\d.]+)% ([\d.]+) ([\d.]+)\)/)
+ if (!match) {
+ throw new Error(`not an oklch colour: ${value}`)
+ }
+ return { lightness: Number(match[1]), chroma: Number(match[2]), hue: Number(match[3]) }
+}
+
+function chromaOf({ value }: { value: string }): number {
+ return parse({ value }).chroma
+}
+
+function hueOf({ value }: { value: string }): number {
+ return parse({ value }).hue
+}
+
+function luminance({ value }: { value: string }): number {
+ if (value.startsWith('#')) {
+ const linear = [1, 3, 5].map((offset) => {
+ const channel = parseInt(value.slice(offset, offset + 2), 16) / 255
+ return channel <= 0.04045 ? channel / 12.92 : Math.pow((channel + 0.055) / 1.055, 2.4)
+ })
+ return 0.2126 * linear[0] + 0.7152 * linear[1] + 0.0722 * linear[2]
+ }
+ const { r, g, b } = linearOf(parse({ value }))
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b
+}
+
+function linearOf({ lightness, chroma, hue }: { lightness: number, chroma: number, hue: number }): { r: number, g: number, b: number } {
+ const l0 = lightness / 100
+ const a = chroma * Math.cos((hue * Math.PI) / 180)
+ const b0 = chroma * Math.sin((hue * Math.PI) / 180)
+ const l = Math.pow(l0 + 0.3963377774 * a + 0.2158037573 * b0, 3)
+ const m = Math.pow(l0 - 0.1055613458 * a - 0.0638541728 * b0, 3)
+ const s = Math.pow(l0 - 0.0894841775 * a - 1.291485548 * b0, 3)
+ const clip = (channel: number) => Math.min(1, Math.max(0, channel))
+ return {
+ r: clip(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s),
+ g: clip(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s),
+ b: clip(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s),
+ }
+}
+
+function contrast({ first, second }: { first: string, second: string }): number {
+ const [lighter, darker] = [luminance({ value: first }), luminance({ value: second })].sort((x, y) => y - x)
+ return (lighter + 0.05) / (darker + 0.05)
+}
+
+function hexOf({ lightness, chroma, hue }: { lightness: number, chroma: number, hue: number }): string {
+ const { r, g, b } = linearOf({ lightness, chroma, hue })
+ const encode = (channel: number) => {
+ const value = channel <= 0.0031308 ? 12.92 * channel : 1.055 * Math.pow(channel, 1 / 2.4) - 0.055
+ return Math.round(value * 255).toString(16).padStart(2, '0')
+ }
+ return `#${encode(r)}${encode(g)}${encode(b)}`
+}
diff --git a/packages/web/scripts/check-tailwind-classes.mjs b/packages/web/scripts/check-tailwind-classes.mjs
index 32c04720fcb..e5c30b524db 100644
--- a/packages/web/scripts/check-tailwind-classes.mjs
+++ b/packages/web/scripts/check-tailwind-classes.mjs
@@ -20,6 +20,7 @@ const ALLOWED = [
const RUNTIME_VARIABLE_PREFIXES = ['--tw-', '--radix-', '--shiki-'];
const RUNTIME_VARIABLE_SUFFIX = '-seed';
+const RUNTIME_RAMP_VARIABLE = /^--(accent|danger|warning|success)-(light|dark)-\d+$/;
const THIRD_PARTY_CSS = ['@xyflow/react/dist/style.css', 'react-data-grid/lib/styles.css'];
@@ -248,7 +249,11 @@ function collectStylesheetClasses() {
}
function isRuntimeVariable({ name }) {
- return RUNTIME_VARIABLE_PREFIXES.some((prefix) => name.startsWith(prefix)) || name.endsWith(RUNTIME_VARIABLE_SUFFIX);
+ return (
+ RUNTIME_VARIABLE_PREFIXES.some((prefix) => name.startsWith(prefix)) ||
+ name.endsWith(RUNTIME_VARIABLE_SUFFIX) ||
+ RUNTIME_RAMP_VARIABLE.test(name)
+ );
}
function walk(dir) {
diff --git a/packages/web/src/app/builder/flow-canvas/index.tsx b/packages/web/src/app/builder/flow-canvas/index.tsx
index e0752331716..f41badeff74 100644
--- a/packages/web/src/app/builder/flow-canvas/index.tsx
+++ b/packages/web/src/app/builder/flow-canvas/index.tsx
@@ -253,7 +253,7 @@ export const FlowCanvas = React.memo(
size={1}
variant={BackgroundVariant.Dots}
bgColor={`var(--gray-2)`}
- color={`var(--gray-5)`}
+ color={`var(--gray-8)`}
/>
<Minimap key={graphKey} />
</ReactFlow>
diff --git a/packages/web/src/app/builder/flow-canvas/nodes/step-node/step-drag-overlay.tsx b/packages/web/src/app/builder/flow-canvas/nodes/step-node/step-drag-overlay.tsx
index 010ae5b39bb..df23ed6c64d 100644
--- a/packages/web/src/app/builder/flow-canvas/nodes/step-node/step-drag-overlay.tsx
+++ b/packages/web/src/app/builder/flow-canvas/nodes/step-node/step-drag-overlay.tsx
@@ -52,6 +52,7 @@ const StepDragOverlay = ({ step }: { step: FlowAction | FlowTrigger }) => {
className="h-full w-full !cursor-grabbing"
src={step?.settings?.customLogoUrl ?? stepMetadata?.logoUrl}
alt={t('Step Icon')}
+ tint
/>
</div>
);
diff --git a/packages/web/src/app/builder/flow-canvas/nodes/step-node/step-node-logo.tsx b/packages/web/src/app/builder/flow-canvas/nodes/step-node/step-node-logo.tsx
index 28a25490fd7..1b2ca261c82 100644
--- a/packages/web/src/app/builder/flow-canvas/nodes/step-node/step-node-logo.tsx
+++ b/packages/web/src/app/builder/flow-canvas/nodes/step-node/step-node-logo.tsx
@@ -29,6 +29,7 @@ const StepNodeLogo = ({
'size-12 p-2.5': isHorizontal,
})}
border
+ tint
/>
</div>
);
diff --git a/packages/web/src/app/builder/piece-properties/property-group-tabs.tsx b/packages/web/src/app/builder/piece-properties/property-group-tabs.tsx
index c966a184bda..aef33166143 100644
--- a/packages/web/src/app/builder/piece-properties/property-group-tabs.tsx
+++ b/packages/web/src/app/builder/piece-properties/property-group-tabs.tsx
@@ -221,7 +221,7 @@ function PropertyGroupTabs({
) : null}
{hasError && (
<span
- className="size-1.5 shrink-0 rounded-full bg-danger-11"
+ className="size-1.5 shrink-0 rounded-full bg-danger-10"
aria-hidden
/>
)}
diff --git a/packages/web/src/app/builder/run-details/loop-iteration-input.tsx b/packages/web/src/app/builder/run-details/loop-iteration-input.tsx
index 2b320887476..d670b850fbf 100644
--- a/packages/web/src/app/builder/run-details/loop-iteration-input.tsx
+++ b/packages/web/src/app/builder/run-details/loop-iteration-input.tsx
@@ -185,13 +185,13 @@ function getIterationStatus(
function getIterationDotClassName(status: StepOutputStatus): string {
switch (status) {
case StepOutputStatus.FAILED:
- return 'bg-danger-11';
+ return 'bg-danger-10';
case StepOutputStatus.RUNNING:
- return 'bg-accent-11 animate-pulse';
+ return 'bg-accent-10 animate-pulse';
case StepOutputStatus.PAUSED:
- return 'bg-warning-11';
+ return 'bg-warning-10';
default:
- return 'bg-success-11';
+ return 'bg-success-10';
}
}
diff --git a/packages/web/src/app/components/global-search/search-result-item.tsx b/packages/web/src/app/components/global-search/search-result-item.tsx
index 0286f3693a3..21bb55c9f7e 100644
--- a/packages/web/src/app/components/global-search/search-result-item.tsx
+++ b/packages/web/src/app/components/global-search/search-result-item.tsx
@@ -36,7 +36,7 @@ function ItemIcon({
if (iconBgColor) {
return (
<span
- className="flex size-5 shrink-0 items-center justify-center rounded-[4px] text-[10px] font-bold"
+ className="flex size-5 shrink-0 items-center justify-center rounded-[4px] text-[10px] font-bold leading-none"
style={{ backgroundColor: iconBgColor, color: iconTextColor }}
>
{iconLetter}
diff --git a/packages/web/src/app/components/no-projects-state.tsx b/packages/web/src/app/components/no-projects-state.tsx
index 2ce0ca67d19..5f52bb5a903 100644
--- a/packages/web/src/app/components/no-projects-state.tsx
+++ b/packages/web/src/app/components/no-projects-state.tsx
@@ -11,7 +11,7 @@ export const NoProjectsState = () => {
variant="secondary"
className="bg-accent-3 text-accent-11 hover:bg-accent-3 gap-1.5 font-medium"
>
- <span className="size-1.5 rounded-full bg-accent-11" />
+ <span className="size-1.5 rounded-full bg-accent-10" />
{t('Waiting for access')}
</Badge>
diff --git a/packages/web/src/app/components/primary-rail/index.tsx b/packages/web/src/app/components/primary-rail/index.tsx
index 024d695fb49..f8426d68ab5 100644
--- a/packages/web/src/app/components/primary-rail/index.tsx
+++ b/packages/web/src/app/components/primary-rail/index.tsx
@@ -516,7 +516,7 @@ function ProjectRow({
const badge = (
<span
- className="flex size-[18px] shrink-0 items-center justify-center rounded-[4px] text-[10px] font-bold"
+ className="flex size-[18px] shrink-0 items-center justify-center rounded-[4px] text-[10px] font-bold leading-none"
style={
palette
? { backgroundColor: palette.color, color: palette.textColor }
diff --git a/packages/web/src/app/components/project-avatar.tsx b/packages/web/src/app/components/project-avatar.tsx
index fc20bed6a82..6fd8de720d1 100644
--- a/packages/web/src/app/components/project-avatar.tsx
+++ b/packages/web/src/app/components/project-avatar.tsx
@@ -5,6 +5,7 @@ import {
} from '@activepieces/shared';
import { Avatar } from '@/components/ui/avatar';
+import { cn } from '@/lib/utils';
interface ProjectAvatarProps {
displayName: string;
@@ -64,11 +65,11 @@ export const ProjectAvatar = ({
showDetails ? 'mb-3' : ''
}`}
style={{
- backgroundColor: 'var(--gray-9)',
+ backgroundColor: 'var(--gray-11)',
color: 'var(--gray-1)',
}}
>
- <span className={currentSize.text}>
+ <span className={cn(currentSize.text, 'leading-none')}>
{displayName.charAt(0).toUpperCase()}
</span>
</Avatar>
@@ -117,7 +118,7 @@ export const ProjectAvatar = ({
color: PROJECT_COLOR_PALETTE[iconColor].textColor,
}}
>
- <span className={currentSize.text}>
+ <span className={cn(currentSize.text, 'leading-none')}>
{displayName.charAt(0).toUpperCase()}
</span>
</Avatar>
diff --git a/packages/web/src/app/components/project-settings/mcp-server/mcp-flows.tsx b/packages/web/src/app/components/project-settings/mcp-server/mcp-flows.tsx
index b99cf5d566d..b6383252ab3 100644
--- a/packages/web/src/app/components/project-settings/mcp-server/mcp-flows.tsx
+++ b/packages/web/src/app/components/project-settings/mcp-server/mcp-flows.tsx
@@ -39,7 +39,7 @@ export function McpFlows({ mcpServer }: McpFlowsProps) {
<div
className={cn(
'w-2 h-2 rounded-full',
- isEnabled ? 'bg-success-11' : 'bg-gray-11',
+ isEnabled ? 'bg-success-10' : 'bg-gray-9',
)}
/>
<span>{isEnabled ? t('On') : t('Off')}</span>
diff --git a/packages/web/src/app/routes/chat-with-ai/components/batch-progress-card.tsx b/packages/web/src/app/routes/chat-with-ai/components/batch-progress-card.tsx
index e6d5e6ffcd4..49437a016b4 100644
--- a/packages/web/src/app/routes/chat-with-ai/components/batch-progress-card.tsx
+++ b/packages/web/src/app/routes/chat-with-ai/components/batch-progress-card.tsx
@@ -52,8 +52,8 @@ export function BatchProgressCard({
'transition-all duration-500',
progress.done
? hasFailures
- ? 'bg-warning-11'
- : 'bg-success-11'
+ ? 'bg-warning-9'
+ : 'bg-success-9'
: undefined,
)}
/>
diff --git a/packages/web/src/app/routes/chat-with-ai/components/conversation-status-dot.tsx b/packages/web/src/app/routes/chat-with-ai/components/conversation-status-dot.tsx
index f71276175ad..1dd28865898 100644
--- a/packages/web/src/app/routes/chat-with-ai/components/conversation-status-dot.tsx
+++ b/packages/web/src/app/routes/chat-with-ai/components/conversation-status-dot.tsx
@@ -16,7 +16,7 @@ export function ConversationStatusDot({
<TooltipTrigger asChild>
<span className="relative flex h-1.5 w-1.5 items-center justify-center">
{state === 'working' && (
- <span className="absolute inline-flex h-full w-full rounded-full bg-accent-11 opacity-75 animate-ping" />
+ <span className="absolute inline-flex h-full w-full rounded-full bg-accent-10 opacity-75 animate-ping" />
)}
<span
className={cn(
@@ -49,7 +49,7 @@ function getStateLabel(state: ConversationIndicatorState): string {
}
const DOT_CLASS: Record<ConversationIndicatorState, string> = {
- working: 'bg-accent-11',
- waiting: 'bg-warning-11',
+ working: 'bg-accent-10',
+ waiting: 'bg-warning-10',
unread: 'bg-gray-12',
};
diff --git a/packages/web/src/app/routes/chat-with-ai/components/flow-build-card.tsx b/packages/web/src/app/routes/chat-with-ai/components/flow-build-card.tsx
index fbed0df5061..a8568180a4c 100644
--- a/packages/web/src/app/routes/chat-with-ai/components/flow-build-card.tsx
+++ b/packages/web/src/app/routes/chat-with-ai/components/flow-build-card.tsx
@@ -69,8 +69,8 @@ export function FlowBuildCard({
className="mt-3 h-2"
indicatorClassName={cn(
'transition-all duration-500',
- isDone && 'bg-success-11',
- isFailed && 'bg-warning-11',
+ isDone && 'bg-success-9',
+ isFailed && 'bg-warning-9',
)}
/>
</div>
diff --git a/packages/web/src/app/routes/impact/components/project-select.tsx b/packages/web/src/app/routes/impact/components/project-select.tsx
index d79b670f413..5f71126b1e5 100644
--- a/packages/web/src/app/routes/impact/components/project-select.tsx
+++ b/packages/web/src/app/routes/impact/components/project-select.tsx
@@ -63,7 +63,7 @@ export function ProjectSelect({
>
{selectedProject?.type === ProjectType.TEAM ? (
<Avatar
- className="size-4 shrink-0 flex items-center justify-center rounded-[4px] text-xs font-bold"
+ className="size-4 shrink-0 flex items-center justify-center rounded-[4px] text-xs font-bold leading-none"
style={{
backgroundColor:
PROJECT_COLOR_PALETTE[selectedProject.icon.color].color,
@@ -108,7 +108,7 @@ export function ProjectSelect({
>
{isTeam && project ? (
<Avatar
- className="size-5 shrink-0 flex items-center justify-center rounded-[4px] text-xs font-bold"
+ className="size-5 shrink-0 flex items-center justify-center rounded-[4px] text-xs font-bold leading-none"
style={{
backgroundColor:
PROJECT_COLOR_PALETTE[project.icon.color].color,
diff --git a/packages/web/src/app/routes/impact/details/index.tsx b/packages/web/src/app/routes/impact/details/index.tsx
index a355489894f..ac60455ada0 100644
--- a/packages/web/src/app/routes/impact/details/index.tsx
+++ b/packages/web/src/app/routes/impact/details/index.tsx
@@ -214,7 +214,7 @@ export function FlowsDetails({
const projectAvatar =
project?.type === ProjectType.TEAM ? (
<Avatar
- className="size-5 shrink-0 flex items-center justify-center rounded-[4px] text-xs font-bold"
+ className="size-5 shrink-0 flex items-center justify-center rounded-[4px] text-xs font-bold leading-none"
style={{
backgroundColor:
PROJECT_COLOR_PALETTE[project.icon.color].color,
diff --git a/packages/web/src/app/routes/mcp-server/grants/grants-columns.tsx b/packages/web/src/app/routes/mcp-server/grants/grants-columns.tsx
index 230bdd20e65..9427983f960 100644
--- a/packages/web/src/app/routes/mcp-server/grants/grants-columns.tsx
+++ b/packages/web/src/app/routes/mcp-server/grants/grants-columns.tsx
@@ -117,7 +117,7 @@ export function buildGrantsColumns({
<span
className={cn(
'size-1.5 shrink-0 rounded-full',
- lastUsed.isActiveToday ? 'bg-success-11' : 'bg-transparent',
+ lastUsed.isActiveToday ? 'bg-success-10' : 'bg-transparent',
)}
/>
<span className={cn(!lastUsed.isActiveToday && 'text-gray-11')}>
diff --git a/packages/web/src/app/routes/mcp-server/recently-connected.tsx b/packages/web/src/app/routes/mcp-server/recently-connected.tsx
index 620afadb724..1bc9ba9d366 100644
--- a/packages/web/src/app/routes/mcp-server/recently-connected.tsx
+++ b/packages/web/src/app/routes/mcp-server/recently-connected.tsx
@@ -85,7 +85,7 @@ function ClientChip({ row }: { row: McpOAuthGrant }) {
</span>
{row.lastUsedAt === null ? (
<Badge variant="outline" className="gap-1.5 font-normal">
- <span className="size-1.5 rounded-full bg-gray-11" />
+ <span className="size-1.5 rounded-full bg-gray-9" />
{t('Waiting for first call')}
</Badge>
) : (
diff --git a/packages/web/src/app/routes/platform/infra/health/components/status-line-chart.tsx b/packages/web/src/app/routes/platform/infra/health/components/status-line-chart.tsx
index fca2f4b6b6d..78cf70f36a5 100644
--- a/packages/web/src/app/routes/platform/infra/health/components/status-line-chart.tsx
+++ b/packages/web/src/app/routes/platform/infra/health/components/status-line-chart.tsx
@@ -22,22 +22,22 @@ const SERIES: Array<{ status: FlowRunStatus; label: string; color: string }> = [
{
status: FlowRunStatus.SUCCEEDED,
label: 'Succeeded',
- color: 'var(--success-11)',
+ color: 'var(--success-9)',
},
{
status: FlowRunStatus.FAILED,
label: 'Failed',
- color: 'var(--warning-11)',
+ color: 'var(--warning-9)',
},
{
status: FlowRunStatus.INTERNAL_ERROR,
label: 'Internal error',
- color: 'var(--danger-11)',
+ color: 'var(--danger-9)',
},
{
status: FlowRunStatus.CANCELED,
label: 'Cancelled',
- color: 'var(--gray-11)',
+ color: 'var(--gray-9)',
},
];
diff --git a/packages/web/src/app/routes/platform/infra/health/components/system-health-tab.tsx b/packages/web/src/app/routes/platform/infra/health/components/system-health-tab.tsx
index 94334f29931..71db35ab3c8 100644
--- a/packages/web/src/app/routes/platform/infra/health/components/system-health-tab.tsx
+++ b/packages/web/src/app/routes/platform/infra/health/components/system-health-tab.tsx
@@ -306,17 +306,17 @@ const STATUS_CONFIG = {
passed: {
label: 'Passed',
text: 'text-success-11',
- dot: 'bg-success-11',
+ dot: 'bg-success-10',
},
failed: {
label: 'Needs attention',
text: 'text-danger-11',
- dot: 'bg-danger-11',
+ dot: 'bg-danger-10',
},
na: {
label: 'Not applicable',
text: 'text-gray-11',
- dot: 'bg-gray-11',
+ dot: 'bg-gray-9',
},
} as const;
diff --git a/packages/web/src/app/routes/platform/infra/workers/index.tsx b/packages/web/src/app/routes/platform/infra/workers/index.tsx
index ff94e389d58..f9fe73199c3 100644
--- a/packages/web/src/app/routes/platform/infra/workers/index.tsx
+++ b/packages/web/src/app/routes/platform/infra/workers/index.tsx
@@ -163,11 +163,7 @@ export default function WorkersPage({ section }: WorkersPageProps) {
function StatBar({ label, value, detail }: StatBarProps) {
const barColor =
- value > 95
- ? 'bg-danger-11'
- : value > 80
- ? 'bg-warning-11'
- : 'bg-success-11';
+ value > 95 ? 'bg-danger-9' : value > 80 ? 'bg-warning-9' : 'bg-success-9';
return (
<div className="flex items-center gap-2">
diff --git a/packages/web/src/app/routes/platform/security/embed/stepper.tsx b/packages/web/src/app/routes/platform/security/embed/stepper.tsx
index 7648aceb812..ba527e23aa8 100644
--- a/packages/web/src/app/routes/platform/security/embed/stepper.tsx
+++ b/packages/web/src/app/routes/platform/security/embed/stepper.tsx
@@ -74,7 +74,7 @@ export const Stepper = ({
<div
className={cn(
'w-px flex-1 my-2',
- isComplete ? 'bg-success-11' : 'bg-gray-6',
+ isComplete ? 'bg-success-10' : 'bg-gray-6',
)}
/>
)}
diff --git a/packages/web/src/app/routes/platform/security/project-role/permission-grid.tsx b/packages/web/src/app/routes/platform/security/project-role/permission-grid.tsx
index f9a1c60acb4..bae5f91ba10 100644
--- a/packages/web/src/app/routes/platform/security/project-role/permission-grid.tsx
+++ b/packages/web/src/app/routes/platform/security/project-role/permission-grid.tsx
@@ -44,7 +44,7 @@ export function PermissionGrid({
className={cn(
'size-1.5 shrink-0 rounded-full',
changedRowKeys?.includes(row.key)
- ? 'bg-accent-11'
+ ? 'bg-accent-10'
: 'bg-transparent',
)}
/>
diff --git a/packages/web/src/app/routes/platform/setup/ai/capabilities-tab/index.tsx b/packages/web/src/app/routes/platform/setup/ai/capabilities-tab/index.tsx
index 14932171b5b..7183277833a 100644
--- a/packages/web/src/app/routes/platform/setup/ai/capabilities-tab/index.tsx
+++ b/packages/web/src/app/routes/platform/setup/ai/capabilities-tab/index.tsx
@@ -146,7 +146,7 @@ function CapabilityCard({
<span className="flex min-w-0 items-center gap-1.5 text-xs text-gray-11">
<span
className={cn('size-1.5 shrink-0 rounded-full', {
- 'bg-success-11': inUse,
+ 'bg-success-10': inUse,
'border border-gray-8': !inUse,
})}
/>
diff --git a/packages/web/src/components/custom/dot.tsx b/packages/web/src/components/custom/dot.tsx
index 14506fd58a5..ddba5968599 100644
--- a/packages/web/src/components/custom/dot.tsx
+++ b/packages/web/src/components/custom/dot.tsx
@@ -6,8 +6,8 @@ import { cn } from '@/lib/utils';
const dotVariants = cva('size-2 rounded-full', {
variants: {
variant: {
- destructive: 'bg-danger-11',
- primary: 'bg-accent-11',
+ destructive: 'bg-danger-10',
+ primary: 'bg-accent-10',
},
},
defaultVariants: {},
diff --git a/packages/web/src/components/custom/logo-plate.tsx b/packages/web/src/components/custom/logo-plate.tsx
index bd7bdbc08b8..83922c6d2a2 100644
--- a/packages/web/src/components/custom/logo-plate.tsx
+++ b/packages/web/src/components/custom/logo-plate.tsx
@@ -3,6 +3,7 @@ import React from 'react';
import { ImageWithFallback } from '@/components/custom/image-with-fallback';
import { Skeleton } from '@/components/ui/skeleton';
+import { logoTint } from '@/lib/logo-tint';
import { cn } from '@/lib/utils';
const logoPlateVariants = cva(
@@ -21,6 +22,9 @@ const logoPlateVariants = cva(
border: {
true: 'border border-solid',
},
+ tint: {
+ true: 'transition-colors duration-300',
+ },
},
},
);
@@ -49,24 +53,29 @@ export const LogoPlate = React.memo(
className,
innerClassName,
fallback,
- }: LogoPlateProps) => (
- <div
- data-theme="light"
- title={title}
- className={cn(logoPlateVariants({ size, border }), className)}
- >
- {src ? (
- <ImageWithFallback
- src={src}
- alt={alt}
- className={cn(logoPlatePadding({ size }), innerClassName)}
- fallback={fallback}
- />
- ) : (
- fallback ?? <Skeleton className="h-full w-full rounded-md" />
- )}
- </div>
- ),
+ tint,
+ }: LogoPlateProps) => {
+ const tintColor = logoTint.useLogoTint({ src, enabled: tint === true });
+ return (
+ <div
+ data-theme="light"
+ title={title}
+ className={cn(logoPlateVariants({ size, border, tint }), className)}
+ style={tintColor ? { backgroundColor: tintColor } : undefined}
+ >
+ {src ? (
+ <ImageWithFallback
+ src={src}
+ alt={alt}
+ className={cn(logoPlatePadding({ size }), innerClassName)}
+ fallback={fallback}
+ />
+ ) : (
+ fallback ?? <Skeleton className="h-full w-full rounded-md" />
+ )}
+ </div>
+ );
+ },
);
LogoPlate.displayName = 'LogoPlate';
diff --git a/packages/web/src/components/custom/route-loading-bar.tsx b/packages/web/src/components/custom/route-loading-bar.tsx
index 42161dec9a0..f61d3391f2f 100644
--- a/packages/web/src/components/custom/route-loading-bar.tsx
+++ b/packages/web/src/components/custom/route-loading-bar.tsx
@@ -3,7 +3,7 @@ import { createPortal } from 'react-dom';
export function RouteLoadingBar() {
const bar = (
<div className="absolute top-0 left-0 right-0 h-0.5 overflow-hidden bg-accent-5 z-50">
- <div className="h-full w-1/4 bg-accent-11 rounded-full animate-indeterminate-progress" />
+ <div className="h-full w-1/4 bg-accent-9 rounded-full animate-indeterminate-progress" />
</div>
);
@@ -15,7 +15,7 @@ export function RouteLoadingBar() {
return (
<div className="h-full w-full">
<div className="h-0.5 w-full overflow-hidden bg-accent-5">
- <div className="h-full w-1/4 bg-accent-11 rounded-full animate-indeterminate-progress" />
+ <div className="h-full w-1/4 bg-accent-9 rounded-full animate-indeterminate-progress" />
</div>
</div>
);
diff --git a/packages/web/src/components/ui/progress.tsx b/packages/web/src/components/ui/progress.tsx
index 23d6ce173a7..60ac1cac124 100644
--- a/packages/web/src/components/ui/progress.tsx
+++ b/packages/web/src/components/ui/progress.tsx
@@ -26,7 +26,7 @@ function Progress({
<ProgressPrimitive.Indicator
data-slot="progress-indicator"
className={cn(
- 'h-full w-full flex-1 bg-accent-11 transition-all',
+ 'h-full w-full flex-1 bg-accent-9 transition-all',
usage && usageIndicatorClass(percent / 100),
indicatorClassName,
)}
@@ -38,12 +38,12 @@ function Progress({
function usageIndicatorClass(ratio: number): string {
if (ratio >= 0.85) {
- return 'bg-danger-11';
+ return 'bg-danger-9';
}
if (ratio >= 0.7) {
- return 'bg-warning-11';
+ return 'bg-warning-9';
}
- return 'bg-accent-11';
+ return 'bg-accent-9';
}
function usageTrackClass(ratio: number): string {
diff --git a/packages/web/src/features/agents/agent-tools/components/piece-tool.tsx b/packages/web/src/features/agents/agent-tools/components/piece-tool.tsx
index 882bd2ede2a..3987927bf92 100644
--- a/packages/web/src/features/agents/agent-tools/components/piece-tool.tsx
+++ b/packages/web/src/features/agents/agent-tools/components/piece-tool.tsx
@@ -135,10 +135,10 @@ export const AgentPieceToolComponent = ({
<span
className={cn(
'size-[6px] shrink-0 rounded-full',
- account.state === 'connected' && 'bg-success-11',
- account.state === 'deleted' && 'bg-danger-11',
- account.state === 'missing' && 'bg-warning-11',
- account.state === 'mixed' && 'bg-gray-11',
+ account.state === 'connected' && 'bg-success-10',
+ account.state === 'deleted' && 'bg-danger-10',
+ account.state === 'missing' && 'bg-warning-10',
+ account.state === 'mixed' && 'bg-gray-9',
)}
/>
<span className="truncate">{accountText}</span>
diff --git a/packages/web/src/features/authentication/components/password-validator.tsx b/packages/web/src/features/authentication/components/password-validator.tsx
index 1b0fbf4b814..183ea4954a3 100644
--- a/packages/web/src/features/authentication/components/password-validator.tsx
+++ b/packages/web/src/features/authentication/components/password-validator.tsx
@@ -95,9 +95,9 @@ const PasswordRequirementsList = ({
className={cn(
'w-2 h-2 rounded-full shrink-0',
rule.passed
- ? 'bg-success-11'
+ ? 'bg-success-10'
: isError
- ? 'bg-danger-11'
+ ? 'bg-danger-10'
: 'bg-gray-8',
)}
/>
diff --git a/packages/web/src/features/billing/components/automatic-trial-activation.tsx b/packages/web/src/features/billing/components/automatic-trial-activation.tsx
index 3bfbc8653f1..02305bf4891 100644
--- a/packages/web/src/features/billing/components/automatic-trial-activation.tsx
+++ b/packages/web/src/features/billing/components/automatic-trial-activation.tsx
@@ -174,7 +174,7 @@ const TrialActivationScreen = ({
className="h-1.5 overflow-hidden rounded-full bg-gray-3"
>
<div
- className="relative h-full overflow-hidden rounded-full bg-accent-11 transition-[width] duration-300 ease-[var(--ease-expand-out)]"
+ className="relative h-full overflow-hidden rounded-full bg-accent-9 transition-[width] duration-300 ease-[var(--ease-expand-out)]"
style={{ width: `${Math.round(progress)}%` }}
>
<div className="absolute inset-0 bg-[linear-gradient(90deg,transparent,rgba(255,255,255,0.45),transparent)] animate-indeterminate-progress" />
diff --git a/packages/web/src/features/flow-runs/hooks/flow-run-hooks.ts b/packages/web/src/features/flow-runs/hooks/flow-run-hooks.ts
index 771fd1642c4..239965c7f2c 100644
--- a/packages/web/src/features/flow-runs/hooks/flow-run-hooks.ts
+++ b/packages/web/src/features/flow-runs/hooks/flow-run-hooks.ts
@@ -32,7 +32,7 @@ const STATUS_CATEGORIES = [
{
label: 'Succeeded',
statuses: [FlowRunStatus.SUCCEEDED],
- color: 'var(--success-11)',
+ color: 'var(--success-9)',
},
{
label: 'Failed',
@@ -44,27 +44,27 @@ const STATUS_CATEGORIES = [
FlowRunStatus.QUOTA_EXCEEDED,
FlowRunStatus.LOG_SIZE_EXCEEDED,
],
- color: 'var(--danger-11)',
+ color: 'var(--danger-9)',
},
{
label: 'Running',
statuses: [FlowRunStatus.RUNNING],
- color: 'var(--accent-11)',
+ color: 'var(--accent-9)',
},
{
label: 'Queued',
statuses: [FlowRunStatus.QUEUED],
- color: 'var(--gray-11)',
+ color: 'var(--gray-9)',
},
{
label: 'Paused',
statuses: [FlowRunStatus.PAUSED],
- color: 'var(--warning-11)',
+ color: 'var(--warning-9)',
},
{
label: 'Canceled',
statuses: [FlowRunStatus.CANCELED],
- color: 'var(--gray-11)',
+ color: 'var(--gray-9)',
},
] as const;
diff --git a/packages/web/src/features/flows/components/flow-version-state-dot.tsx b/packages/web/src/features/flows/components/flow-version-state-dot.tsx
index 2a12a0efc02..08301821a6a 100644
--- a/packages/web/src/features/flows/components/flow-version-state-dot.tsx
+++ b/packages/web/src/features/flows/components/flow-version-state-dot.tsx
@@ -39,10 +39,10 @@ const FlowVersionStateDot = React.memo((state: FlowVersionStateProps) => {
<TooltipTrigger asChild>
<div className="size-8 flex justify-center items-center">
{stateName === 'Draft' && (
- <span className="bg-warning-11 size-1.5 rounded-full"></span>
+ <span className="bg-warning-10 size-1.5 rounded-full"></span>
)}
{stateName === 'Published' && (
- <span className="bg-success-11 size-1.5 rounded-full"></span>
+ <span className="bg-success-10 size-1.5 rounded-full"></span>
)}
</div>
</TooltipTrigger>
diff --git a/packages/web/src/features/pieces/components/piece-icon.tsx b/packages/web/src/features/pieces/components/piece-icon.tsx
index be90e968e04..07327ebf18c 100644
--- a/packages/web/src/features/pieces/components/piece-icon.tsx
+++ b/packages/web/src/features/pieces/components/piece-icon.tsx
@@ -17,6 +17,7 @@ const PieceIcon = React.memo(
alt={displayName}
size={size}
border={border}
+ tint
/>
</div>
</TooltipTrigger>
diff --git a/packages/web/src/lib/brand-seed.ts b/packages/web/src/lib/brand-seed.ts
index c75eb66ef5f..554ef9d7562 100644
--- a/packages/web/src/lib/brand-seed.ts
+++ b/packages/web/src/lib/brand-seed.ts
@@ -20,9 +20,7 @@ function clearPreview() {
function write({ primaryColor, statusColors = {} }: BrandSeed) {
const { style } = document.documentElement;
- brandColors
- .statusVariableNames()
- .forEach((name) => style.removeProperty(name));
+ brandColors.variableNames().forEach((name) => style.removeProperty(name));
Object.entries({
...brandColors.cssVariables({ primaryColor }),
...brandColors.statusCssVariables({ statusColors }),
diff --git a/packages/web/src/lib/logo-tint.ts b/packages/web/src/lib/logo-tint.ts
new file mode 100644
index 00000000000..c97d71c2296
--- /dev/null
+++ b/packages/web/src/lib/logo-tint.ts
@@ -0,0 +1,187 @@
+import { tryCatchSync } from '@activepieces/core-utils';
+import { useEffect, useState } from 'react';
+
+const SAMPLE_SIZE = 24;
+const MIN_ALPHA = 128;
+const MIN_PIXEL_CHROMA = 0.04;
+const MIN_COLOURED_SHARE = 0.08;
+const TINT_LIGHTNESS = 96.5;
+const TINT_CHROMA = 0.022;
+const FAILED_LOAD_RETRY_MS = 5 * 60 * 1000;
+
+const resolved = new Map<string, string | null>();
+const pending = new Map<string, Promise<string | null>>();
+const failedAt = new Map<string, number>();
+
+function useLogoTint({
+ src,
+ enabled,
+}: {
+ src: string | undefined;
+ enabled: boolean;
+}): string | null {
+ const [loaded, setLoaded] = useState<LoadedTint | null>(null);
+
+ useEffect(() => {
+ if (!src || !enabled || resolved.has(src)) {
+ return;
+ }
+ let live = true;
+ tintFor({ src })
+ .then((color) => {
+ if (live) {
+ setLoaded({ src, color });
+ }
+ })
+ .catch(() => {
+ if (live) {
+ setLoaded({ src, color: null });
+ }
+ });
+ return () => {
+ live = false;
+ };
+ }, [src, enabled]);
+
+ if (!src || !enabled) {
+ return null;
+ }
+ if (resolved.has(src)) {
+ return resolved.get(src) ?? null;
+ }
+ return loaded?.src === src ? loaded.color : null;
+}
+
+function tintFor({ src }: { src: string }): Promise<string | null> {
+ if (resolved.has(src)) {
+ return Promise.resolve(resolved.get(src) ?? null);
+ }
+ const existing = pending.get(src);
+ if (existing) {
+ return existing;
+ }
+ if (failedRecently({ src })) {
+ return Promise.resolve(null);
+ }
+ const promise = loadImage({ src })
+ .then((image) => {
+ const { data } = tryCatchSync(() =>
+ tintFromPixels({ pixels: samplePixels({ image }) }),
+ );
+ const color = data ?? null;
+ failedAt.delete(src);
+ resolved.set(src, color);
+ return color;
+ })
+ .catch(() => {
+ failedAt.set(src, Date.now());
+ return null;
+ })
+ .finally(() => pending.delete(src));
+ pending.set(src, promise);
+ return promise;
+}
+
+function failedRecently({ src }: { src: string }): boolean {
+ const at = failedAt.get(src);
+ return at !== undefined && Date.now() - at < FAILED_LOAD_RETRY_MS;
+}
+
+function loadImage({ src }: { src: string }): Promise<HTMLImageElement> {
+ return new Promise((resolve, reject) => {
+ const image = new Image();
+ image.crossOrigin = 'anonymous';
+ image.decoding = 'async';
+ image.onload = () => resolve(image);
+ image.onerror = () => reject(new Error(`failed to load ${src}`));
+ image.src = src;
+ });
+}
+
+function samplePixels({
+ image,
+}: {
+ image: HTMLImageElement;
+}): Uint8ClampedArray | null {
+ const canvas = document.createElement('canvas');
+ canvas.width = SAMPLE_SIZE;
+ canvas.height = SAMPLE_SIZE;
+ const context = canvas.getContext('2d', { willReadFrequently: true });
+ if (!context) {
+ return null;
+ }
+ context.drawImage(image, 0, 0, SAMPLE_SIZE, SAMPLE_SIZE);
+ return context.getImageData(0, 0, SAMPLE_SIZE, SAMPLE_SIZE).data;
+}
+
+function tintFromPixels({
+ pixels,
+}: {
+ pixels: Uint8ClampedArray | null;
+}): string | null {
+ if (!pixels) {
+ return null;
+ }
+ const visible = Array.from({ length: pixels.length / 4 }, (_, index) => ({
+ red: pixels[index * 4],
+ green: pixels[index * 4 + 1],
+ blue: pixels[index * 4 + 2],
+ alpha: pixels[index * 4 + 3],
+ })).filter(({ alpha }) => alpha >= MIN_ALPHA);
+ if (visible.length === 0) {
+ return null;
+ }
+ const coloured = visible
+ .map((pixel) => toOklab(pixel))
+ .map(({ a, b }) => ({ a, b, chroma: Math.hypot(a, b) }))
+ .filter(({ chroma }) => chroma >= MIN_PIXEL_CHROMA);
+ if (coloured.length / visible.length < MIN_COLOURED_SHARE) {
+ return null;
+ }
+ const sum = coloured.reduce(
+ (total, { a, b, chroma }) => ({
+ a: total.a + a * chroma,
+ b: total.b + b * chroma,
+ }),
+ { a: 0, b: 0 },
+ );
+ if (Math.hypot(sum.a, sum.b) === 0) {
+ return null;
+ }
+ const hue = (Math.atan2(sum.b, sum.a) * 180) / Math.PI;
+ return `oklch(${TINT_LIGHTNESS}% ${TINT_CHROMA} ${((hue + 360) % 360).toFixed(
+ 1,
+ )})`;
+}
+
+function toOklab({
+ red,
+ green,
+ blue,
+}: {
+ red: number;
+ green: number;
+ blue: number;
+}): { a: number; b: number } {
+ const [r, g, b] = [red, green, blue].map((channel) => {
+ const value = channel / 255;
+ return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
+ });
+ const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
+ const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);
+ const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);
+ return {
+ a: 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s,
+ b: 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s,
+ };
+}
+
+export const logoTint = {
+ useLogoTint,
+ tintFromPixels,
+};
+
+type LoadedTint = {
+ src: string;
+ color: string | null;
+};
diff --git a/packages/web/src/styles.css b/packages/web/src/styles.css
index 43a5c2a295f..40aa98828be 100644
--- a/packages/web/src/styles.css
+++ b/packages/web/src/styles.css
@@ -509,159 +509,146 @@
}
:root {
- --brand-h: 288.86;
- --brand-c: 1;
- --accent-9: #6e41e2;
- --on-accent: oklch(98% 0.01 var(--brand-h));
-
- --danger-h: 25;
- --danger-c: 1;
- --warning-h: 75;
- --warning-c: 1;
- --success-h: 150;
- --success-c: 1;
+ --on-accent: #ffffff;
}
:root,
[data-theme='light'] {
- --brand-cs: clamp(0, var(--brand-c), 1);
- --danger-cs: clamp(0, var(--danger-c), 1);
- --warning-cs: clamp(0, var(--warning-c), 1);
- --success-cs: clamp(0, var(--success-c), 1);
-
- --gray-1: oklch(98.4% calc(0.009 * var(--brand-cs)) var(--brand-h));
- --gray-2: oklch(96.6% calc(0.008 * var(--brand-cs)) var(--brand-h));
- --gray-3: oklch(94.8% calc(0.008 * var(--brand-cs)) var(--brand-h));
- --gray-4: oklch(92.8% calc(0.009 * var(--brand-cs)) var(--brand-h));
- --gray-5: oklch(90.6% calc(0.01 * var(--brand-cs)) var(--brand-h));
- --gray-6: oklch(87.5% calc(0.011 * var(--brand-cs)) var(--brand-h));
- --gray-7: oklch(81% calc(0.013 * var(--brand-cs)) var(--brand-h));
- --gray-8: oklch(62.5% calc(0.016 * var(--brand-cs)) var(--brand-h));
- --gray-9: oklch(53% calc(0.018 * var(--brand-cs)) var(--brand-h));
- --gray-10: oklch(48% calc(0.018 * var(--brand-cs)) var(--brand-h));
- --gray-11: oklch(41% calc(0.016 * var(--brand-cs)) var(--brand-h));
- --gray-12: oklch(20% calc(0.012 * var(--brand-cs)) var(--brand-h));
-
- --accent-1: oklch(98.7% calc(0.0062 * var(--brand-cs)) var(--brand-h));
- --accent-2: oklch(96.9% calc(0.0148 * var(--brand-cs)) var(--brand-h));
- --accent-3: oklch(95.3% calc(0.0225 * var(--brand-cs)) var(--brand-h));
- --accent-4: oklch(93% calc(0.0337 * var(--brand-cs)) var(--brand-h));
- --accent-5: oklch(90.2% calc(0.0476 * var(--brand-cs)) var(--brand-h));
- --accent-6: oklch(86.5% calc(0.0666 * var(--brand-cs)) var(--brand-h));
- --accent-7: oklch(80% calc(0.092 * var(--brand-cs)) var(--brand-h));
- --accent-8: oklch(60% calc(0.165 * var(--brand-cs)) var(--brand-h));
- --accent-10: oklch(43% calc(0.215 * var(--brand-cs)) var(--brand-h));
- --accent-11: oklch(39% calc(0.18 * var(--brand-cs)) var(--brand-h));
- --accent-12: oklch(22% calc(0.085 * var(--brand-cs)) var(--brand-h));
-
- --success-1: oklch(98.7% calc(0.01 * var(--success-cs)) var(--success-h));
- --success-2: oklch(96.9% calc(0.02 * var(--success-cs)) var(--success-h));
- --success-3: oklch(95.3% calc(0.034 * var(--success-cs)) var(--success-h));
- --success-4: oklch(93% calc(0.046 * var(--success-cs)) var(--success-h));
- --success-5: oklch(90.2% calc(0.058 * var(--success-cs)) var(--success-h));
- --success-6: oklch(86.5% calc(0.072 * var(--success-cs)) var(--success-h));
- --success-7: oklch(80% calc(0.092 * var(--success-cs)) var(--success-h));
- --success-8: oklch(70% calc(0.105 * var(--success-cs)) var(--success-h));
- --success-9: var(--success-seed, oklch(66% calc(0.16 * var(--success-cs)) var(--success-h)));
- --success-10: oklch(45% calc(0.115 * var(--success-cs)) var(--success-h));
- --success-11: oklch(42% calc(0.105 * var(--success-cs)) var(--success-h));
- --success-12: oklch(22% calc(0.05 * var(--success-cs)) var(--success-h));
-
- --warning-1: oklch(98.7% calc(0.0099 * var(--warning-cs)) var(--warning-h));
- --warning-2: oklch(96.9% calc(0.02 * var(--warning-cs)) var(--warning-h));
- --warning-3: oklch(95.3% calc(0.034 * var(--warning-cs)) var(--warning-h));
- --warning-4: oklch(93% calc(0.046 * var(--warning-cs)) var(--warning-h));
- --warning-5: oklch(90.2% calc(0.058 * var(--warning-cs)) var(--warning-h));
- --warning-6: oklch(86.5% calc(0.072 * var(--warning-cs)) var(--warning-h));
- --warning-7: oklch(80% calc(0.092 * var(--warning-cs)) var(--warning-h));
- --warning-8: oklch(72% calc(0.13 * var(--warning-cs)) var(--warning-h));
- --warning-9: var(--warning-seed, oklch(80% calc(0.1591 * var(--warning-cs)) var(--warning-h)));
- --warning-10: oklch(50% calc(0.1003 * var(--warning-cs)) var(--warning-h));
- --warning-11: oklch(44% calc(0.0887 * var(--warning-cs)) var(--warning-h));
- --warning-12: oklch(24% calc(0.0527 * var(--warning-cs)) var(--warning-h));
-
- --danger-1: oklch(98.7% calc(0.006 * var(--danger-cs)) var(--danger-h));
- --danger-2: oklch(96.9% calc(0.0144 * var(--danger-cs)) var(--danger-h));
- --danger-3: oklch(95.3% calc(0.0221 * var(--danger-cs)) var(--danger-h));
- --danger-4: oklch(93% calc(0.0334 * var(--danger-cs)) var(--danger-h));
- --danger-5: oklch(90.2% calc(0.0479 * var(--danger-cs)) var(--danger-h));
- --danger-6: oklch(86.5% calc(0.0683 * var(--danger-cs)) var(--danger-h));
- --danger-7: oklch(80% calc(0.092 * var(--danger-cs)) var(--danger-h));
- --danger-8: oklch(68% calc(0.15 * var(--danger-cs)) var(--danger-h));
- --danger-9: var(--danger-seed, oklch(52% calc(0.1994 * var(--danger-cs)) var(--danger-h)));
- --danger-10: oklch(47% calc(0.1806 * var(--danger-cs)) var(--danger-h));
- --danger-11: oklch(45% calc(0.17 * var(--danger-cs)) var(--danger-h));
- --danger-12: oklch(24% calc(0.085 * var(--danger-cs)) var(--danger-h));
+
+ --gray-1: oklch(99.3% 0 0);
+ --gray-2: oklch(98.2% 0 0);
+ --gray-3: oklch(97% 0 0);
+ --gray-4: oklch(95.5% 0 0);
+ --gray-5: oklch(93.8% 0 0);
+ --gray-6: oklch(92.2% 0 0);
+ --gray-7: oklch(88.5% 0 0);
+ --gray-8: oklch(74% 0 0);
+ --gray-9: oklch(63% 0 0);
+ --gray-10: oklch(57% 0 0);
+ --gray-11: oklch(52% 0 0);
+ --gray-12: oklch(16% 0 0);
+
+ --accent-1: var(--accent-light-1, oklch(98.45% 0.0065 289.61));
+ --accent-2: var(--accent-light-2, oklch(96.9% 0.013 289.61));
+ --accent-3: var(--accent-light-3, oklch(94.3% 0.0235 290.44));
+ --accent-4: var(--accent-light-4, oklch(91.85% 0.0348 289.13));
+ --accent-5: var(--accent-light-5, oklch(89.4% 0.0462 289.13));
+ --accent-6: var(--accent-light-6, oklch(85.25% 0.068 289.42));
+ --accent-7: var(--accent-light-7, oklch(81.1% 0.0899 289.42));
+ --accent-8: var(--accent-light-8, oklch(70.2% 0.1482 289.39));
+ --accent-9: var(--accent-light-9, #6e41e2);
+ --accent-10: var(--accent-light-10, oklch(54.1% 0.2276 288.86));
+ --accent-11: var(--accent-light-11, oklch(49.1% 0.2187 288.43));
+ --accent-12: var(--accent-light-12, oklch(38% 0.1531 289.6));
+
+ --success-1: var(--success-light-1, oklch(99.1% 0.009 155.83));
+ --success-2: var(--success-light-2, oklch(98.2% 0.018 155.83));
+ --success-3: var(--success-light-3, oklch(96.2% 0.044 156.74));
+ --success-4: var(--success-light-4, oklch(94.35% 0.064 156));
+ --success-5: var(--success-light-5, oklch(92.5% 0.084 156));
+ --success-6: var(--success-light-6, oklch(89.8% 0.117 154.45));
+ --success-7: var(--success-light-7, oklch(87.1% 0.15 154.45));
+ --success-8: var(--success-light-8, oklch(79.2% 0.209 151.71));
+ --success-9: var(--success-light-9, #00a63e);
+ --success-10: var(--success-light-10, oklch(62.7% 0.194 149.21));
+ --success-11: var(--success-light-11, oklch(50.2% 0.154 150.07));
+ --success-12: var(--success-light-12, oklch(39.3% 0.095 152.53));
+
+ --warning-1: var(--warning-light-1, oklch(99.35% 0.011 95.28));
+ --warning-2: var(--warning-light-2, oklch(98.7% 0.022 95.28));
+ --warning-3: var(--warning-light-3, oklch(96.2% 0.059 95.62));
+ --warning-4: var(--warning-light-4, oklch(94.3% 0.0895 95.75));
+ --warning-5: var(--warning-light-5, oklch(92.4% 0.12 95.75));
+ --warning-6: var(--warning-light-6, oklch(90.15% 0.1445 91.61));
+ --warning-7: var(--warning-light-7, oklch(87.9% 0.169 91.61));
+ --warning-8: var(--warning-light-8, oklch(82.8% 0.189 84.43));
+ --warning-9: var(--warning-light-9, #fe9a00);
+ --warning-10: var(--warning-light-10, oklch(66.6% 0.179 58.32));
+ --warning-11: var(--warning-light-11, oklch(53.5% 0.163 49));
+ --warning-12: var(--warning-light-12, oklch(41.4% 0.112 45.9));
+
+ --danger-1: var(--danger-light-1, oklch(98.55% 0.0065 17.38));
+ --danger-2: var(--danger-light-2, oklch(97.1% 0.013 17.38));
+ --danger-3: var(--danger-light-3, oklch(93.6% 0.032 17.72));
+ --danger-4: var(--danger-light-4, oklch(91.05% 0.047 18.33));
+ --danger-5: var(--danger-light-5, oklch(88.5% 0.062 18.33));
+ --danger-6: var(--danger-light-6, oklch(84.65% 0.088 19.57));
+ --danger-7: var(--danger-light-7, oklch(80.8% 0.114 19.57));
+ --danger-8: var(--danger-light-8, oklch(70.4% 0.191 22.22));
+ --danger-9: var(--danger-light-9, #e7000b);
+ --danger-10: var(--danger-light-10, oklch(57.7% 0.245 27.32));
+ --danger-11: var(--danger-light-11, oklch(50.5% 0.213 27.52));
+ --danger-12: var(--danger-light-12, oklch(39.6% 0.141 25.72));
--panel: oklch(100% 0 0);
- --on-success: var(--on-success-seed, oklch(18% 0.06 150));
- --on-warning: var(--on-warning-seed, oklch(18% 0.06 75));
- --on-danger: var(--on-danger-seed, oklch(98% 0.01 25));
+ --on-success: var(--on-success-seed, #000000);
+ --on-warning: var(--on-warning-seed, #000000);
+ --on-danger: var(--on-danger-seed, #ffffff);
--scrim: oklch(0% 0 0 / 70%);
color-scheme: light;
--radius: 0.5rem;
- --swatch-1-mark: oklch(66.81% 0.17 293.01);
- --swatch-1-surface: oklch(96.2% 0.0109 293.01);
- --swatch-1-ink: oklch(55.5% 0.17 293.01);
- --swatch-1-line: oklch(88.5% 0.0371 293.01);
- --swatch-2-mark: oklch(67.35% 0.17 323.01);
- --swatch-2-surface: oklch(96.2% 0.0173 323.01);
- --swatch-2-ink: oklch(55.9% 0.17 323.01);
- --swatch-2-line: oklch(88.5% 0.059 323.01);
- --swatch-3-mark: oklch(67.5% 0.17 353.01);
- --swatch-3-surface: oklch(96.2% 0.0119 353.01);
- --swatch-3-ink: oklch(56.02% 0.17 353.01);
- --swatch-3-line: oklch(88.5% 0.0419 353.01);
- --swatch-4-mark: oklch(67.31% 0.17 23.01);
- --swatch-4-surface: oklch(96.2% 0.0104 23.01);
- --swatch-4-ink: oklch(55.83% 0.17 23.01);
- --swatch-4-line: oklch(88.5% 0.0364 23.01);
- --swatch-5-mark: oklch(66.63% 0.1597 53.01);
- --swatch-5-surface: oklch(96.2% 0.012 53.01);
- --swatch-5-ink: oklch(54.95% 0.1381 53.01);
- --swatch-5-line: oklch(88.5% 0.0419 53.01);
- --swatch-6-mark: oklch(65.57% 0.1274 83.01);
- --swatch-6-surface: oklch(96.2% 0.0209 83.01);
- --swatch-6-ink: oklch(54.14% 0.1101 83.01);
- --swatch-6-line: oklch(88.5% 0.071 83.01);
- --swatch-7-mark: oklch(64.69% 0.1363 113.01);
- --swatch-7-surface: oklch(96.2% 0.05 113.01);
- --swatch-7-ink: oklch(53.58% 0.1179 113.01);
- --swatch-7-line: oklch(88.5% 0.08 113.01);
- --swatch-8-mark: oklch(63.61% 0.17 143.01);
- --swatch-8-surface: oklch(96.2% 0.0376 143.01);
- --swatch-8-ink: oklch(52.54% 0.17 143.01);
- --swatch-8-line: oklch(88.5% 0.08 143.01);
- --swatch-9-mark: oklch(63.82% 0.1157 173.01);
- --swatch-9-surface: oklch(96.2% 0.0299 173.01);
- --swatch-9-ink: oklch(52.82% 0.0999 173.01);
- --swatch-9-line: oklch(88.5% 0.08 173.01);
- --swatch-10-mark: oklch(64.17% 0.1031 203.01);
- --swatch-10-surface: oklch(96.2% 0.0232 203.01);
- --swatch-10-ink: oklch(53.12% 0.0891 203.01);
- --swatch-10-line: oklch(88.5% 0.0781 203.01);
- --swatch-11-mark: oklch(64.65% 0.1261 233.01);
- --swatch-11-surface: oklch(96.2% 0.012 233.01);
- --swatch-11-ink: oklch(53.34% 0.109 233.01);
- --swatch-11-line: oklch(88.5% 0.0407 233.01);
- --swatch-12-mark: oklch(65.8% 0.17 263.01);
- --swatch-12-surface: oklch(96.2% 0.0099 263.01);
- --swatch-12-ink: oklch(54.51% 0.17 263.01);
- --swatch-12-line: oklch(88.5% 0.0336 263.01);
- --swatch-1-on: oklch(18% 0.05 293.01);
- --swatch-2-on: oklch(18% 0.05 323.01);
- --swatch-3-on: oklch(18% 0.05 353.01);
- --swatch-4-on: oklch(18% 0.05 23.01);
- --swatch-5-on: oklch(18% 0.05 53.01);
- --swatch-6-on: oklch(18% 0.05 83.01);
- --swatch-7-on: oklch(18% 0.05 113.01);
- --swatch-8-on: oklch(18% 0.05 143.01);
- --swatch-9-on: oklch(18% 0.05 173.01);
- --swatch-10-on: oklch(18% 0.05 203.01);
- --swatch-11-on: oklch(18% 0.05 233.01);
- --swatch-12-on: oklch(18% 0.05 263.01);
+ --swatch-1-mark: oklch(55.8% 0.288 302.32);
+ --swatch-1-surface: oklch(94.6% 0.033 307.17);
+ --swatch-1-ink: oklch(49.6% 0.265 301.92);
+ --swatch-1-line: oklch(90.2% 0.063 306.7);
+ --swatch-2-mark: oklch(59.1% 0.293 322.9);
+ --swatch-2-surface: oklch(95.2% 0.037 318.85);
+ --swatch-2-ink: oklch(51.8% 0.253 323.95);
+ --swatch-2-line: oklch(90.3% 0.076 319.62);
+ --swatch-3-mark: oklch(59.2% 0.249 0.58);
+ --swatch-3-surface: oklch(94.8% 0.028 342.26);
+ --swatch-3-ink: oklch(52.5% 0.223 3.96);
+ --swatch-3-line: oklch(89.9% 0.061 343.23);
+ --swatch-4-mark: oklch(57.7% 0.245 27.33);
+ --swatch-4-surface: oklch(93.6% 0.032 17.72);
+ --swatch-4-ink: oklch(50.5% 0.213 27.52);
+ --swatch-4-line: oklch(88.5% 0.062 18.33);
+ --swatch-5-mark: oklch(70.5% 0.213 47.6);
+ --swatch-5-surface: oklch(95.4% 0.038 75.16);
+ --swatch-5-ink: oklch(54.3% 0.195 38.4);
+ --swatch-5-line: oklch(90.1% 0.076 70.7);
+ --swatch-6-mark: oklch(79.5% 0.184 86.05);
+ --swatch-6-surface: oklch(97.3% 0.071 103.19);
+ --swatch-6-ink: oklch(52.9% 0.135 66.44);
+ --swatch-6-line: oklch(94.5% 0.129 101.54);
+ --swatch-7-mark: oklch(76.8% 0.233 130.85);
+ --swatch-7-surface: oklch(96.7% 0.067 122.33);
+ --swatch-7-ink: oklch(50.7% 0.157 131.59);
+ --swatch-7-line: oklch(93.8% 0.127 124.32);
+ --swatch-8-mark: oklch(72.3% 0.219 149.58);
+ --swatch-8-surface: oklch(96.2% 0.044 156.74);
+ --swatch-8-ink: oklch(50.2% 0.154 150.07);
+ --swatch-8-line: oklch(92.5% 0.084 156);
+ --swatch-9-mark: oklch(69.6% 0.17 162.48);
+ --swatch-9-surface: oklch(95% 0.052 163.05);
+ --swatch-9-ink: oklch(50.3% 0.118 165.61);
+ --swatch-9-line: oklch(90.5% 0.093 164.15);
+ --swatch-10-mark: oklch(71.5% 0.143 215.22);
+ --swatch-10-surface: oklch(95.6% 0.045 203.39);
+ --swatch-10-ink: oklch(51% 0.105 223.13);
+ --swatch-10-line: oklch(91.7% 0.08 205.04);
+ --swatch-11-mark: oklch(54.6% 0.245 262.88);
+ --swatch-11-surface: oklch(93.2% 0.032 255.59);
+ --swatch-11-ink: oklch(48.8% 0.243 264.38);
+ --swatch-11-line: oklch(88.2% 0.059 254.13);
+ --swatch-12-mark: oklch(58.5% 0.233 277.12);
+ --swatch-12-surface: oklch(93% 0.034 272.79);
+ --swatch-12-ink: oklch(45.7% 0.24 277.02);
+ --swatch-12-line: oklch(87% 0.065 274.04);
+ --swatch-1-on: #ffffff;
+ --swatch-2-on: #ffffff;
+ --swatch-3-on: #ffffff;
+ --swatch-4-on: #ffffff;
+ --swatch-5-on: oklch(26.6% 0.079 36.26);
+ --swatch-6-on: oklch(28.6% 0.066 53.81);
+ --swatch-7-on: oklch(27.4% 0.072 132.11);
+ --swatch-8-on: oklch(26.6% 0.065 152.93);
+ --swatch-9-on: oklch(26.2% 0.051 172.55);
+ --swatch-10-on: oklch(30.2% 0.056 229.7);
+ --swatch-11-on: #ffffff;
+ --swatch-12-on: #ffffff;
--chart-1: var(--swatch-1-mark);
--chart-2: var(--swatch-5-mark);
--chart-3: var(--swatch-9-mark);
@@ -688,143 +675,140 @@
}
[data-theme='dark'] {
- --brand-cs: clamp(0, var(--brand-c), 1);
- --danger-cs: clamp(0, var(--danger-c), 1);
- --warning-cs: clamp(0, var(--warning-c), 1);
- --success-cs: clamp(0, var(--success-c), 1);
-
- --gray-1: oklch(11% calc(0.01 * var(--brand-cs)) var(--brand-h));
- --gray-2: oklch(16.2% calc(0.012 * var(--brand-cs)) var(--brand-h));
- --gray-3: oklch(19.5% calc(0.014 * var(--brand-cs)) var(--brand-h));
- --gray-4: oklch(23.5% calc(0.015 * var(--brand-cs)) var(--brand-h));
- --gray-5: oklch(27.5% calc(0.016 * var(--brand-cs)) var(--brand-h));
- --gray-6: oklch(32% calc(0.017 * var(--brand-cs)) var(--brand-h));
- --gray-7: oklch(39% calc(0.019 * var(--brand-cs)) var(--brand-h));
- --gray-8: oklch(50% calc(0.026 * var(--brand-cs)) var(--brand-h));
- --gray-9: oklch(60% calc(0.034 * var(--brand-cs)) var(--brand-h));
- --gray-10: oklch(66% calc(0.032 * var(--brand-cs)) var(--brand-h));
- --gray-11: oklch(84.8% calc(0.021 * var(--brand-cs)) var(--brand-h));
- --gray-12: oklch(97% calc(0.006 * var(--brand-cs)) var(--brand-h));
-
- --accent-1: oklch(11% calc(0.016 * var(--brand-cs)) var(--brand-h));
- --accent-2: oklch(16% calc(0.028 * var(--brand-cs)) var(--brand-h));
- --accent-3: oklch(20% calc(0.042 * var(--brand-cs)) var(--brand-h));
- --accent-4: oklch(24% calc(0.055 * var(--brand-cs)) var(--brand-h));
- --accent-5: oklch(28% calc(0.066 * var(--brand-cs)) var(--brand-h));
- --accent-6: oklch(33% calc(0.078 * var(--brand-cs)) var(--brand-h));
- --accent-7: oklch(40% calc(0.098 * var(--brand-cs)) var(--brand-h));
- --accent-8: oklch(55% calc(0.16 * var(--brand-cs)) var(--brand-h));
- --accent-10: oklch(54% calc(0.215 * var(--brand-cs)) var(--brand-h));
- --accent-11: oklch(86% calc(0.0692 * var(--brand-cs)) var(--brand-h));
- --accent-12: oklch(96% calc(0.0191 * var(--brand-cs)) var(--brand-h));
-
- --success-1: oklch(11% calc(0.016 * var(--success-cs)) var(--success-h));
- --success-2: oklch(16% calc(0.028 * var(--success-cs)) var(--success-h));
- --success-3: oklch(20% calc(0.042 * var(--success-cs)) var(--success-h));
- --success-4: oklch(24% calc(0.055 * var(--success-cs)) var(--success-h));
- --success-5: oklch(28% calc(0.066 * var(--success-cs)) var(--success-h));
- --success-6: oklch(33% calc(0.078 * var(--success-cs)) var(--success-h));
- --success-7: oklch(40% calc(0.098 * var(--success-cs)) var(--success-h));
- --success-8: oklch(55% calc(0.11 * var(--success-cs)) var(--success-h));
- --success-9: var(--success-seed, oklch(58% calc(0.135 * var(--success-cs)) var(--success-h)));
- --success-10: oklch(64% calc(0.13 * var(--success-cs)) var(--success-h));
- --success-11: oklch(80% calc(0.15 * var(--success-cs)) var(--success-h));
- --success-12: oklch(95% calc(0.04 * var(--success-cs)) var(--success-h));
-
- --warning-1: oklch(11% calc(0.016 * var(--warning-cs)) var(--warning-h));
- --warning-2: oklch(16% calc(0.028 * var(--warning-cs)) var(--warning-h));
- --warning-3: oklch(20% calc(0.042 * var(--warning-cs)) var(--warning-h));
- --warning-4: oklch(24% calc(0.0527 * var(--warning-cs)) var(--warning-h));
- --warning-5: oklch(28% calc(0.0592 * var(--warning-cs)) var(--warning-h));
- --warning-6: oklch(33% calc(0.0681 * var(--warning-cs)) var(--warning-h));
- --warning-7: oklch(40% calc(0.0811 * var(--warning-cs)) var(--warning-h));
- --warning-8: oklch(60% calc(0.1198 * var(--warning-cs)) var(--warning-h));
- --warning-9: var(--warning-seed, oklch(80% calc(0.1591 * var(--warning-cs)) var(--warning-h)));
- --warning-10: oklch(85% calc(0.1217 * var(--warning-cs)) var(--warning-h));
- --warning-11: oklch(88% calc(0.0956 * var(--warning-cs)) var(--warning-h));
- --warning-12: oklch(95% calc(0.0383 * var(--warning-cs)) var(--warning-h));
-
- --danger-1: oklch(11% calc(0.016 * var(--danger-cs)) var(--danger-h));
- --danger-2: oklch(16% calc(0.028 * var(--danger-cs)) var(--danger-h));
- --danger-3: oklch(20% calc(0.042 * var(--danger-cs)) var(--danger-h));
- --danger-4: oklch(24% calc(0.055 * var(--danger-cs)) var(--danger-h));
- --danger-5: oklch(28% calc(0.066 * var(--danger-cs)) var(--danger-h));
- --danger-6: oklch(33% calc(0.078 * var(--danger-cs)) var(--danger-h));
- --danger-7: oklch(40% calc(0.098 * var(--danger-cs)) var(--danger-h));
- --danger-8: oklch(55% calc(0.155 * var(--danger-cs)) var(--danger-h));
- --danger-9: var(--danger-seed, oklch(56% calc(0.2 * var(--danger-cs)) var(--danger-h)));
- --danger-10: oklch(62% calc(0.192 * var(--danger-cs)) var(--danger-h));
- --danger-11: oklch(72% calc(0.17 * var(--danger-cs)) var(--danger-h));
- --danger-12: oklch(95% calc(0.0235 * var(--danger-cs)) var(--danger-h));
+
+ --gray-1: oklch(11% 0 0);
+ --gray-2: oklch(16.2% 0 0);
+ --gray-3: oklch(19.5% 0 0);
+ --gray-4: oklch(23.5% 0 0);
+ --gray-5: oklch(27.5% 0 0);
+ --gray-6: oklch(32% 0 0);
+ --gray-7: oklch(39% 0 0);
+ --gray-8: oklch(50% 0 0);
+ --gray-9: oklch(60% 0 0);
+ --gray-10: oklch(66% 0 0);
+ --gray-11: oklch(84.8% 0 0);
+ --gray-12: oklch(97% 0 0);
+
+ --accent-1: var(--accent-dark-1, oklch(14% 0.04 286.94));
+ --accent-2: var(--accent-dark-2, oklch(17% 0.0571 286.94));
+ --accent-3: var(--accent-dark-3, oklch(20.5% 0.0685 286.94));
+ --accent-4: var(--accent-dark-4, oklch(24% 0.0995 289.6));
+ --accent-5: var(--accent-dark-5, oklch(27.5% 0.1072 289.6));
+ --accent-6: var(--accent-dark-6, oklch(31% 0.1353 288.61));
+ --accent-7: var(--accent-dark-7, oklch(38% 0.141 288.61));
+ --accent-8: var(--accent-dark-8, oklch(47% 0.175 288.43));
+ --accent-9: var(--accent-dark-9, #6e41e2);
+ --accent-10: var(--accent-dark-10, oklch(70.2% 0.1482 289.39));
+ --accent-11: var(--accent-dark-11, oklch(81.1% 0.0899 289.42));
+ --accent-12: var(--accent-dark-12, oklch(94.3% 0.0235 290.44));
+
+ --success-1: var(--success-dark-1, oklch(14% 0.0228 152.93));
+ --success-2: var(--success-dark-2, oklch(17% 0.0325 152.93));
+ --success-3: var(--success-dark-3, oklch(20.5% 0.039 152.93));
+ --success-4: var(--success-dark-4, oklch(24% 0.0618 152.53));
+ --success-5: var(--success-dark-5, oklch(27.5% 0.0665 152.53));
+ --success-6: var(--success-dark-6, oklch(31% 0.0857 151.33));
+ --success-7: var(--success-dark-7, oklch(38% 0.0893 151.33));
+ --success-8: var(--success-dark-8, oklch(47% 0.1232 150.07));
+ --success-9: var(--success-dark-9, #00a63e);
+ --success-10: var(--success-dark-10, oklch(79.2% 0.209 151.71));
+ --success-11: var(--success-dark-11, oklch(87.1% 0.15 154.45));
+ --success-12: var(--success-dark-12, oklch(96.2% 0.044 156.74));
+
+ --warning-1: var(--warning-dark-1, oklch(14% 0.027 45.63));
+ --warning-2: var(--warning-dark-2, oklch(17% 0.0385 45.63));
+ --warning-3: var(--warning-dark-3, oklch(20.5% 0.0462 45.63));
+ --warning-4: var(--warning-dark-4, oklch(24% 0.0728 45.9));
+ --warning-5: var(--warning-dark-5, oklch(27.5% 0.0784 45.9));
+ --warning-6: var(--warning-dark-6, oklch(31% 0.0986 46.2));
+ --warning-7: var(--warning-dark-7, oklch(38% 0.1028 46.2));
+ --warning-8: var(--warning-dark-8, oklch(47% 0.1304 49));
+ --warning-9: var(--warning-dark-9, #fe9a00);
+ --warning-10: var(--warning-dark-10, oklch(82.8% 0.189 84.43));
+ --warning-11: var(--warning-dark-11, oklch(87.9% 0.169 91.61));
+ --warning-12: var(--warning-dark-12, oklch(96.2% 0.059 95.62));
+
+ --danger-1: var(--danger-dark-1, oklch(14% 0.0322 26.04));
+ --danger-2: var(--danger-dark-2, oklch(17% 0.046 26.04));
+ --danger-3: var(--danger-dark-3, oklch(20.5% 0.0552 26.04));
+ --danger-4: var(--danger-dark-4, oklch(24% 0.0917 25.72));
+ --danger-5: var(--danger-dark-5, oklch(27.5% 0.0987 25.72));
+ --danger-6: var(--danger-dark-6, oklch(31% 0.1274 26.9));
+ --danger-7: var(--danger-dark-7, oklch(38% 0.1327 26.9));
+ --danger-8: var(--danger-dark-8, oklch(47% 0.1704 27.52));
+ --danger-9: var(--danger-dark-9, #e7000b);
+ --danger-10: var(--danger-dark-10, oklch(70.4% 0.191 22.22));
+ --danger-11: var(--danger-dark-11, oklch(80.8% 0.114 19.57));
+ --danger-12: var(--danger-dark-12, oklch(93.6% 0.032 17.72));
--panel: var(--gray-2);
- --on-success: var(--on-success-seed, oklch(18% 0.06 150));
- --on-warning: var(--on-warning-seed, oklch(18% 0.06 75));
- --on-danger: var(--on-danger-seed, oklch(98% 0.01 25));
+ --on-success: var(--on-success-seed, #000000);
+ --on-warning: var(--on-warning-seed, #000000);
+ --on-danger: var(--on-danger-seed, #ffffff);
--scrim: oklch(0% 0 0 / 70%);
color-scheme: dark;
- --swatch-1-mark: oklch(70% 0.1633 293.01);
- --swatch-1-surface: oklch(21% 0.055 293.01);
- --swatch-1-ink: oklch(80% 0.1045 293.01);
- --swatch-1-line: oklch(36% 0.09 293.01);
- --swatch-2-mark: oklch(70% 0.17 323.01);
- --swatch-2-surface: oklch(21% 0.055 323.01);
- --swatch-2-ink: oklch(80% 0.1669 323.01);
- --swatch-2-line: oklch(36% 0.09 323.01);
- --swatch-3-mark: oklch(70% 0.17 353.01);
- --swatch-3-surface: oklch(21% 0.055 353.01);
- --swatch-3-ink: oklch(80% 0.1246 353.01);
- --swatch-3-line: oklch(36% 0.09 353.01);
- --swatch-4-mark: oklch(70% 0.17 23.01);
- --swatch-4-surface: oklch(21% 0.055 23.01);
- --swatch-4-ink: oklch(80% 0.1077 23.01);
- --swatch-4-line: oklch(36% 0.09 23.01);
- --swatch-5-mark: oklch(70% 0.1677 53.01);
- --swatch-5-surface: oklch(21% 0.0467 53.01);
- --swatch-5-ink: oklch(80% 0.1226 53.01);
- --swatch-5-line: oklch(36% 0.066 53.01);
- --swatch-6-mark: oklch(70% 0.1359 83.01);
- --swatch-6-surface: oklch(21% 0.0377 83.01);
- --swatch-6-ink: oklch(80% 0.1551 83.01);
- --swatch-6-line: oklch(36% 0.0534 83.01);
- --swatch-7-mark: oklch(70% 0.1473 113.01);
- --swatch-7-surface: oklch(21% 0.0407 113.01);
- --swatch-7-ink: oklch(80% 0.1682 113.01);
- --swatch-7-line: oklch(36% 0.0579 113.01);
- --swatch-8-mark: oklch(70% 0.17 143.01);
- --swatch-8-surface: oklch(21% 0.055 143.01);
- --swatch-8-ink: oklch(80% 0.17 143.01);
- --swatch-8-line: oklch(36% 0.0863 143.01);
- --swatch-9-mark: oklch(70% 0.1267 173.01);
- --swatch-9-surface: oklch(21% 0.0337 173.01);
- --swatch-9-ink: oklch(80% 0.1447 173.01);
- --swatch-9-line: oklch(36% 0.0495 173.01);
- --swatch-10-mark: oklch(70% 0.1124 203.01);
- --swatch-10-surface: oklch(21% 0.03 203.01);
- --swatch-10-ink: oklch(80% 0.1283 203.01);
- --swatch-10-line: oklch(36% 0.0439 203.01);
- --swatch-11-mark: oklch(70% 0.1364 233.01);
- --swatch-11-surface: oklch(21% 0.0366 233.01);
- --swatch-11-ink: oklch(80% 0.1142 233.01);
- --swatch-11-line: oklch(36% 0.0533 233.01);
- --swatch-12-mark: oklch(70% 0.1474 263.01);
- --swatch-12-surface: oklch(21% 0.055 263.01);
- --swatch-12-ink: oklch(80% 0.0945 263.01);
- --swatch-12-line: oklch(36% 0.09 263.01);
- --swatch-1-on: oklch(18% 0.05 293.01);
- --swatch-2-on: oklch(18% 0.05 323.01);
- --swatch-3-on: oklch(18% 0.05 353.01);
- --swatch-4-on: oklch(18% 0.05 23.01);
- --swatch-5-on: oklch(18% 0.05 53.01);
- --swatch-6-on: oklch(18% 0.05 83.01);
- --swatch-7-on: oklch(18% 0.05 113.01);
- --swatch-8-on: oklch(18% 0.05 143.01);
- --swatch-9-on: oklch(18% 0.05 173.01);
- --swatch-10-on: oklch(18% 0.05 203.01);
- --swatch-11-on: oklch(18% 0.05 233.01);
- --swatch-12-on: oklch(18% 0.05 263.01);
+ --swatch-1-mark: oklch(71.4% 0.1726 305.5);
+ --swatch-1-surface: oklch(20.5% 0.0894 302.72);
+ --swatch-1-ink: oklch(82.7% 0.119 306.38);
+ --swatch-1-line: oklch(38% 0.1635 303.72);
+ --swatch-2-mark: oklch(74% 0.2023 322.16);
+ --swatch-2-surface: oklch(20.5% 0.0816 325.66);
+ --swatch-2-ink: oklch(83.3% 0.145 321.43);
+ --swatch-2-line: oklch(38% 0.1583 324.59);
+ --swatch-3-mark: oklch(71.8% 0.1717 349.76);
+ --swatch-3-surface: oklch(20.5% 0.0654 3.91);
+ --swatch-3-ink: oklch(82.3% 0.12 346.02);
+ --swatch-3-line: oklch(38% 0.1402 3.81);
+ --swatch-4-mark: oklch(70.4% 0.1624 22.22);
+ --swatch-4-surface: oklch(20.5% 0.0552 26.04);
+ --swatch-4-ink: oklch(80.8% 0.114 19.57);
+ --swatch-4-line: oklch(38% 0.1327 26.9);
+ --swatch-5-mark: oklch(70.5% 0.1811 47.6);
+ --swatch-5-surface: oklch(20.5% 0.0474 36.26);
+ --swatch-5-ink: oklch(83.7% 0.128 66.29);
+ --swatch-5-line: oklch(38% 0.1178 37.3);
+ --swatch-6-mark: oklch(79.5% 0.1564 86.05);
+ --swatch-6-surface: oklch(20.5% 0.0396 53.81);
+ --swatch-6-ink: oklch(90.5% 0.182 98.11);
+ --swatch-6-line: oklch(38% 0.0855 61.91);
+ --swatch-7-mark: oklch(76.8% 0.1981 130.85);
+ --swatch-7-surface: oklch(20.5% 0.0432 132.11);
+ --swatch-7-ink: oklch(89.7% 0.196 126.67);
+ --swatch-7-line: oklch(38% 0.093 130.93);
+ --swatch-8-mark: oklch(72.3% 0.1861 149.58);
+ --swatch-8-surface: oklch(20.5% 0.039 152.93);
+ --swatch-8-ink: oklch(87.1% 0.15 154.45);
+ --swatch-8-line: oklch(38% 0.0893 151.33);
+ --swatch-9-mark: oklch(69.6% 0.1445 162.48);
+ --swatch-9-surface: oklch(20.5% 0.0306 172.55);
+ --swatch-9-ink: oklch(84.5% 0.143 164.98);
+ --swatch-9-line: oklch(38% 0.0713 166.91);
+ --swatch-10-mark: oklch(71.5% 0.1216 215.22);
+ --swatch-10-surface: oklch(20.5% 0.0336 229.69);
+ --swatch-10-ink: oklch(86.5% 0.127 207.08);
+ --swatch-10-line: oklch(38% 0.0638 224.28);
+ --swatch-11-mark: oklch(70.7% 0.1403 254.62);
+ --swatch-11-surface: oklch(20.5% 0.0546 267.93);
+ --swatch-11-ink: oklch(80.9% 0.105 251.81);
+ --swatch-11-line: oklch(38% 0.1493 265.64);
+ --swatch-12-mark: oklch(67.3% 0.1547 276.94);
+ --swatch-12-surface: oklch(20.5% 0.054 281.29);
+ --swatch-12-ink: oklch(78.5% 0.115 274.71);
+ --swatch-12-line: oklch(38% 0.1463 277.37);
+ --swatch-1-on: oklch(29.1% 0.149 302.72);
+ --swatch-2-on: oklch(29.3% 0.136 325.66);
+ --swatch-3-on: oklch(28.4% 0.109 3.91);
+ --swatch-4-on: oklch(25.8% 0.092 26.04);
+ --swatch-5-on: oklch(26.6% 0.079 36.26);
+ --swatch-6-on: oklch(28.6% 0.066 53.81);
+ --swatch-7-on: oklch(27.4% 0.072 132.11);
+ --swatch-8-on: oklch(26.6% 0.065 152.93);
+ --swatch-9-on: oklch(26.2% 0.051 172.55);
+ --swatch-10-on: oklch(30.2% 0.056 229.7);
+ --swatch-11-on: oklch(28.2% 0.091 267.94);
+ --swatch-12-on: oklch(25.7% 0.09 281.29);
--chart-1: var(--swatch-1-mark);
--chart-2: var(--swatch-5-mark);
--chart-3: var(--swatch-9-mark);
@@ -845,135 +829,6 @@
--lift: 0 0 0 1px var(--cast-10), 0 8px 16px -6px oklch(0% 0 0 / 40%);
--over: 0 0 0 1px var(--cast-10), 0 16px 32px -12px oklch(0% 0 0 / 55%);
}
-
- @media (color-gamut: p3) {
- :root,
- [data-theme='light'] {
- --swatch-1-mark: oklch(66.81% 0.17 293.01);
- --swatch-1-surface: oklch(96.2% 0.0121 293.01);
- --swatch-1-ink: oklch(55.5% 0.17 293.01);
- --swatch-1-line: oklch(88.5% 0.0409 293.01);
- --swatch-1-on: oklch(18% 0.05 293.01);
- --swatch-2-mark: oklch(67.35% 0.17 323.01);
- --swatch-2-surface: oklch(96.2% 0.0194 323.01);
- --swatch-2-ink: oklch(55.8% 0.17 323.01);
- --swatch-2-line: oklch(88.5% 0.0656 323.01);
- --swatch-2-on: oklch(18% 0.05 323.01);
- --swatch-3-mark: oklch(67.5% 0.17 353.01);
- --swatch-3-surface: oklch(96.2% 0.0158 353.01);
- --swatch-3-ink: oklch(55.92% 0.17 353.01);
- --swatch-3-line: oklch(88.5% 0.0554 353.01);
- --swatch-3-on: oklch(18% 0.05 353.01);
- --swatch-4-mark: oklch(67.31% 0.17 23.01);
- --swatch-4-surface: oklch(96.2% 0.0135 23.01);
- --swatch-4-ink: oklch(55.83% 0.17 23.01);
- --swatch-4-line: oklch(88.5% 0.0473 23.01);
- --swatch-4-on: oklch(18% 0.05 23.01);
- --swatch-5-mark: oklch(66.73% 0.17 53.01);
- --swatch-5-surface: oklch(96.2% 0.0154 53.01);
- --swatch-5-ink: oklch(55.08% 0.1578 53.01);
- --swatch-5-line: oklch(88.5% 0.0535 53.01);
- --swatch-5-on: oklch(18% 0.05 53.01);
- --swatch-6-mark: oklch(65.57% 0.1468 83.01);
- --swatch-6-surface: oklch(96.2% 0.0259 83.01);
- --swatch-6-ink: oklch(54.03% 0.1269 83.01);
- --swatch-6-line: oklch(88.5% 0.08 83.01);
- --swatch-6-on: oklch(18% 0.05 83.01);
- --swatch-7-mark: oklch(64.54% 0.1582 113.01);
- --swatch-7-surface: oklch(96.2% 0.05 113.01);
- --swatch-7-ink: oklch(53.44% 0.1368 113.01);
- --swatch-7-line: oklch(88.5% 0.08 113.01);
- --swatch-7-on: oklch(18% 0.05 113.01);
- --swatch-8-mark: oklch(63.61% 0.17 143.01);
- --swatch-8-surface: oklch(96.2% 0.0416 143.01);
- --swatch-8-ink: oklch(52.54% 0.17 143.01);
- --swatch-8-line: oklch(88.5% 0.08 143.01);
- --swatch-8-on: oklch(18% 0.05 143.01);
- --swatch-9-mark: oklch(62.27% 0.1537 173.01);
- --swatch-9-surface: oklch(96.2% 0.0338 173.01);
- --swatch-9-ink: oklch(51.47% 0.1328 173.01);
- --swatch-9-line: oklch(88.5% 0.08 173.01);
- --swatch-9-on: oklch(18% 0.05 173.01);
- --swatch-10-mark: oklch(62.84% 0.1352 203.01);
- --swatch-10-surface: oklch(96.2% 0.0251 203.01);
- --swatch-10-ink: oklch(51.77% 0.1168 203.01);
- --swatch-10-line: oklch(88.5% 0.08 203.01);
- --swatch-10-on: oklch(18% 0.05 203.01);
- --swatch-11-mark: oklch(63.66% 0.1632 233.01);
- --swatch-11-surface: oklch(96.2% 0.0132 233.01);
- --swatch-11-ink: oklch(52.38% 0.141 233.01);
- --swatch-11-line: oklch(88.5% 0.0444 233.01);
- --swatch-11-on: oklch(18% 0.05 233.01);
- --swatch-12-mark: oklch(65.8% 0.17 263.01);
- --swatch-12-surface: oklch(96.2% 0.0109 263.01);
- --swatch-12-ink: oklch(54.51% 0.17 263.01);
- --swatch-12-line: oklch(88.5% 0.0368 263.01);
- --swatch-12-on: oklch(18% 0.05 263.01);
- }
-
- [data-theme='dark'] {
- --swatch-1-mark: oklch(70% 0.17 293.01);
- --swatch-1-surface: oklch(21% 0.055 293.01);
- --swatch-1-ink: oklch(80% 0.1145 293.01);
- --swatch-1-line: oklch(36% 0.09 293.01);
- --swatch-1-on: oklch(18% 0.05 293.01);
- --swatch-2-mark: oklch(70% 0.17 323.01);
- --swatch-2-surface: oklch(21% 0.055 323.01);
- --swatch-2-ink: oklch(80% 0.17 323.01);
- --swatch-2-line: oklch(36% 0.09 323.01);
- --swatch-2-on: oklch(18% 0.05 323.01);
- --swatch-3-mark: oklch(70% 0.17 353.01);
- --swatch-3-surface: oklch(21% 0.055 353.01);
- --swatch-3-ink: oklch(80% 0.1633 353.01);
- --swatch-3-line: oklch(36% 0.09 353.01);
- --swatch-3-on: oklch(18% 0.05 353.01);
- --swatch-4-mark: oklch(70% 0.17 23.01);
- --swatch-4-surface: oklch(21% 0.055 23.01);
- --swatch-4-ink: oklch(80% 0.1387 23.01);
- --swatch-4-line: oklch(36% 0.09 23.01);
- --swatch-4-on: oklch(18% 0.05 23.01);
- --swatch-5-mark: oklch(70% 0.17 53.01);
- --swatch-5-surface: oklch(21% 0.0539 53.01);
- --swatch-5-ink: oklch(80% 0.1556 53.01);
- --swatch-5-line: oklch(36% 0.0753 53.01);
- --swatch-5-on: oklch(18% 0.05 53.01);
- --swatch-6-mark: oklch(70% 0.1566 83.01);
- --swatch-6-surface: oklch(21% 0.044 83.01);
- --swatch-6-ink: oklch(80% 0.17 83.01);
- --swatch-6-line: oklch(36% 0.0617 83.01);
- --swatch-6-on: oklch(18% 0.05 83.01);
- --swatch-7-mark: oklch(70% 0.17 113.01);
- --swatch-7-surface: oklch(21% 0.0479 113.01);
- --swatch-7-ink: oklch(80% 0.17 113.01);
- --swatch-7-line: oklch(36% 0.0675 113.01);
- --swatch-7-on: oklch(18% 0.05 113.01);
- --swatch-8-mark: oklch(70% 0.17 143.01);
- --swatch-8-surface: oklch(21% 0.055 143.01);
- --swatch-8-ink: oklch(80% 0.17 143.01);
- --swatch-8-line: oklch(36% 0.09 143.01);
- --swatch-8-on: oklch(18% 0.05 143.01);
- --swatch-9-mark: oklch(70% 0.17 173.01);
- --swatch-9-surface: oklch(21% 0.046 173.01);
- --swatch-9-ink: oklch(80% 0.17 173.01);
- --swatch-9-line: oklch(36% 0.0674 173.01);
- --swatch-9-on: oklch(18% 0.05 173.01);
- --swatch-10-mark: oklch(70% 0.1504 203.01);
- --swatch-10-surface: oklch(21% 0.0402 203.01);
- --swatch-10-ink: oklch(80% 0.17 203.01);
- --swatch-10-line: oklch(36% 0.0588 203.01);
- --swatch-10-on: oklch(18% 0.05 203.01);
- --swatch-11-mark: oklch(70% 0.17 233.01);
- --swatch-11-surface: oklch(21% 0.0483 233.01);
- --swatch-11-ink: oklch(80% 0.124 233.01);
- --swatch-11-line: oklch(36% 0.0701 233.01);
- --swatch-11-on: oklch(18% 0.05 233.01);
- --swatch-12-mark: oklch(70% 0.1596 263.01);
- --swatch-12-surface: oklch(21% 0.055 263.01);
- --swatch-12-ink: oklch(80% 0.1031 263.01);
- --swatch-12-line: oklch(36% 0.09 263.01);
- --swatch-12-on: oklch(18% 0.05 263.01);
- }
- }
}
@layer base {
diff --git a/packages/web/test/app/routes/platform/setup/general/appearance-section.test.tsx b/packages/web/test/app/routes/platform/setup/general/appearance-section.test.tsx
index f6937964e53..1bdeab106d8 100644
--- a/packages/web/test/app/routes/platform/setup/general/appearance-section.test.tsx
+++ b/packages/web/test/app/routes/platform/setup/general/appearance-section.test.tsx
@@ -266,7 +266,7 @@ describe('AppearanceSection', () => {
await render();
await type({ selector: 'input[aria-label="colour"]', value: '#0ea5e9' });
const accent = () =>
- document.documentElement.style.getPropertyValue('--accent-9');
+ document.documentElement.style.getPropertyValue('--accent-light-9');
expect(accent()).toBe('#0ea5e9');
await act(async () => {
buttonNamed({ name: 'Cancel' }).click();
@@ -279,9 +279,9 @@ describe('AppearanceSection', () => {
await render();
expect(colourInputs().map((input) => input.value)).toEqual([
'#6e41e2',
- '#c11825',
- '#f9ad28',
- '#33ac5a',
+ '#e7000b',
+ '#fe9a00',
+ '#00a63e',
]);
expect(container.querySelector('input[type="checkbox"]')).toBeNull();
const resets = resetButtons();
@@ -376,7 +376,7 @@ describe('AppearanceSection', () => {
setInputValue({ input: colourInputs()[3], value: '#16a34a' });
});
const seed = () =>
- document.documentElement.style.getPropertyValue('--success-seed');
+ document.documentElement.style.getPropertyValue('--success-light-9');
expect(seed()).toBe('#16a34a');
await act(async () => {
buttonNamed({ name: 'Cancel' }).click();
diff --git a/packages/web/test/components/custom/logo-plate.test.tsx b/packages/web/test/components/custom/logo-plate.test.tsx
new file mode 100644
index 00000000000..17cd1f48291
--- /dev/null
+++ b/packages/web/test/components/custom/logo-plate.test.tsx
@@ -0,0 +1,128 @@
+/**
+ * @vitest-environment jsdom
+ */
+/* eslint-disable testing-library/no-unnecessary-act */
+import { act } from 'react';
+import { createRoot, type Root } from 'react-dom/client';
+import { afterEach, describe, expect, it } from 'vitest';
+
+import { LogoPlate, LogoPlateProps } from '@/components/custom/logo-plate';
+import { logoTint } from '@/lib/logo-tint';
+
+const SRC = 'https://cdn.example.com/slack.png';
+
+let container: HTMLDivElement;
+let root: Root;
+
+function render(props: LogoPlateProps) {
+ container = document.createElement('div');
+ document.body.appendChild(container);
+ root = createRoot(container);
+ act(() => {
+ root.render(<LogoPlate {...props} />);
+ });
+ return container;
+}
+
+function pixels({
+ colours,
+}: {
+ colours: Array<{ rgba: [number, number, number, number]; count: number }>;
+}): Uint8ClampedArray {
+ return new Uint8ClampedArray(
+ colours.flatMap(({ rgba, count }) =>
+ Array.from({ length: count }, () => rgba).flat(),
+ ),
+ );
+}
+
+function hueOf({ tint }: { tint: string | null }): number {
+ const match = tint?.match(/oklch\(([\d.]+)% ([\d.]+) ([\d.]+)\)/);
+ if (!match) {
+ throw new Error(`not an oklch tint: ${tint}`);
+ }
+ return Number(match[3]);
+}
+
+describe('LogoPlate', () => {
+ afterEach(() => {
+ act(() => {
+ root.unmount();
+ });
+ container.remove();
+ });
+
+ it('renders one logo and no tint by default', () => {
+ render({ src: SRC, alt: 'Slack' });
+ expect(container.querySelectorAll('img')).toHaveLength(1);
+ expect(container.firstElementChild?.getAttribute('style')).toBeNull();
+ });
+
+ it('never adds a second image when tinted', () => {
+ render({ src: SRC, alt: 'Slack', tint: true });
+ expect(container.querySelectorAll('img')).toHaveLength(1);
+ });
+});
+
+describe('logo tint', () => {
+ it('gives black, grey and white logos no tint', () => {
+ const tint = logoTint.tintFromPixels({
+ pixels: pixels({
+ colours: [
+ { rgba: [0, 0, 0, 255], count: 40 },
+ { rgba: [128, 128, 128, 255], count: 40 },
+ { rgba: [255, 255, 255, 255], count: 40 },
+ ],
+ }),
+ });
+ expect(tint).toBeNull();
+ });
+
+ it('takes the hue of the coloured pixels, ignoring white and transparent ones', () => {
+ const tint = logoTint.tintFromPixels({
+ pixels: pixels({
+ colours: [
+ { rgba: [255, 255, 255, 255], count: 60 },
+ { rgba: [0, 0, 0, 0], count: 200 },
+ { rgba: [37, 99, 235, 255], count: 20 },
+ ],
+ }),
+ });
+ expect(hueOf({ tint })).toBeGreaterThan(255);
+ expect(hueOf({ tint })).toBeLessThan(270);
+ });
+
+ it('tints a dark but colourful logo', () => {
+ const tint = logoTint.tintFromPixels({
+ pixels: pixels({
+ colours: [
+ { rgba: [74, 21, 75, 255], count: 30 },
+ { rgba: [30, 30, 30, 255], count: 30 },
+ ],
+ }),
+ });
+ expect(tint).not.toBeNull();
+ });
+
+ it('ignores a speck of colour on a mostly neutral logo', () => {
+ const tint = logoTint.tintFromPixels({
+ pixels: pixels({
+ colours: [
+ { rgba: [20, 20, 20, 255], count: 98 },
+ { rgba: [220, 38, 38, 255], count: 2 },
+ ],
+ }),
+ });
+ expect(tint).toBeNull();
+ });
+
+ it('uses the same light, low-chroma tint for every hue', () => {
+ const red = logoTint.tintFromPixels({
+ pixels: pixels({ colours: [{ rgba: [220, 38, 38, 255], count: 10 }] }),
+ });
+ const green = logoTint.tintFromPixels({
+ pixels: pixels({ colours: [{ rgba: [22, 163, 74, 255], count: 10 }] }),
+ });
+ expect(red?.split(' ').slice(0, 2)).toEqual(green?.split(' ').slice(0, 2));
+ });
+});
diff --git a/packages/web/test/lib/brand-seed.test.ts b/packages/web/test/lib/brand-seed.test.ts
index 365fc287803..d3fc6c36e03 100644
--- a/packages/web/test/lib/brand-seed.test.ts
+++ b/packages/web/test/lib/brand-seed.test.ts
@@ -11,8 +11,8 @@ describe('brandSeed', () => {
primaryColor: '#6e41e2',
statusColors: { danger: '#b91c1c' },
});
- expect(variable({ name: '--accent-9' })).toBe('#6e41e2');
- expect(variable({ name: '--danger-seed' })).toBe('#b91c1c');
+ expect(variable({ name: '--accent-light-9' })).toBe('#6e41e2');
+ expect(variable({ name: '--danger-light-9' })).toBe('#b91c1c');
brandSeed.setPreview({
primaryColor: '#0ea5e9',
@@ -22,14 +22,14 @@ describe('brandSeed', () => {
primaryColor: '#16a34a',
statusColors: { danger: '#991b1b' },
});
- expect(variable({ name: '--accent-9' })).toBe('#0ea5e9');
- expect(variable({ name: '--warning-seed' })).toBe('#eab308');
- expect(variable({ name: '--danger-seed' })).toBe('');
+ expect(variable({ name: '--accent-light-9' })).toBe('#0ea5e9');
+ expect(variable({ name: '--warning-light-9' })).toBe('#eab308');
+ expect(variable({ name: '--danger-light-9' })).toBe('');
brandSeed.clearPreview();
- expect(variable({ name: '--accent-9' })).toBe('#16a34a');
- expect(variable({ name: '--danger-seed' })).toBe('#991b1b');
- expect(variable({ name: '--warning-seed' })).toBe('');
+ expect(variable({ name: '--accent-light-9' })).toBe('#16a34a');
+ expect(variable({ name: '--danger-light-9' })).toBe('#991b1b');
+ expect(variable({ name: '--warning-light-9' })).toBe('');
});
});
diff --git a/packages/web/test/styles/status-scales.test.ts b/packages/web/test/styles/status-scales.test.ts
index c7cef18add4..330b0a15224 100644
--- a/packages/web/test/styles/status-scales.test.ts
+++ b/packages/web/test/styles/status-scales.test.ts
@@ -12,109 +12,66 @@ const THEMES = {
light: themeBlock({ opening: ":root,\n [data-theme='light'] {" }),
dark: themeBlock({ opening: "[data-theme='dark'] {" }),
};
-const BRAND_HUE = Number(rootValue({ name: '--brand-h' }));
-const HUES = Array.from({ length: 72 }, (_, index) => index * 5);
-const CHROMA_SCALES = [0.4, 1];
-const AA_TEXT_RATIO = 4.5;
+const SCALES = ['accent', ...brandColors.statusScales] as const;
-describe('status scales', () => {
+describe('colour scales in styles.css', () => {
Object.entries(THEMES).forEach(([theme, block]) => {
- brandColors.statusScales.forEach((scale) => {
- it(`keeps ${scale} step 11 readable at every seeded hue in ${theme} mode`, () => {
- const ink = step({ block, scale, step: 11 });
- const failures = HUES.flatMap((hue) =>
- CHROMA_SCALES.flatMap((chromaScale) =>
- groundsFor({ block, theme, scale, hue, chromaScale })
- .map((ground) => ({
- ground: ground.name,
- ratio: contrast({
- first: toSrgb({
- lightness: ink.lightness,
- chroma: ink.chroma * chromaScale,
- hue,
- }),
- second: ground.srgb,
- }),
- }))
- .filter(({ ratio }) => ratio < AA_TEXT_RATIO)
- .map(
- ({ ground, ratio }) =>
- `hue ${hue}, chroma ×${chromaScale}, on ${ground}: ${ratio.toFixed(
- 2,
- )}:1`,
- ),
- ),
- );
- expect(failures).toEqual([]);
+ SCALES.forEach((scale) => {
+ it(`matches the generated default ${scale} ramp in ${theme} mode`, () => {
+ const ramp = brandColors.defaultRamp({ scale });
+ const expected = theme === 'light' ? ramp.light : ramp.dark;
+ brandColors.steps.forEach((step) => {
+ expect(stepValue({ block, scale, step })).toEqual({
+ override: `--${scale}-${theme}-${step}`,
+ fallback: expected[step],
+ });
+ });
});
});
- });
- it('defaults each status hue to the hue of its default solid', () => {
brandColors.statusScales.forEach((scale) => {
- const seeded = brandColors.statusCssVariables({
- statusColors: { [scale]: brandColors.defaultStatusColor({ scale }) },
+ it(`labels the default ${scale} solid with its measured colour in ${theme} mode`, () => {
+ const match = block.match(
+ new RegExp(`--on-${scale}: var\\(--on-${scale}-seed, ([^)]+)\\);`),
+ );
+ expect(match?.[1]).toBe(brandColors.defaultRamp({ scale }).onSolid);
});
- expect(Number(seeded[`--${scale}-h`])).toBeCloseTo(
- Number(rootValue({ name: `--${scale}-h` })),
- 0,
- );
- expect(rootValue({ name: `--${scale}-c` })).toBe('1');
});
});
});
-function groundsFor({
- block,
- theme,
- scale,
- hue,
- chromaScale,
-}: {
- block: string;
- theme: string;
- scale: string;
- hue: number;
- chromaScale: number;
-}): Ground[] {
- const grays = [1, 2, 3].map((number) => {
- const gray = step({ block, scale: 'gray', step: number });
- return {
- name: `gray-${number}`,
- srgb: toSrgb({ ...gray, hue: BRAND_HUE }),
- };
+describe('swatches in styles.css', () => {
+ Object.entries(THEMES).forEach(([theme, block]) => {
+ it(`match the generated swatches in ${theme} mode`, () => {
+ brandColors.swatches().forEach((swatch, index) => {
+ const roles = theme === 'light' ? swatch.light : swatch.dark;
+ Object.entries(roles).forEach(([role, value]) => {
+ const match = block.match(
+ new RegExp(`--swatch-${index + 1}-${role}: ([^;]+);`),
+ );
+ expect(match?.[1]).toBe(value);
+ });
+ });
+ });
});
- const tint = step({ block, scale, step: 3 });
- const ownTint = {
- name: `${scale}-3`,
- srgb: toSrgb({
- lightness: tint.lightness,
- chroma: tint.chroma * chromaScale,
- hue,
- }),
- };
- const panel = theme === 'light' ? [{ name: 'panel', srgb: WHITE }] : [];
- return [...grays, ownTint, ...panel];
-}
+});
-function step({
+function stepValue({
block,
scale,
- step: number,
+ step,
}: {
block: string;
scale: string;
step: number;
-}): { lightness: number; chroma: number } {
+}): { override: string; fallback: string } {
const match = block.match(
- new RegExp(
- `--${scale}-${number}: (?:var\\(--${scale}-seed, )?oklch\\(([\\d.]+)% calc\\(([\\d.]+) \\*`,
- ),
+ new RegExp(`--${scale}-${step}: var\\((--[\\w-]+), ([^;]+)\\);`),
);
if (!match) {
- throw new Error(`--${scale}-${number} is not a seedable oklch step`);
+ throw new Error(`--${scale}-${step} is not an overridable step`);
}
- return { lightness: Number(match[1]) / 100, chroma: Number(match[2]) };
+ return { override: match[1], fallback: match[2] };
}
function themeBlock({ opening }: { opening: string }): string {
@@ -124,53 +81,3 @@ function themeBlock({ opening }: { opening: string }): string {
}
return STYLES.slice(start, STYLES.indexOf('\n }', start));
}
-
-function rootValue({ name }: { name: string }): string {
- const match = STYLES.match(new RegExp(`:root \\{[^}]*?${name}: ([^;]+);`));
- if (!match) {
- throw new Error(`${name} is not set on :root`);
- }
- return match[1].trim();
-}
-
-function toSrgb({
- lightness,
- chroma,
- hue,
-}: {
- lightness: number;
- chroma: number;
- hue: number;
-}): Srgb {
- const radians = (hue * Math.PI) / 180;
- const a = chroma * Math.cos(radians);
- const b = chroma * Math.sin(radians);
- const l = (lightness + 0.3963377774 * a + 0.2158037573 * b) ** 3;
- const m = (lightness - 0.1055613458 * a - 0.0638541728 * b) ** 3;
- const s = (lightness - 0.0894841775 * a - 1.291485548 * b) ** 3;
- return [
- 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,
- -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,
- -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s,
- ].map((channel) => Math.min(1, Math.max(0, channel)));
-}
-
-function contrast({ first, second }: { first: Srgb; second: Srgb }): number {
- const [lighter, darker] = [luminance(first), luminance(second)].sort(
- (x, y) => y - x,
- );
- return (lighter + 0.05) / (darker + 0.05);
-}
-
-function luminance([red, green, blue]: Srgb): number {
- return 0.2126 * red + 0.7152 * green + 0.0722 * blue;
-}
-
-const WHITE: Srgb = [1, 1, 1];
-
-type Srgb = number[];
-
-type Ground = {
- name: string;
- srgb: Srgb;
-};