@codecademy/gamut 68.6.1-alpha.c211a2.0 → 68.6.1-alpha.d52035.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/agent-tools/.claude-plugin/marketplace.json +16 -0
  2. package/agent-tools/.claude-plugin/plugin.json +7 -0
  3. package/agent-tools/.cursor-plugin/plugin.json +7 -0
  4. package/agent-tools/DESIGN.Codecademy.md +643 -0
  5. package/agent-tools/DESIGN.LXStudio.md +444 -0
  6. package/agent-tools/DESIGN.Percipio.md +435 -0
  7. package/agent-tools/DESIGN.md +1 -0
  8. package/agent-tools/agents/.gitkeep +0 -0
  9. package/agent-tools/commands/gamut-review.md +231 -0
  10. package/agent-tools/guidelines/components/buttons.md +91 -0
  11. package/agent-tools/guidelines/components/overview.md +44 -0
  12. package/agent-tools/guidelines/foundations/color.md +172 -0
  13. package/agent-tools/guidelines/foundations/modes.md +47 -0
  14. package/agent-tools/guidelines/foundations/spacing.md +66 -0
  15. package/agent-tools/guidelines/foundations/typography.md +50 -0
  16. package/agent-tools/guidelines/overview.md +38 -0
  17. package/agent-tools/guidelines/setup.md +42 -0
  18. package/agent-tools/rules/accessibility.mdc +68 -0
  19. package/agent-tools/skills/gamut-accessibility/SKILL.md +239 -0
  20. package/agent-tools/skills/gamut-color-mode/SKILL.md +138 -0
  21. package/agent-tools/skills/gamut-system-props/SKILL.md +173 -0
  22. package/agent-tools/skills/gamut-testing/SKILL.md +181 -0
  23. package/agent-tools/skills/gamut-theming/SKILL.md +113 -0
  24. package/agent-tools/skills/gamut-typography/SKILL.md +123 -0
  25. package/bin/commands/plugin/install.mjs +173 -0
  26. package/bin/commands/plugin/list.mjs +105 -0
  27. package/bin/commands/plugin/remove.mjs +116 -0
  28. package/bin/commands/plugin/update.mjs +49 -0
  29. package/bin/gamut.mjs +92 -0
  30. package/bin/lib/claude.mjs +52 -0
  31. package/bin/lib/cursor.mjs +40 -0
  32. package/bin/lib/figma.mjs +49 -0
  33. package/bin/lib/resolve-plugin-dir.mjs +38 -0
  34. package/bin/lib/run-command.mjs +22 -0
  35. package/package.json +11 -8
