Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a435cf0
feat(gamut-styles)!: brands, overrides and Original Codecademy on the…
dreamwasp Oct 27, 2026
e0699a0
Merge branch 'cass-gmt-1825-color-system' into cass-gmt-1825-color-br…
dreamwasp Oct 28, 2026
4585a13
feat(gamut-styles): per-brand gradient overrides; Original Codecademy…
dreamwasp Oct 29, 2026
424a2d4
fix(gamut): Alert takes design's status inks; Original Codecademy sto…
dreamwasp Oct 29, 2026
b7b704a
feat(gamut-styles): shadow roles and brand elevation from design's sa…
dreamwasp Nov 4, 2026
f5695fc
feat(gamut-styles): Original Codecademy's raised depth is old core's …
dreamwasp Nov 4, 2026
781feeb
chore(gamut-styles): report labels the migration map at df33b47
dreamwasp Nov 4, 2026
20a31de
Merge branch 'cass-gmt-1825-color-system' into cass-gmt-1825-color-br…
dreamwasp Nov 4, 2026
7aa5810
test(gamut-styles): sandbox parity runs in CI, against a fixture that…
dreamwasp Nov 4, 2026
757274c
Merge origin/cass-gmt-1825-color-system into cass-gmt-1825-color-brands
dreamwasp Nov 9, 2026
d7945a1
refactor: use the singular --color- prefix for color variables
dreamwasp Nov 10, 2026
d7483fc
Merge branch 'cass-gmt-1825-color-system' into cass-gmt-1825-color-br…
dreamwasp Nov 10, 2026
12094eb
docs(changeset): drop the variable rename, the prefix stays --color-
dreamwasp Nov 10, 2026
ecdd6f9
fix(gamut-styles): preload each font file once
dreamwasp Nov 13, 2026
d0b1968
docs(gamut-agent-tools): cover color-roles in the scope-swap skill
dreamwasp Nov 18, 2026
ccf7dc9
docs(gamut-agent-tools): rename the scope-swap skill to gamut-migrati…
dreamwasp Nov 18, 2026
cbae653
docs(gamut-agent-tools): point the README at the gamut-migration skill
dreamwasp Nov 18, 2026
1ba8f0f
docs(gamut-agent-tools): drop a duplicated sentence in the migration …
dreamwasp Nov 18, 2026
057a03a
docs(gamut-agent-tools): cover the migration gaps in the gamut-migrat…
dreamwasp Nov 18, 2026
b382645
docs(gamut-agent-tools): explain the palette defaults in the gamut-mi…
dreamwasp Nov 19, 2026
4e072cf
docs(gamut-agent-tools): add hyper and yellow guidance to the gamut-m…
dreamwasp Nov 19, 2026
d21a460
docs(gamut-agent-tools): add blue-500 guidance to the gamut-migration…
dreamwasp Nov 19, 2026
734e3e4
docs(gamut-agent-tools): work through open color decisions with the u…
dreamwasp Nov 19, 2026
2f77f4b
docs(gamut-agent-tools): stop adding stylis by hand; cover the duplic…
dreamwasp Nov 20, 2026
d2a25d4
docs(gamut-agent-tools): add Video peers only for apps that import Video
dreamwasp Nov 20, 2026
b9e1736
Merge branch 'stack-system' into stack-brands
dreamwasp Nov 20, 2026
725a62b
merge: bring the color system and main into the brands branch
dreamwasp Nov 20, 2026
0b68d0e
Merge remote-tracking branch 'origin/main' into stack-brands
dreamwasp Nov 20, 2026
7dfebbf
Merge remote-tracking branch 'origin/main' into stack-brands
dreamwasp Nov 20, 2026
32e7264
fix(gamut-styles): keep a nested background-current on the parent color
dreamwasp Nov 23, 2026
d056050
feat(gamut-styles): disabled fields drop to surface-sunken in the mig…
dreamwasp Dec 1, 2026
4ede53f
merge: bring the updated color system into brands
dreamwasp Dec 2, 2026
c84b86b
merge: bring cass-gmt-1825-color-system (f182d9417) into color-brands
dreamwasp Dec 2, 2026
5e0fe63
Merge remote-tracking branch 'origin/cass-gmt-1825-color-system' into…
dreamwasp Dec 3, 2026
932239f
Merge remote-tracking branch 'origin/cass-gmt-1825-color-system' into…
dreamwasp Dec 3, 2026
18dd949
test(gamut-styles): drop per-file @emotion/jest matcher setup
dreamwasp Dec 3, 2026
1382e6b
test(gamut-styles): remove the orphaned theme snapshot
dreamwasp Dec 3, 2026
0c4519a
fix(gamut-styles): resolve brand role overrides through the emitted t…
dreamwasp Dec 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .changeset/color-system-brands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'@skillsoft/gamut-styles': minor
'@skillsoft/variance': minor
'@skillsoft/gamut': minor
---

Brands on the generated color system.

- **Breaking:** `tokens.css` puts its rules in `@layer tokens`, with `reset, base, tokens, recipes, utilities` declared first.
- Adds `originalCodecademyTheme`, today's core colors, fonts and hard-offset elevation rebuilt on the generated system. `tokens.css` carries a palette block per brand under `[data-brand]`.
- A brand can override a palette step with an exact hex, or point a role at a different step (and, optionally, a different alpha) in one mode. Overrides go through the same contrast checks as generated values.
- `ColorMode` on generated themes sets `data-color-mode` and `data-brand` instead of injecting every role variable.
- Fixes `Background` painting the flipped mode's color for an alias `bg`, such as `bg="primary"`.
- `Alert`: General uses `surface-brand-subtle`. Gradient alerts size their gradient to the alert, not the viewport. Status alerts (error, success, notice) put their status ink on the message, and a floating Alert's border takes the same ink. The CTA follows the Alert's color mode instead of always rendering dark.
- Original Codecademy no longer pins navy and beige; their generated steps are used as is. Yellow stays exact.
- **Breaking:** the `backdrop` role is renamed `shadow-scrim`, and two shadow roles are added: `shadow-key` and `shadow-ambient`, the two layers every elevation shadow is drawn in (design's sandbox, `df33b47`). Brand themes' `elevation` now uses them, so shadows no longer render `undefined`: Skillsoft gets the soft raised shadow, and Original Codecademy keeps old core's hard offset with a transparent `shadow-ambient`.
2 changes: 2 additions & 0 deletions packages/.storybook/components/Elements/DocsContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
GamutProvider,
platformPalette,
skillsoftTheme,
originalCodecademyTheme,
ColorMode,
} from '@skillsoft/gamut-styles';
import {
Expand All @@ -22,6 +23,7 @@ export const storybookTheme = createTheme(skillsoftTheme)

const themeMap = {
skillsoft: skillsoftTheme,
originalCodecademy: originalCodecademyTheme,
} as const;

const themeSpecificStories = {};
Expand Down
5 changes: 4 additions & 1 deletion packages/.storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ export const globalTypes = {
defaultValue: 'skillsoft',
toolbar: {
icon: 'paintbrush',
items: [{ value: 'skillsoft', title: 'Skillsoft' }],
items: [
{ value: 'skillsoft', title: 'Skillsoft' },
{ value: 'originalCodecademy', title: 'Original Codecademy' },
],
showName: true,
},
},
Expand Down
33 changes: 19 additions & 14 deletions packages/.storybook/theming/GamutThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
ColorModes,
GamutProvider,
skillsoftTheme,
originalCodecademyTheme,
} from '@skillsoft/gamut-styles';
import { Theme } from '@emotion/react';
import tokensCss from '@skillsoft/gamut-styles/tokens.css?inline';
Expand All @@ -15,14 +16,9 @@ const STORYBOOK_CSP_NONCE = 'storybook-csp-nonce';
* See: https://github.com/storybookjs/storybook/issues/12255
*/

/* The skillsoft theme's surface-default values, as palette colors. */
const skillsoftBackground: Record<ColorModes, string> = {
light: 'palette-neutral-light-100',
dark: 'palette-neutral-dark-1100',
};

const themeMap = {
skillsoft: skillsoftTheme,
originalCodecademy: originalCodecademyTheme,
} as const;