@@ -0,0 +1,91 @@
1
+ # Buttons
2
+
3
+ Agent reference: which **button component** and which **`variant`** to use. Colors are wired inside each atom — consumers do **not** pass `color`, `bg`, hex, or semantic token names on stock buttons.
4
+
5
+ **Related docs:** [overview.md](../overview.md) (reading order) · [foundations/color.md](../foundations/color.md) and `gamut-color-mode` skill — semantic tokens for **custom** styled controls only, not stock button atoms · [foundations/modes.md](../foundations/modes.md) — ColorMode / `<Background>` when placing buttons on colored surfaces
6
+
7
+ **Storybook (UX source of truth):**
8
+
9
+ - [Atoms / Buttons / Button](https://gamut.codecademy.com/?path=/docs-atoms-buttons-button--docs) — variants, light/dark examples
10
+ - [FillButton](https://gamut.codecademy.com/?path=/docs-atoms-buttons-fillbutton--docs) · [StrokeButton](https://gamut.codecademy.com/?path=/docs-atoms-buttons-strokebutton--docs) · [TextButton](https://gamut.codecademy.com/?path=/docs-atoms-buttons-textbutton--docs) · [IconButton](https://gamut.codecademy.com/?path=/docs-atoms-buttons-iconbutton--docs) · [CTAButton](https://gamut.codecademy.com/?path=/docs-atoms-buttons-ctabutton--docs)
11
+ - [Meta / Best practices](https://gamut.codecademy.com/?path=/docs-meta-best-practices--page) — semantic tokens for custom `css` / `variant` / `states`, not prebuilt atoms
12
+ - [UX Writing / Component guidelines / Buttons](https://gamut.codecademy.com/?path=/docs-ux-writing-component-guidelines-buttons--docs) — label copy
13
+
14
+ ## Component selection
15
+
16
+ | Component | Use for | Default `variant` |
17
+ | -------------- | --------------------------------------------- | ------------------------------------------------ |
18
+ | `FillButton` | Primary / high-emphasis actions | `primary` |
19
+ | `StrokeButton` | Secondary / outlined actions | `primary` (often pass `secondary` per Storybook) |
20
+ | `TextButton` | Low-emphasis, inline actions | `primary` |
21
+ | `IconButton` | Icon-only; requires `tip` and accessible name | `secondary` |
22
+ | `CTAButton` | Marketing / high-visibility CTA only | `primary` (only option) |
23
+
24
+ ## `variant` prop
25
+
26
+ Shared by `FillButton`, `StrokeButton`, `TextButton`, and `IconButton`. `CTAButton` only supports `primary`.
27
+
28
+ | `variant` | Typical use |
29
+ | ----------- | ------------------------------ |
30
+ | `primary` | Submit, main CTA |
31
+ | `secondary` | Close, cancel, low priority |
32
+ | `danger` | Destructive actions |
33
+ | `interface` | Controls styled like UI chrome |
34
+
35
+ ```tsx
36
+ <FillButton variant="primary">Submit</FillButton>
37
+ <StrokeButton variant="secondary">Cancel</StrokeButton>
38
+ <IconButton icon={SearchIcon} tip="Search" variant="secondary" />
39
+ <CTAButton>Try Pro for free</CTAButton>
40
+ ```
41
+
42
+ ## Sizes
43
+
44
+ `small` | `normal` (default) | `large`
45
+
46
+ ## Key props
47
+
48
+ | Prop | Type | Effect |
49
+ | -------------- | ----------------------------------------------------- | ------------------------------------------------ |
50
+ | `variant` | `"primary" \| "secondary" \| "danger" \| "interface"` | Color emphasis (see table above) |
51
+ | `size` | `"small" \| "normal" \| "large"` | Padding and font size |
52
+ | `icon` | Icon component | Leading or trailing icon (Fill, Stroke, Text) |
53
+ | `iconPosition` | `"left" \| "right"` | Defaults to left |
54
+ | `disabled` | boolean | Disabled state styling |
55
+ | `href` | string | Renders as `<a>` tag |
56
+ | `tip` | string | Required on `IconButton` (tooltip + hover label) |
57
+
58
+ ## States
59
+
60
+ Hover, active, and disabled colors are handled by the component. Do not override state colors with `color` / `bg` props.
61
+
62
+ ## Accessibility — `disabled` vs `aria-disabled`
63
+
64
+ | Situation | Use | Why |
65
+ | ------------------------------------------------------------------- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
66
+ | Button should not be activatable (default) | `disabled` prop | Renders native `disabled` on `<button>`; removed from tab order; correct for most forms and actions |
67
+ | Disabled button **with a tooltip** that must stay readable on focus | `aria-disabled` only — **do not** also pass `disabled` | Native `disabled` blocks keyboard focus, so the tooltip cannot be reached. Gamut disabled **styles** also match `[aria-disabled='true']`. See [ToolTip — With a disabled Button](https://gamut.codecademy.com/?path=/docs-molecules-tips-tooltip--docs) |
68
+
69
+ ```tsx
70
+ // Default — not interactive
71
+ <FillButton disabled>Submit</FillButton>
72
+
73
+ // Disabled but focusable (e.g. wrapped in ToolTip explaining why)
74
+ <ToolTip id="why-disabled" info="Complete the lesson first">
75
+ <FillButton aria-describedby="why-disabled" aria-disabled>
76
+ Submit
77
+ </FillButton>
78
+ </ToolTip>
79
+ ```
80
+
81
+ - **`href` + `disabled`:** `ButtonBase` (internal) drops `href` and renders a `<button disabled>` — link-style buttons cannot stay anchors while disabled.
82
+ - **`IconButton`:** provide an accessible name via `tip` (used as `aria-label` when `aria-label` is omitted). See ToolTip / IconButton Storybook pages.
83
+ - **`ButtonBase` is not exported** from `@codecademy/gamut` (only the `ButtonBaseElements` type is). Prefer stock atoms; custom button styling belongs in Gamut itself or via `css` / `variant` from `gamut-styles`, not by importing `ButtonBase`.
84
+
85
+ ## Rules
86
+
87
+ - Use `FillButton` for primary actions and `StrokeButton` for secondary — do not use both at equal weight on the same screen.
88
+ - Reserve `CTAButton` for marketing / high-visibility promotions; do not use it for standard UI actions.
89
+ - Avoid placing buttons in the wrong color-mode context (e.g. light-mode buttons on a navy band without `<Background>`). See [modes.md](../foundations/modes.md).
90
+ - Every interactive `Card` wrapped in `<Anchor>` should have `isInteractive` — not a button inside.
91
+ - Do not set `color`, `bg`, or hex on stock button components. For custom styled controls, follow [color.md](../foundations/color.md) and `gamut-styles` utilities — do not import internal `ButtonBase`.
@@ -0,0 +1,44 @@
1
+ # Components
2
+
3
+ 52 components have Figma ↔ code mappings via Figma Code Connect (`packages/code-connect/`). Live code snippets appear in Figma's inspect panel when you select a component.
4
+
5
+ ## Atoms — foundational, single-purpose
6
+
7
+ Badge, Button (FillButton, StrokeButton, CTAButton, TextButton, IconButton), ButtonBase, Card, Checkbox, CodeBlock, ColorMode, Drawer, FlexBox, FormGroup, GridBox, HiddenText, Icon, Input, Label, Loader, Radio, Select, Spinner, Tag, TextArea, Toggle, Tooltip
8
+
9
+ ## Molecules — composed of atoms
10
+
11
+ Alert, Anchor, Breadcrumbs, Coachmark, Disclosure, GridForm, Markdown, Menu, Modal, Pagination, Popover, ProgressBar, Table, Tabs, Toast, Toaster, Video
12
+
13
+ ## Organisms — page-level compositions
14
+
15
+ ContentContainer, GridContainer, Layout, LayoutGrid
16
+
17
+ ## Key patterns
18
+
19
+ ### Buttons
20
+ See [buttons.md](buttons.md) for full reference. Use `FillButton` for primary actions, `StrokeButton` for secondary.
21
+
22
+ ### Cards
23
+ - **Background variants**: `default` (ColorMode-responsive), `white`, `yellow`, `beige`, `navy`, `hyper`
24
+ - **Shadow variants**: `none` (default), `outline`, `patternLeft`, `patternRight`
25
+ - Add `isInteractive` when wrapping in `<Anchor>` — enables hover shadow + `borderRadius: md`
26
+ - Default `borderRadius` is `none`; override with `borderRadius` prop
27
+
28
+ ### Color-aware components
29
+ - `<ColorMode mode="light|dark|system">` — scopes a subtree to an explicit color mode
30
+ - `<Background bg="<color>">` — applies background color + auto-switches inner color mode for contrast
31
+
32
+ ### Alerts
33
+ | Variant | Tokens |
34
+ |---|---|
35
+ | Error | `feedback-error` + `background-error` |
36
+ | Success | `feedback-success` + `background-success` |
37
+ | Warning | `feedback-warning` + `background-warning` |
38
+
39
+ ## Global tokens
40
+
41
+ | Token | Value | Use |
42
+ |---|---|---|
43
+ | `headerHeight` | 64px (base), 80px (md+) | Global page header height |
44
+ | `headerZ` | 15 | Z-index for global page header |
@@ -0,0 +1,172 @@
1
+ # Color
2
+
3
+ Use **semantic aliases** for UI that should respond to **color mode** (light/dark) and **theme** (Core, Admin, Platform, Percipio, LX Studio). The **same semantic token names** (`text`, `primary`, `background`, …) exist across themes; **resolved palette values and hex differ** by `GamutProvider` theme and active ColorMode. Never assume Codecademy Core hex when advising another product.
4
+
5
+ Prefer **`css` / `variant` / `states`** from `@codecademy/gamut-styles` with semantic names (see Storybook [Best practices](https://gamut.codecademy.com/?path=/docs-meta-best-practices--page)).
6
+
7
+ **Related:** [`setup.md`](../setup.md) (which theme to import) · [`gamut-theming` skill](../../skills/gamut-theming/SKILL.md) · [`gamut-color-mode` skill](../../skills/gamut-color-mode/SKILL.md) · [`modes.md`](modes.md) (`<ColorMode>`, `<Background>`)
8
+
9
+ Percipio, LX Studio, Admin, and Platform override subsets of semantic mappings while keeping the shared alias API — see theme sources below before hardcoding palette names or hex.
10
+
11
+ ## Semantic aliases (theme-stable names)
12
+
13
+ These tokens describe **roles**. Actual colors come from the active theme + ColorMode.
14
+
15
+ ### Text
16
+
17
+ | Token | Use for | Notes |
18
+ | ---------------- | --------------------------- | -------------------------- |
19
+ | `text` | Default body and UI text | |
20
+ | `text-accent` | Stronger emphasis text | |
21
+ | `text-secondary` | Supporting / secondary copy | Often opacity on base text |
22
+ | `text-disabled` | Disabled state labels | |
23
+
24
+ ### Background
25
+
26
+ | Token | Use for | Notes |
27
+ | --------------------- | --------------------------------- | ------------------------- |
28
+ | `background` | Default page/component background | |
29
+ | `background-primary` | Slightly elevated surfaces | |
30
+ | `background-contrast` | Maximum contrast surface | |
31
+ | `background-selected` | Selected row / item | Often low-opacity overlay |
32
+ | `background-hover` | Hover state overlay | |
33
+ | `background-disabled` | Disabled surface | |
34
+ | `background-success` | Success state container | |
35
+ | `background-warning` | Warning state container | |
36
+ | `background-error` | Error state container | |
37
+
38
+ ### Interactive
39
+
40
+ | Token | Use for | Notes |
41
+ | ----------------- | ----------------------------------------- | ---------------------------- |
42
+ | `primary` | Primary CTA, links, focus accents | Pairs with `primary-hover` |
43
+ | `primary-hover` | Hover on primary interactive | |
44
+ | `primary-inverse` | Accent on top of primary-colored surfaces | |
45
+ | `secondary` | Secondary CTA, ghost buttons | Pairs with `secondary-hover` |
46
+ | `secondary-hover` | Hover on secondary interactive | |
47
+ | `interface` | Checkboxes, toggles, sliders | Pairs with `interface-hover` |
48
+ | `interface-hover` | Hover on interface elements | |
49
+ | `danger` | Destructive actions, error emphasis | Pairs with `danger-hover` |
50
+ | `danger-hover` | Hover on danger interactive | |
51
+
52
+ ### Border
53
+
54
+ | Token | Use for | Notes |
55
+ | ------------------ | -------------------------- | ----- |
56
+ | `border-primary` | Strong borders, dividers | |
57
+ | `border-secondary` | Medium-weight borders | |
58
+ | `border-tertiary` | Subtle borders, separators | |
59
+ | `border-disabled` | Disabled input borders | |
60
+
61
+ ### Feedback
62
+
63
+ | Token | Use for | Notes |
64
+ | ------------------ | -------------------------- | ----- |
65
+ | `feedback-error` | Error messages, validation | |
66
+ | `feedback-success` | Success messages | |
67
+ | `feedback-warning` | Warning messages | |
68
+
69
+ ## Where resolved colors are documented
70
+
71
+ Use these instead of memorizing hex:
72
+
73
+ - **Storybook [ColorMode](https://gamut.codecademy.com/?path=/docs-foundations-colormode--page)** — how aliases map per light/dark for reference layouts.
74
+ - **Storybook Foundations → Theme** — per-product tables and guidance:
75
+ - [Core Theme](https://gamut.codecademy.com/?path=/docs-foundations-theme-core-theme--docs)
76
+ - [Admin Theme](https://gamut.codecademy.com/?path=/docs-foundations-theme-admin-theme--docs)
77
+ - [Platform Theme](https://gamut.codecademy.com/?path=/docs-foundations-theme-platform-theme--docs)
78
+ - [Percipio Theme](https://gamut.codecademy.com/?path=/docs-foundations-theme-percipio-theme--docs)
79
+ - [LX Studio Theme](https://gamut.codecademy.com/?path=/docs-foundations-theme-lx-studio-theme--docs)
80
+ - [Creating Themes](https://gamut.codecademy.com/?path=/docs-foundations-theme-creating-themes--docs) — authoring new themes in `gamut-styles`
81
+ - **Product design YAML** (root `DESIGN.md` from agent-tools): [`DESIGN.Codecademy.md`](../../DESIGN.Codecademy.md), [`DESIGN.Percipio.md`](../../DESIGN.Percipio.md), [`DESIGN.LXStudio.md`](../../DESIGN.LXStudio.md) — semantic ↔ palette for that product.
82
+ - **Source:** theme definitions in [`packages/gamut-styles/src/themes`](https://github.com/Codecademy/gamut/tree/main/packages/gamut-styles/src/themes), palette scales in [`packages/gamut-styles/src/variables`](https://github.com/Codecademy/gamut/tree/main/packages/gamut-styles/src/variables).
83
+
84
+ ## Codecademy Core — illustrative light/dark hex only
85
+
86
+ The tables below are **not** valid for Percipio, LX Studio, or other themes. They are a quick mental model for Codecademy **Core** defaults only.
87
+
88
+ ### Text
89
+
90
+ | Token | Light | Dark |
91
+ | ---------------- | ------------ | --------- |
92
+ | `text` | `#10162F` | `#ffffff` |
93
+ | `text-accent` | `#0A0D1C` | `#FFF0E5` |
94
+ | `text-secondary` | navy-800 75% | white 65% |
95
+ | `text-disabled` | navy-800 63% | white 50% |
96
+
97
+ ### Background
98
+
99
+ | Token | Light | Dark |
100
+ | --------------------- | ------------ | --------- |
101
+ | `background` | `#ffffff` | `#10162F` |
102
+ | `background-primary` | `#FFF0E5` | `#0A0D1C` |
103
+ | `background-contrast` | white | black |
104
+ | `background-selected` | navy-800 4% | white 4% |
105
+ | `background-hover` | navy-800 12% | white 9% |
106
+ | `background-disabled` | navy-800 12% | white 9% |
107
+ | `background-success` | `#F5FFE3` | `#151C07` |
108
+ | `background-warning` | `#FFFAE5` | `#211B00` |
109
+ | `background-error` | `#FBF1F0` | `#280503` |
110
+
111
+ ### Interactive
112
+
113
+ | Token | Light | Dark |
114
+ | ----------------- | ------------ | --------- |
115
+ | `primary` | `#3A10E5` | `#FFD300` |
116
+ | `primary-hover` | `#5533FF` | `#CCA900` |
117
+ | `primary-inverse` | `#FFD300` | `#3A10E5` |
118
+ | `secondary` | `#10162F` | `#ffffff` |
119
+ | `secondary-hover` | navy-800 86% | white 80% |
120
+ | `interface` | `#3A10E5` | `#FFD300` |
121
+ | `interface-hover` | `#5533FF` | `#CCA900` |
122
+ | `danger` | `#E91C11` | `#E85D7F` |
123
+ | `danger-hover` | `#BE1809` | `#DC5879` |
124
+
125
+ ### Border
126
+
127
+ | Token | Light | Dark |
128
+ | ------------------ | ------------ | --------- |
129
+ | `border-primary` | `#10162F` | `#ffffff` |
130
+ | `border-secondary` | navy-800 75% | white 65% |
131
+ | `border-tertiary` | navy-800 28% | white 20% |
132
+ | `border-disabled` | navy-800 63% | white 50% |
133
+
134
+ ### Feedback
135
+
136
+ | Token | Light | Dark |
137
+ | ------------------ | --------- | --------- |
138
+ | `feedback-error` | `#BE1809` | `#E85D7F` |
139
+ | `feedback-success` | `#008A27` | `#AEE938` |
140
+ | `feedback-warning` | `#FFD300` | `#FFFAE5` |
141
+
142
+ ## Raw palette (Core-centric reference)
143
+
144
+ Raw tokens name **fixed** swatches (surfaces, illustration, `<Background bg="…">` on Codecademy). **Palette keys and hex vary by theme** — Percipio and others add or remap scales (`percipioPalette`, etc.). Confirm allowed keys in the active theme or `DESIGN.md` before using a raw token in a non-Core app.
145
+
146
+ For Codecademy Core defaults:
147
+
148
+ | Name | Weights | Key values (illustrative) |
149
+ | -------- | -------------------------- | -------------------------------- |
150
+ | `navy` | 100–900 | 800 = `#10162F`, 900 = `#0A0D1C` |
151
+ | `hyper` | 400, 500 | 500 = `#3A10E5`, 400 = `#5533FF` |
152
+ | `yellow` | 0, 400, 500, 900 | 500 = `#FFD300` |
153
+ | `red` | 0, 300, 400, 500, 600, 900 | 500 = `#E91C11` |
154
+ | `green` | 0, 100, 400, 700, 900 | 700 = `#008A27` |
155
+ | `blue` | 0, 100, 300, 400, 500, 800 | 500 = `#1557FF` |
156
+ | `beige` | — | `#FFF0E5` |
157
+ | `pink` | 0, 400 | 400 = `#F966FF` |
158
+ | `orange` | 100, 500 | 500 = `#FF8C00` |
159
+
160
+ Named shorthand aliases commonly used on Core surfaces: `beige`, `blue`, `green`, `hyper`, `navy`, `orange`, `pink`, `red`, `yellow`, `black`, `white`
161
+
162
+ ## Decision guide
163
+
164
+ ```
165
+ Which product theme is GamutProvider using?
166
+ └─ Unknown → check setup.md / DESIGN.md / Storybook theme page before assuming hex or palette name
167
+
168
+ Coloring UI text or backgrounds?
169
+ └─ Must adapt to light/dark OR theme? → semantic alias (text, background, primary, …)
170
+ └─ Must stay fixed regardless of mode? → raw palette token (confirm key exists in that theme)
171
+ └─ Section background with content inside? → <Background bg="…"> (see modes.md)
172
+ ```
@@ -0,0 +1,47 @@
1
+ # Color Modes
2
+
3
+ Gamut uses **semantic color aliases** so components adapt to light/dark mode without configuration. See [color.md](color.md) for the full alias reference.
4
+
5
+ ## `<ColorMode>`
6
+
7
+ Wraps a subtree in an explicit color mode. Nest to create scoped mode regions.
8
+
9
+ ```tsx
10
+ import { ColorMode } from '@codecademy/gamut-styles';
11
+
12
+ <ColorMode mode="light">{children}</ColorMode> // force light
13
+ <ColorMode mode="dark">{children}</ColorMode> // force dark
14
+ <ColorMode mode="system">{children}</ColorMode> // follows OS preference
15
+ ```
16
+
17
+ **Props**: `mode="light" | "dark" | "system"`
18
+
19
+ ## `<Background>`
20
+
21
+ Use `<Background>` — not a raw `bg` prop — whenever setting a colored background on a section that contains text or interactive elements. It automatically switches the color mode inside to maintain accessible contrast.
22
+
23
+ ```tsx
24
+ import { Background } from '@codecademy/gamut-styles';
25
+
26
+ <Background bg="hyper">{children}</Background>;
27
+ ```
28
+
29
+ Nesting is supported — each `<Background>` creates its own accessible color context.
30
+
31
+ ## Hooks
32
+
33
+ | Hook | Returns | Use |
34
+ | ---------------------- | --------------------------------- | ------------------------------------------------- |
35
+ | `useCurrentMode()` | `"light" \| "dark"` | Active mode key only |
36
+ | `useColorMode()` | `[modeKey, modeColors, allModes]` | Full mode data + resolver for semantic color keys |
37
+ | `usePrefersDarkMode()` | `boolean` | Read OS dark preference only |
38
+
39
+ Import from `@codecademy/gamut-styles`.
40
+
41
+ **Storybook:** [Foundations / ColorMode](https://gamut.codecademy.com/?path=/docs-foundations-colormode--page) · [Meta / Best practices](https://gamut.codecademy.com/?path=/docs-meta-best-practices--page)
42
+
43
+ ## Common mistakes
44
+
45
+ - Do not use raw color tokens (`navy-400`, `white`) for text/backgrounds that must be accessible across modes — use semantic aliases.
46
+ - Do not use a raw `bg` prop on colored sections containing content — use `<Background>` so contrast is guaranteed.
47
+ - Do not manually toggle modes from `usePrefersDarkMode()` — use `<ColorMode mode="system">` instead.
@@ -0,0 +1,66 @@
1
+ # Spacing, Border Radius & Layout
2
+
3
+ ## Spacing scale
4
+
5
+ All spacing is multiples of 4px on an 8px grid.
6
+
7
+ | Token | Value |
8
+ |---|---|
9
+ | `0` | 0 |
10
+ | `4` | 4px |
11
+ | `8` | 8px |
12
+ | `12` | 12px |
13
+ | `16` | 16px |
14
+ | `24` | 24px |
15
+ | `32` | 32px |
16
+ | `40` | 40px |
17
+ | `48` | 48px |
18
+ | `64` | 64px |
19
+ | `96` | 96px |
20
+
21
+ Use multiples of 8px for block-element spacing. Use 4px only for inline or typographic relationships.
22
+
23
+ ## Border radius
24
+
25
+ | Token | Value | Use |
26
+ |---|---|---|
27
+ | `none` | 0px | Square / non-interactive elements |
28
+ | `sm` | 2px | Subtle rounding, tags |
29
+ | `md` | 4px | Buttons, inputs, interactive cards |
30
+ | `lg` | 8px | Cards, panels |
31
+ | `xl` | 16px | Large cards, modals |
32
+ | `full` | 999px | Pills, avatars, circular elements |
33
+
34
+ ## Breakpoints
35
+
36
+ Mobile-first. Styles apply from the named breakpoint and up.
37
+
38
+ | Token | Min-width | Max content width |
39
+ |---|---|---|
40
+ | _(base)_ | 0 | 288px |
41
+ | `xs` | 480px | 448px |
42
+ | `sm` | 768px | 704px |
43
+ | `md` | 1024px | 896px |
44
+ | `lg` | 1200px | 1072px |
45
+ | `xl` | 1440px | 1248px |
46
+
47
+ Container query variants (`c_xs`–`c_xl`) mirror these values but trigger on component width.
48
+
49
+ ## Grid
50
+
51
+ 12-column grid at all breakpoints.
52
+
53
+ | Property | xl/lg | md | sm/xs | base |
54
+ |---|---|---|---|---|
55
+ | Horizontal margins | 64px | 48px | 32px | 16px |
56
+ | Column gutters | 32px | 24px | 16px | 8px |
57
+ | Row gaps | 32px | 24px | 16px | 8px |
58
+
59
+ Minimum touch target on mobile: **44×44px**.
60
+
61
+ ## Responsive rules
62
+
63
+ - Begin design work at 1440px (XL), then adapt down.
64
+ - Multi-column layouts collapse to fewer columns — do not stretch or squish.
65
+ - Catalog cards and non-lockup elements should align on one axis (usually left), not fill column widths.
66
+ - Avoid dense or small components at the base (mobile) breakpoint.
@@ -0,0 +1,50 @@
1
+ # Typography
2
+
3
+ ## Typefaces
4
+
5
+ | Token | Codecademy font | Non-Codecademy | Use for |
6
+ |---|---|---|---|
7
+ | `base` | Apercu Pro | Hanken Grotesk | All UI text, headlines, body copy |
8
+ | `accent` | Suisse Intl Mono | Hanken Grotesk | Code, captions, labels, technical context |
9
+ | `monospace` | Monaco / Menlo / Consolas | Monaco / Menlo / Consolas | Code editor contexts |
10
+
11
+ Percipio overrides all families to Roboto. Apercu is licensed for codecademy.com only.
12
+
13
+ ## Font size scale
14
+
15
+ | Token | Size | Common use |
16
+ |---|---|---|
17
+ | `64` | 64px | Hero / display |
18
+ | `44` | 44px | Page titles |
19
+ | `34` | 34px | Section titles |
20
+ | `26` | 26px | Sub-section titles |
21
+ | `22` | 22px | Card titles, large UI labels |
22
+ | `20` | 20px | Secondary titles |
23
+ | `18` | 18px | Large body, intro text |
24
+ | `16` | 16px | Default body text |
25
+ | `14` | 14px | Small body, captions, labels |
26
+
27
+ ## Font weight
28
+
29
+ | Token | Value | Use |
30
+ |---|---|---|
31
+ | `base` | 400 | Body text, UI labels |
32
+ | `title` | 700 | Headlines, CTAs, buttons |
33
+
34
+ ## Line height
35
+
36
+ | Token | Value | Use |
37
+ |---|---|---|
38
+ | `base` | 1.5 | Body text |
39
+ | `spacedTitle` | 1.3 | Sub-headlines, medium titles |
40
+ | `title` | 1.2 | Large headlines |
41
+
42
+ Target 45–85 characters per line (66 ideal for web body text).
43
+
44
+ ## Rules
45
+
46
+ - Use `title` weight (700) for headlines, CTAs, and buttons.
47
+ - Use Apercu Italic to emphasize within a Regular paragraph — not Bold.
48
+ - Use `accent` (Suisse) sparingly: code snippets, captions, enumerated items. Suisse reads ~10–15% large — size it down relative to Apercu equivalents.
49
+ - Left-align text by default. Center-align only for short marketing headlines. Never right-align.
50
+ - Do not adjust letter-spacing.
@@ -0,0 +1,38 @@
1
+ # Gamut Design System
2
+
3
+ Gamut is the Codecademy / Skillsoft design system — React component library (`@codecademy/gamut`), design tokens (`@codecademy/gamut-styles`), and Figma components with live code previews via Figma Code Connect.
4
+
5
+ **Design voice**: "Ruled by logic, but creative and a bit unexpected." Structured and trustworthy for a learning platform, with engaging personality. Medium density — information-rich layouts with strong typographic hierarchy. Never cramped or overly airy.
6
+
7
+ **Core principles**:
8
+
9
+ - Components are color mode–aware by default — never hardcode hex values for adaptive UI
10
+ - All components work across all themes without modification
11
+ - Mobile-first, 12-column grid
12
+ - Semantic color tokens guarantee WCAG AA contrast automatically
13
+
14
+ **ColorMode in product UI:** Use `<ColorMode>` and `<Background>` from `@codecademy/gamut-styles` for scoped light/dark and contrast-safe surfaces — see [foundations/modes.md](foundations/modes.md) and the `gamut-color-mode` skill. Storybook: [ColorMode](https://gamut.codecademy.com/?path=/docs-foundations-colormode--page), [Best practices](https://gamut.codecademy.com/?path=/docs-meta-best-practices--page) (semantic tokens + `css` / `variant` / `states`).
15
+
16
+ ## Themes
17
+
18
+ | Theme | Product | Base font | Dark mode |
19
+ | ------------- | ------------------------------- | -------------- | --------- |
20
+ | **Core** | Codecademy (default) | Apercu | ✓ |
21
+ | **Admin** | Codecademy admin tools | Apercu | ✓ |
22
+ | **Platform** | Codecademy learning environment | Apercu | ✓ |
23
+ | **LX Studio** | LX Studio application | Hanken Grotesk | — |
24
+ | **Percipio** | Skillsoft Percipio | Roboto | — |
25
+
26
+ Set the theme at the app root via `<GamutProvider theme={...}>`.
27
+
28
+ ## Reading order
29
+
30
+ | File | What it covers |
31
+ | ------------------------------------------------------ | ----------------------------------------------------------------------- |
32
+ | [setup.md](setup.md) | Packages, GamutProvider, theme selection |
33
+ | [foundations/color.md](foundations/color.md) | Semantic roles (all themes), where to verify hex, Core-only cheatsheets |
34
+ | [foundations/modes.md](foundations/modes.md) | Light/dark ColorMode, Background component |
35
+ | [foundations/typography.md](foundations/typography.md) | Typefaces, font scale, rules |
36
+ | [foundations/spacing.md](foundations/spacing.md) | Spacing, border radius, responsive grid |
37
+ | [components/overview.md](components/overview.md) | Full component catalog |
38
+ | [components/buttons.md](components/buttons.md) | Button variants, props, decision tree |
@@ -0,0 +1,42 @@
1
+ # Setup
2
+
3
+ ## Install
4
+
5
+ ```sh
6
+ npm install @codecademy/gamut-kit
7
+ ```
8
+
9
+ `gamut-kit` bundles `gamut`, `gamut-icons`, `gamut-illustrations`, `gamut-patterns`, `gamut-styles`, `variance`, and `gamut-tests`.
10
+
11
+ ## Required wrapper
12
+
13
+ Wrap the app root in `<GamutProvider>`. This wires up the theme, color mode, and logical properties for all child components.
14
+
15
+ ```tsx
16
+ import { GamutProvider } from '@codecademy/gamut';
17
+ import { theme } from '@codecademy/gamut-styles';
18
+
19
+ const App = () => (
20
+ <GamutProvider theme={theme}>
21
+ {/* app content */}
22
+ </GamutProvider>
23
+ );
24
+ ```
25
+
26
+ ## Theme selection
27
+
28
+ | Product | Theme to import |
29
+ |---|---|
30
+ | Codecademy public | `coreTheme` (default `theme`) |
31
+ | Codecademy admin | `adminTheme` |
32
+ | Codecademy platform | `platformTheme` |
33
+ | LX Studio | `lxStudioTheme` |
34
+ | Percipio | `percipioTheme` |
35
+
36
+ All themes are exported from `@codecademy/gamut-styles`.
37
+
38
+ ## Font licensing
39
+
40
+ **Apercu Pro** is licensed for codecademy.com only. Non-Codecademy products must use their theme's approved typeface:
41
+ - LX Studio → Hanken Grotesk
42
+ - Percipio → Roboto
@@ -0,0 +1,68 @@
1
+ ---
2
+ description: Apply these guardrails when editing Gamut UI in TS/JS/TSX/JSX. Mirrors the General rules in the `gamut-accessibility` skill; see `skills/gamut-accessibility/SKILL.md` in this plugin for full component patterns and checklists. Loaded automatically for matched files.
3
+ alwaysApply: true
4
+ globs: ['*.tsx', '*.ts', '*.jsx', '*.js']
5
+ ---
6
+
7
+ # Gamut Accessibility Rules
8
+
9
+ ## Prefer HTML over ARIA
10
+
11
+ Unnecessary ARIA can cause harm. If a native HTML element or attribute with the semantics and behavior you need already exists, use it. Reach for ARIA only when native HTML is genuinely insufficient for the pattern.
12
+
13
+ ## A Role is a Promise
14
+
15
+ ARIA roles modify the accessibility tree and _imply_ behavior. Always ensure that the implied keyboard behavior, focusability, and interactivity exists when a role is used.
16
+
17
+ ## ARIA can both cloak and enhance
18
+
19
+ ARIA can augment native semantics (`aria-pressed` on a `<button>`) or override them entirely (`role="menuitem"` on an `<a>`). Both capabilities are powerful and dangerous. Override only when native HTML genuinely doesn't fit the pattern; when augmenting, don't contradict the native semantics.
20
+
21
+ ## Align accessible names with visible copy
22
+
23
+ Prefer wiring names through visible text and native `<label>` / control text / `alt` over using `aria-label`. Point `aria-labelledby` at the visible heading or label that should define the name if it's not possible to name elements from their content. Use bare `aria-label` when there is no suitable visible label.
24
+
25
+ ## Treat missing visible labels as a design smell
26
+
27
+ When there is no visible text for a nameable element, consider this a sign that the content design could be improved, but not a requirement that it is changed. This is not an accessibility violation.
28
+
29
+ ```html
30
+ <!-- smell: this list has no conceptual name, so we have to create one using ARIA -->
31
+ <ul aria-label="List heading">
32
+ <li>...</li>
33
+ </ul>
34
+
35
+ <!-- better: the list's name is visible and can be used for its accessible name -->
36
+ <h2 id="list-name">List heading</h2>
37
+ <ul aria-labelledby="list-name">
38
+ <li>...</li>
39
+ </ul>
40
+ ```
41
+
42
+ ## Use Gamut components — don't reimplement what they already solve
43
+
44
+ - `<Button>` not `<div onClick>` or `<span role="button">`
45
+ - `<Tabs>` / `<Tab>` / `<TabList>` / `<TabPanel>` — arrow key, Home, End navigation is automatic
46
+ - `<Dialog>` / `<Modal>` — always provide an accessible name; **prefer `aria-labelledby`** to a visible title when one exists, otherwise `aria-label`. Focus lock and Escape are handled by the components.
47
+
48
+ ## Every interactive control needs an accessible name
49
+
50
+ - **`<IconButton>`** — provide `tip` (becomes the accessible name for icon-only)
51
+ - **`<InfoTip>`** — provide `ariaLabel` or `ariaLabelledby`; there is no automatic fallback
52
+ - Icon SVGs next to visible text — add `aria-hidden="true"` to decorative icons
53
+
54
+ ## Form label association
55
+
56
+ Match `htmlFor` on `<FormGroupLabel>` with the `id` on the input. `<FormGroup>` auto-wires `aria-live` for `error` and `description` — do not add redundant live regions manually.
57
+
58
+ ## Screen-reader-only text
59
+
60
+ Use `<Text screenreader>` for visually hidden but announced content. `<HiddenText>` is deprecated.
61
+
62
+ ## Color and contrast
63
+
64
+ Do not hardcode hex values for adaptive UI. Gamut semantic color tokens through `ColorMode` are built for WCAG AA; see the `gamut-color-mode` skill for token usage. Semantic colors only guarantee contrast when the subtree is under the right **ColorMode** or **`<Background>`** context — use those primitives for section surfaces, not ad hoc `background-color`. For non-text contrast, focus order, and ARIA beyond color, see `gamut-accessibility`.
65
+
66
+ ## Focus visibility
67
+
68
+ Never suppress focus indicators with `outline: none` or `outline: 0` without a visible replacement. Gamut's focus styles are intentional and meet WCAG 2.4.7.