type GlobalsContext = {
Expand All @@ -39,21 +35,30 @@ export const withEmotion = (Story: any, context: GlobalsContext) => {
const selectedTheme = context.globals.theme;
const useLogicalProperties = context.globals.logicalProps === 'true';
const direction = context.globals.direction ?? 'ltr';
/* The theme takes its values from tokens.css, not Emotion. */
const tokens = <style>{tokensCss}</style>;
const bg = skillsoftBackground[colorMode];
const background = (skillsoftTheme._tokens.colors as Record<string, string>)[
bg
];
const storyRef = useRef<HTMLDivElement>(null);
const currentTheme = themeMap[selectedTheme];
/*
* Generated themes (color-system spike; they carry contentModes) take their
* values from tokens.css, not Emotion. Injected only for those: tokens.css
* also sets white, black and background-current on :root, which would leak
* into the other themes. They have none of core's primitives, so `navy`
* doesn't exist there; the story sits on their own surface-default.
*/
const generated = 'contentModes' in currentTheme ? currentTheme : undefined;
const tokens = generated && <style>{tokensCss}</style>;
const bg = generated
? generated.modes[colorMode]['surface-default']
: undefined;
const background = generated
? (generated._tokens.colors as Record<string, string>)[bg as string]
: undefined;
const storyRef = useRef<HTMLDivElement>(null);

useLayoutEffect(() => {
const storyEl = storyRef.current?.closest(
'.docs-story'
) as HTMLDivElement | null;
if (storyEl) storyEl.style.backgroundColor = background;
}, [storyRef.current, context.globals.colorMode]);
}, [storyRef.current, context.globals.colorMode, background]);

useLayoutEffect(() => {
if (document.documentElement.getAttribute('dir') !== direction) {
Expand Down
4 changes: 2 additions & 2 deletions packages/gamut-styles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ Storybook has a live example under **Foundations / Color system / CSS contract**
- Roles: `--color-<role>`, for example `--color-action-primary`.
- `white` and `black` keep their bare names as boundary tokens.

The `--color-` prefix on primitives matches what variance emits for every
color key, so the Emotion and CSS routes use one naming scheme.
The `--color-` prefix is the color scale's prefix in variance, so the Emotion and
CSS routes use one naming scheme.

### Known limits

Expand Down
4 changes: 3 additions & 1 deletion packages/gamut-styles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"require": "./dist/tokens/index.js"
},
"./tokens.css": "./dist/tokens/generated/tokens.css",
"./tokens/*.tokens.json": "./dist/tokens/generated/*.tokens.json"
"./tokens/*.tokens.json": "./dist/tokens/generated/*.tokens.json",
"./tokens/brands/*.tokens.json": "./dist/tokens/generated/brands/*.tokens.json"
},
"files": [
"dist",
Expand All @@ -48,6 +49,7 @@
"scripts": {
"build": "nx build gamut-styles",
"build:tokens": "jiti scripts/build-tokens.ts",
"dump:sandbox": "jiti scripts/dump-sandbox.ts",
"validate:tokens": "jiti scripts/validate-tokens.ts"
},
"sideEffects": [
Expand Down
3 changes: 2 additions & 1 deletion packages/gamut-styles/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"tsdown",
"tsc --emitDeclarationOnly --project tsconfig.lib.json",
"cpy './src/**/*.{d.ts,svg,png}' ./dist",
"cpy './src/tokens/generated/*.{css,json}' ./dist/tokens/generated"
"cpy './src/tokens/generated/*.{css,json}' ./dist/tokens/generated",
"cpy './src/tokens/generated/brands/*.json' ./dist/tokens/generated/brands"
],
"parallel": false
}
Expand Down
36 changes: 8 additions & 28 deletions packages/gamut-styles/scripts/build-tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,18 @@
*
* Output lands in src/tokens/generated/ and is checked in, so the theme and
* the package build don't need the generator (or culori) at runtime. The
* generator itself lives in src/colorSystem/build.ts, shared with the test
* that fails when these files drift.
* generator lives in src/colorSystem/build.ts, shared with the test that
* fails when these files drift.
*/
import { join } from 'node:path';

import { skillsoftBrand } from '../src/colorSystem/brands/skillsoft';
import { buildTokens } from '../src/colorSystem/build';
import { validateMigration } from '../src/colorSystem/migration';
import { createColorSystem } from '../src/colorSystem/system';
import { validate } from '../src/colorSystem/validate';

const OUT = join(__dirname, '../src/tokens/generated');

const main = async () => {
const system = createColorSystem(skillsoftBrand);

const failed = [...validate(system), ...validateMigration(system)].filter(
(c) => !c.pass
);
if (failed.length) {
throw new Error(
`refusing to emit; failed checks:\n${failed
.map((c) => ` ${c.name}: ${c.worst} at ${c.at}`)
.join('\n')}`
);
}

await buildTokens(system, OUT);
console.log(`wrote ${OUT}`);
};

main().catch((e) => {
console.error(e);
process.exit(1);
});
buildTokens(OUT)
.then(() => console.log(`wrote ${OUT}`))
.catch((e) => {
console.error(e);
process.exit(1);
});
97 changes: 97 additions & 0 deletions packages/gamut-styles/scripts/dump-sandbox.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/* eslint-disable no-console -- CLI script; the console is its output. */
/*
* Refreshes `src/colorSystem/__fixtures__/sandbox.json`, the copy of design's
* sandbox output that `sandboxParity.test.ts` holds the generator to.
*
* yarn workspace @skillsoft/gamut-styles dump:sandbox <sandbox checkout>
*
* The checkout is a clone of skillsoft-common/gamut-sandbox with its
* dependencies installed (`yarn` there), on whatever commit you're porting.
* The fixture records the branch and commit it came from, so the test names
* them. After a dump, run the tests: what fails is what the port still has
* to take from the sandbox.
*/
import { execFileSync } from 'node:child_process';
import { writeFileSync } from 'node:fs';
import { join, resolve } from 'node:path';

const [checkout] = process.argv.slice(2);
if (!checkout) {
console.error('usage: dump:sandbox <path to a gamut-sandbox checkout>');
process.exit(1);
}
const SANDBOX = resolve(checkout);
const OUT = join(__dirname, '../src/colorSystem/__fixtures__/sandbox.json');

const git = (...args: string[]) =>
execFileSync('git', ['-C', SANDBOX, ...args], { encoding: 'utf8' }).trim();

/* A detached checkout names the remote branch that holds the commit, if one does. */
const branch = () => {
const name = git('rev-parse', '--abbrev-ref', 'HEAD');
if (name !== 'HEAD') return name;
const remote = git(
'branch',
'-r',
'--contains',
'HEAD',
'--format=%(refname:short)'
)
.split('\n')
.find((b) => b && !b.endsWith('/HEAD'));
return remote ? remote.replace(/^[^/]+\//, '') : '(detached)';
};

const main = async () => {
const palette = await import(join(SANDBOX, 'src/colorSystem/palette.ts'));
const roles = await import(join(SANDBOX, 'src/colorSystem/roles.ts'));

const families = Object.fromEntries(
palette.FAMILIES.map((name: string) => {
const f = palette.family(name);
return [
name,
{
hue: f.hue,
neutral: f.neutral,
rungs: Object.fromEntries(
Object.entries<{ l: number; c: number; hex: string }>(f.rungs).map(
([grade, r]) => [grade, { l: r.l, c: r.c, hex: r.hex }]
)
),
},
];
})
);

const fixture = {
source: {
repo: 'skillsoft-common/gamut-sandbox',
branch: branch(),
commit: git('rev-parse', '--short', 'HEAD'),
dumped: new Date().toISOString().slice(0, 10),
},
families,
roles: roles.ROLES.map(
(r: {
token: string;
light: { primitive: string; hex: string };
dark: { primitive: string; hex: string };
}) => ({
token: r.token,
light: { primitive: r.light.primitive, hex: r.light.hex },
dark: { primitive: r.dark.primitive, hex: r.dark.hex },
})
),
};

writeFileSync(OUT, `${JSON.stringify(fixture, null, 2)}\n`);
console.log(
`${fixture.roles.length} roles from ${fixture.source.branch} at ${fixture.source.commit} → ${OUT}`
);
};

main().catch((e) => {
console.error(e);
process.exit(1);
});
Loading