@istmx/skills 1.0.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 (210) hide show
  1. package/README.md +49 -0
  2. package/bin/cli.js +251 -0
  3. package/istm/SKILL.md +65 -0
  4. package/istm-animate/SKILL.md +87 -0
  5. package/istm-animate/animations/animation_utils.md +280 -0
  6. package/istm-animate/animations/animations.md +220 -0
  7. package/istm-animate/animations/core_motion.md +250 -0
  8. package/istm-animate/animations/examples/README.md +29 -0
  9. package/istm-animate/animations/examples/nuxt/app/app.vue +3 -0
  10. package/istm-animate/animations/examples/nuxt/app/composables/useGSAP.ts +91 -0
  11. package/istm-animate/animations/examples/nuxt/app/pages/index.vue +55 -0
  12. package/istm-animate/animations/examples/nuxt/nuxt.config.ts +4 -0
  13. package/istm-animate/animations/examples/nuxt/package.json +18 -0
  14. package/istm-animate/animations/examples/react/App.jsx +46 -0
  15. package/istm-animate/animations/examples/react/index.html +12 -0
  16. package/istm-animate/animations/examples/react/main.jsx +9 -0
  17. package/istm-animate/animations/examples/react/package.json +21 -0
  18. package/istm-animate/animations/examples/react/vite.config.js +7 -0
  19. package/istm-animate/animations/examples/vanilla/index.html +33 -0
  20. package/istm-animate/animations/examples/vanilla/main.js +36 -0
  21. package/istm-animate/animations/examples/vue/app.vue +47 -0
  22. package/istm-animate/animations/examples/vue/index.html +15 -0
  23. package/istm-animate/animations/examples/vue/main.js +9 -0
  24. package/istm-animate/animations/examples/vue/package.json +19 -0
  25. package/istm-animate/animations/examples/vue/vite.config.js +7 -0
  26. package/istm-animate/animations/framework_motion.md +262 -0
  27. package/istm-animate/animations/motion.csv +17 -0
  28. package/istm-animate/animations/motion.md +11 -0
  29. package/istm-animate/animations/motion_catalog.json +226 -0
  30. package/istm-animate/animations/motion_performance.md +75 -0
  31. package/istm-animate/animations/motion_plugins.md +429 -0
  32. package/istm-animate/animations/react_animations.md +132 -0
  33. package/istm-animate/animations/scroll_trigger_effects.md +291 -0
  34. package/istm-animate/animations/timeline_sequencing.md +103 -0
  35. package/istm-architecture/SKILL.md +109 -0
  36. package/istm-architecture/frameworks/angular.csv +51 -0
  37. package/istm-architecture/frameworks/astro.csv +54 -0
  38. package/istm-architecture/frameworks/avalonia.csv +57 -0
  39. package/istm-architecture/frameworks/flutter.csv +53 -0
  40. package/istm-architecture/frameworks/javafx.csv +76 -0
  41. package/istm-architecture/frameworks/jetpack-compose.csv +53 -0
  42. package/istm-architecture/frameworks/laravel.csv +51 -0
  43. package/istm-architecture/frameworks/nextjs.csv +53 -0
  44. package/istm-architecture/frameworks/nuxtjs.csv +59 -0
  45. package/istm-architecture/frameworks/react-native.csv +52 -0
  46. package/istm-architecture/frameworks/react.csv +54 -0
  47. package/istm-architecture/frameworks/svelte.csv +54 -0
  48. package/istm-architecture/frameworks/swiftui.csv +51 -0
  49. package/istm-architecture/frameworks/uwp.csv +56 -0
  50. package/istm-architecture/frameworks/vue.csv +50 -0
  51. package/istm-architecture/frameworks/winui.csv +60 -0
  52. package/istm-architecture/frameworks/wpf.csv +57 -0
  53. package/istm-architecture/templates/agents.md +229 -0
  54. package/istm-architecture/templates/architecture.md +111 -0
  55. package/istm-architecture/templates/design.md +138 -0
  56. package/istm-architecture/templates/project-overview.md +215 -0
  57. package/istm-awwward-designer/SKILL.md +43 -0
  58. package/istm-awwward-designer/libraries/threejs.csv +54 -0
  59. package/istm-awwward-designer/references/accessibility.md +774 -0
  60. package/istm-awwward-designer/references/anim-anti-patterns.md +576 -0
  61. package/istm-awwward-designer/references/animation-map.md +166 -0
  62. package/istm-awwward-designer/references/animation-standards.md +86 -0
  63. package/istm-awwward-designer/references/anti-patterns.md +191 -0
  64. package/istm-awwward-designer/references/color-systems.md +604 -0
  65. package/istm-awwward-designer/references/css-performance.md +477 -0
  66. package/istm-awwward-designer/references/descender-safety.md +490 -0
  67. package/istm-awwward-designer/references/design-audit.md +93 -0
  68. package/istm-awwward-designer/references/font-loading.md +378 -0
  69. package/istm-awwward-designer/references/image-optimization.md +440 -0
  70. package/istm-awwward-designer/references/invention-gate.md +356 -0
  71. package/istm-awwward-designer/references/micro-interactions.md +825 -0
  72. package/istm-awwward-designer/references/page-transitions.md +365 -0
  73. package/istm-awwward-designer/references/performance-standards.md +79 -0
  74. package/istm-awwward-designer/references/quality-gate.md +103 -0
  75. package/istm-awwward-designer/references/responsive-design.md +778 -0
  76. package/istm-awwward-designer/references/scoring-guide.md +201 -0
  77. package/istm-awwward-designer/references/scroll-patterns.md +668 -0
  78. package/istm-awwward-designer/references/stitch-brief.md +124 -0
  79. package/istm-awwward-designer/references/tech-stack.md +204 -0
  80. package/istm-awwward-designer/references/technical-audit.md +133 -0
  81. package/istm-awwward-designer/references/technique-families.md +293 -0
  82. package/istm-awwward-designer/references/testing.md +535 -0
  83. package/istm-awwward-designer/references/text-animation.md +585 -0
  84. package/istm-awwward-designer/references/typography.md +504 -0
  85. package/istm-awwward-designer/references/usability-audit.md +108 -0
  86. package/istm-awwward-designer/references/visual-standards.md +97 -0
  87. package/istm-design/SKILL.md +98 -0
  88. package/istm-design/colors/color_theory.md +293 -0
  89. package/istm-design/colors/colors.csv +193 -0
  90. package/istm-design/colors/colors_catalog.json +4034 -0
  91. package/istm-design/colors/palette.json +21 -0
  92. package/istm-design/styles/design_system.md +288 -0
  93. package/istm-design/styles/html-tailwind.csv +56 -0
  94. package/istm-design/styles/nuxt-ui.csv +71 -0
  95. package/istm-design/styles/product_design.md +55 -0
  96. package/istm-design/styles/shadcn.csv +61 -0
  97. package/istm-design/styles/style.md +12 -0
  98. package/istm-design/styles/styles.csv +85 -0
  99. package/istm-design/styles/styles_catalog.json +2018 -0
  100. package/istm-design/styles/ui-reasoning.csv +162 -0
  101. package/istm-design/styles/uno.csv +60 -0
  102. package/istm-design/typography/font_and_font.md +10 -0
  103. package/istm-design/typography/google-fonts.csv +1924 -0
  104. package/istm-design/typography/sans_serif_fonts.md +112 -0
  105. package/istm-design/typography/typography.csv +75 -0
  106. package/istm-design/typography/typography_catalog.json +964 -0
  107. package/istm-design/ux/app-interface.csv +31 -0
  108. package/istm-design/ux/charts.csv +26 -0
  109. package/istm-design/ux/icons.csv +106 -0
  110. package/istm-design/ux/landing.csv +35 -0
  111. package/istm-design/ux/products.csv +193 -0
  112. package/istm-design/ux/react-performance.csv +45 -0
  113. package/istm-design/ux/responsive_rules.md +62 -0
  114. package/istm-design/ux/storytelling.md +47 -0
  115. package/istm-design/ux/ux-guidelines.csv +100 -0
  116. package/istm-design/ux/ux_guidelines.json +1190 -0
  117. package/istm-system-design/SKILL.md +88 -0
  118. package/istm-system-design/principles/01-architecture-patterns.md +24 -0
  119. package/istm-system-design/principles/02-database-selection.md +32 -0
  120. package/istm-system-design/principles/03-api-design.md +25 -0
  121. package/istm-system-design/principles/04-authentication-security.md +23 -0
  122. package/istm-system-design/principles/05-caching-performance.md +21 -0
  123. package/istm-system-design/principles/06-asynchronous-processing.md +17 -0
  124. package/istm-system-design/principles/07-infrastructure-deployment.md +22 -0
  125. package/istm-system-design/principles/08-low-level-design.md +35 -0
  126. package/istm-system-design/principles/09-state-management.md +14 -0
  127. package/istm-system-design/principles/10-error-handling-and-logging.md +26 -0
  128. package/istm-system-design/principles/11-testing-strategy.md +18 -0
  129. package/istm-system-design/principles/12-seo-and-web-vitals.md +18 -0
  130. package/istm-system-design/stacks/SETUP.md +82 -0
  131. package/istm-system-design/stacks/STACK.md +67 -0
  132. package/istm-system-design/stacks/WORKFLOW.md +84 -0
  133. package/istm-system-design/templates/api-route.ts.template +32 -0
  134. package/istm-system-design/templates/migrations.md.template +30 -0
  135. package/istm-system-design/templates/schema.drizzle.ts.template +17 -0
  136. package/istm-system-design/templates/schema.prisma.template +28 -0
  137. package/istm-system-design/templates/trpc-router.ts.template +22 -0
  138. package/istm-system-design/templates/zod-validators.ts.template +14 -0
  139. package/istm-workflow/istm-audit/SKILL.md +108 -0
  140. package/istm-workflow/istm-audit/agent-prompt.md +393 -0
  141. package/istm-workflow/istm-audit/agents/openai.yaml +7 -0
  142. package/istm-workflow/istm-audit/modes/area.md +19 -0
  143. package/istm-workflow/istm-audit/modes/gapfill.md +12 -0
  144. package/istm-workflow/istm-audit/modes/greenfield.md +24 -0
  145. package/istm-workflow/istm-audit/modes/tool-skills.md +39 -0
  146. package/istm-workflow/istm-audit/modes/whole-repo.md +5 -0
  147. package/istm-workflow/istm-audit/patterns/clean-architecture.md +15 -0
  148. package/istm-workflow/istm-audit/patterns/domain-driven.md +16 -0
  149. package/istm-workflow/istm-audit/patterns/functional.md +16 -0
  150. package/istm-workflow/istm-audit/patterns/solid-oop.md +17 -0
  151. package/istm-workflow/istm-check/SKILL.md +52 -0
  152. package/istm-workflow/istm-check/agents/openai.yaml +7 -0
  153. package/istm-workflow/istm-check/modes/review.md +156 -0
  154. package/istm-workflow/istm-check/modes/verify.md +197 -0
  155. package/istm-workflow/istm-check/review-agent-prompt.md +57 -0
  156. package/istm-workflow/istm-check/review-guide.md +133 -0
  157. package/istm-workflow/istm-craft/SKILL.md +37 -0
  158. package/istm-workflow/istm-craft/agent-modes/architecture.md +73 -0
  159. package/istm-workflow/istm-craft/agent-modes/cross-cutting.md +65 -0
  160. package/istm-workflow/istm-craft/agent-modes/enhancement.md +45 -0
  161. package/istm-workflow/istm-craft/agent-modes/feature.md +85 -0
  162. package/istm-workflow/istm-craft/agent-prompt.md +249 -0
  163. package/istm-workflow/istm-craft/agents/openai.yaml +7 -0
  164. package/istm-workflow/istm-craft/internal/after-subagent.md +90 -0
  165. package/istm-workflow/istm-craft/internal/design-conversation.md +140 -0
  166. package/istm-workflow/istm-craft/internal/tool-discovery.md +58 -0
  167. package/istm-workflow/istm-craft/spec-template.md +278 -0
  168. package/istm-workflow/istm-debug/SKILL.md +102 -0
  169. package/istm-workflow/istm-debug/agents/openai.yaml +7 -0
  170. package/istm-workflow/istm-develop/SKILL.md +144 -0
  171. package/istm-workflow/istm-develop/agents/openai.yaml +7 -0
  172. package/istm-workflow/istm-develop/checklist.md +95 -0
  173. package/istm-workflow/istm-develop/flow/build.md +133 -0
  174. package/istm-workflow/istm-develop/flow/git.md +34 -0
  175. package/istm-workflow/istm-develop/logical-guide.md +99 -0
  176. package/istm-workflow/istm-develop/ui/existing.md +23 -0
  177. package/istm-workflow/istm-develop/ui/generate.md +131 -0
  178. package/istm-workflow/istm-develop/ui/image.md +41 -0
  179. package/istm-workflow/istm-develop/ui/implementation.md +281 -0
  180. package/istm-workflow/istm-develop/ui/mcp.md +11 -0
  181. package/istm-workflow/istm-develop/ui-guide.md +164 -0
  182. package/istm-workflow/istm-document/SKILL.md +123 -0
  183. package/istm-workflow/istm-document/agent-prompt.md +57 -0
  184. package/istm-workflow/istm-document/agents/openai.yaml +7 -0
  185. package/istm-workflow/istm-document/templates/changelog.md +54 -0
  186. package/istm-workflow/istm-document/templates/postmortem.md +58 -0
  187. package/istm-workflow/istm-document/templates/pr.md +43 -0
  188. package/istm-workflow/istm-document/templates/release-note.md +41 -0
  189. package/istm-workflow/istm-scope/SKILL.md +100 -0
  190. package/istm-workflow/istm-scope/agents/openai.yaml +7 -0
  191. package/istm-workflow/istm-scope/approaches/facade.md +33 -0
  192. package/istm-workflow/istm-scope/approaches/journey.md +31 -0
  193. package/istm-workflow/istm-scope/approaches/skateboard.md +33 -0
  194. package/istm-workflow/istm-scope/approaches/tracer-bullet.md +34 -0
  195. package/istm-workflow/istm-scope/modes/add.md +14 -0
  196. package/istm-workflow/istm-scope/modes/plan-brownfield.md +11 -0
  197. package/istm-workflow/istm-scope/modes/plan-greenfield.md +20 -0
  198. package/istm-workflow/istm-scope/modes/plan-monorepo.md +8 -0
  199. package/istm-workflow/istm-scope/modes/plan.md +120 -0
  200. package/istm-workflow/istm-scope/modes/replan.md +13 -0
  201. package/istm-workflow/istm-scope/scope-template.md +148 -0
  202. package/istm-workflow/istm-sync/SKILL.md +166 -0
  203. package/istm-workflow/istm-sync/agent-prompt.md +211 -0
  204. package/istm-workflow/istm-sync/agents/openai.yaml +7 -0
  205. package/istm-workflow/istm-test/SKILL.md +233 -0
  206. package/istm-workflow/istm-test/agent-prompt.md +62 -0
  207. package/istm-workflow/istm-test/agents/openai.yaml +7 -0
  208. package/istm-workflow/istm-test/modes/setup.md +97 -0
  209. package/istm-workflow/istm-test/writing-guide.md +196 -0
  210. package/package.json +35 -0
@@ -0,0 +1,604 @@
1
+ # Color Systems Deep Dive
2
+
3
+ > "Color is a power which directly influences the soul." — Wassily Kandinsky
4
+
5
+ This reference covers color token architecture (3-layer system), light/dark mode implementation,
6
+ WCAG contrast requirements, OKLCH color spaces, and animation-friendly color systems.
7
+
8
+ ---
9
+
10
+ ## Token Architecture: 3-Layer System
11
+
12
+ A robust color system uses three distinct layers. Never skip layers or mix them.
13
+
14
+ ```
15
+ ┌─────────────────────────────────────────────────────┐
16
+ │ Layer 1: Primitives │
17
+ │ Raw values. NEVER use directly in components. │
18
+ │ --primitive-gray-50: #f9fafb │
19
+ │ --primitive-blue-500: #3b82f6 │
20
+ └──────────────────────┬──────────────────────────────┘
21
+ │ consumed by
22
+ ┌──────────────────────▼──────────────────────────────┐
23
+ │ Layer 2: Semantics │
24
+ │ Intent-based. USE THESE in all components. │
25
+ │ --color-bg-primary: var(--primitive-gray-50) │
26
+ │ --color-text-primary: var(--primitive-gray-900) │
27
+ │ --color-accent: var(--primitive-blue-500) │
28
+ └──────────────────────┬──────────────────────────────┘
29
+ │ consumed by
30
+ ┌──────────────────────▼──────────────────────────────┐
31
+ │ Layer 3: Component-specific tokens │
32
+ │ Reference semantics. Optional convenience layer. │
33
+ │ --color-button-bg: var(--color-accent) │
34
+ │ --color-nav-text: var(--color-text-secondary) │
35
+ └─────────────────────────────────────────────────────┘
36
+ ```
37
+
38
+ ### Why Three Layers?
39
+
40
+ 1. **Primitives** — Enable systematic generation (e.g., generate all shades from one base)
41
+ 2. **Semantics** — Allow theme switching (swap dark/light by changing one layer)
42
+ 3. **Components** — Prevent token sprawl, ensure consistency across the codebase
43
+
44
+ ### Primitive Palette Structure
45
+
46
+ ```css
47
+ :root {
48
+ /* Gray Scale — 50 (lightest) to 950 (darkest) */
49
+ --primitive-gray-50: #f9fafb;
50
+ --primitive-gray-100: #f3f4f6;
51
+ --primitive-gray-200: #e5e7eb;
52
+ --primitive-gray-300: #d1d5db;
53
+ --primitive-gray-400: #9ca3af;
54
+ --primitive-gray-500: #6b7280;
55
+ --primitive-gray-600: #4b5563;
56
+ --primitive-gray-700: #374151;
57
+ --primitive-gray-800: #1f2937;
58
+ --primitive-gray-900: #111827;
59
+ --primitive-gray-950: #030712;
60
+
61
+ /* Blue Accent Scale */
62
+ --primitive-blue-50: #eff6ff;
63
+ --primitive-blue-100: #dbeafe;
64
+ --primitive-blue-200: #bfdbfe;
65
+ --primitive-blue-300: #93c5fd;
66
+ --primitive-blue-400: #60a5fa;
67
+ --primitive-blue-500: #3b82f6;
68
+ --primitive-blue-600: #2563eb;
69
+ --primitive-blue-700: #1d4ed8;
70
+ --primitive-blue-800: #1e40af;
71
+ --primitive-blue-900: #1e3a8a;
72
+ --primitive-blue-950: #172554;
73
+
74
+ /* Accent colors (brand-specific) — example with violet */
75
+ --primitive-violet-50: #f5f3ff;
76
+ --primitive-violet-100: #ede9fe;
77
+ --primitive-violet-200: #ddd6fe;
78
+ --primitive-violet-300: #c4b5fd;
79
+ --primitive-violet-400: #a78bfa;
80
+ --primitive-violet-500: #8b5cf6;
81
+ --primitive-violet-600: #7c3aed;
82
+ --primitive-violet-700: #6d28d9;
83
+ --primitive-violet-800: #5b21b6;
84
+ --primitive-violet-900: #4c1d95;
85
+
86
+ /* Success / Warning / Error */
87
+ --primitive-green-500: #22c55e;
88
+ --primitive-green-600: #16a34a;
89
+ --primitive-red-500: #ef4444;
90
+ --primitive-red-600: #dc2626;
91
+ --primitive-amber-500: #f59e0b;
92
+ --primitive-amber-600: #d97706;
93
+ }
94
+ ```
95
+
96
+ ### Semantic Token Layer
97
+
98
+ ```css
99
+ :root {
100
+ /* === BACKGROUND === */
101
+ --color-bg-page: var(--primitive-gray-50);
102
+ --color-bg-surface: var(--primitive-gray-100);
103
+ --color-bg-elevated: var(--primitive-gray-0);
104
+ --color-bg-overlay: var(--primitive-gray-900);
105
+ --color-bg-inverse: var(--primitive-gray-950);
106
+
107
+ /* === TEXT === */
108
+ --color-text-primary: var(--primitive-gray-900);
109
+ --color-text-secondary: var(--primitive-gray-600);
110
+ --color-text-tertiary: var(--primitive-gray-400);
111
+ --color-text-inverse: var(--primitive-gray-0);
112
+ --color-text-disabled: var(--primitive-gray-300);
113
+ --color-text-link: var(--primitive-blue-600);
114
+ --color-text-link-hover: var(--primitive-blue-700);
115
+
116
+ /* === BORDERS === */
117
+ --color-border-default: var(--primitive-gray-200);
118
+ --color-border-strong: var(--primitive-gray-300);
119
+ --color-border-focus: var(--primitive-blue-500);
120
+ --color-border-inverse: var(--primitive-gray-700);
121
+
122
+ /* === ACCENT / BRAND === */
123
+ --color-accent: var(--primitive-blue-500);
124
+ --color-accent-hover: var(--primitive-blue-600);
125
+ --color-accent-muted: var(--primitive-blue-100);
126
+ --color-accent-subtle: var(--primitive-blue-50);
127
+
128
+ /* === INTERACTIVE === */
129
+ --color-interactive-primary: var(--primitive-blue-600);
130
+ --color-interactive-hover: var(--primitive-blue-700);
131
+ --color-interactive-pressed: var(--primitive-blue-800);
132
+ --color-interactive-focus-ring: var(--primitive-blue-500);
133
+
134
+ /* === SEMANTIC === */
135
+ --color-success: var(--primitive-green-600);
136
+ --color-success-bg: var(--primitive-green-500);
137
+ --color-warning: var(--primitive-amber-600);
138
+ --color-error: var(--primitive-red-600);
139
+ --color-info: var(--primitive-blue-600);
140
+ }
141
+ ```
142
+
143
+ ### Component Token Examples
144
+
145
+ ```css
146
+ /* Buttons */
147
+ --button-primary-bg: var(--color-accent);
148
+ --button-primary-bg-hover: var(--color-accent-hover);
149
+ --button-primary-text: var(--color-text-inverse);
150
+ --button-secondary-border: var(--color-border-strong);
151
+
152
+ /* Cards */
153
+ --card-bg: var(--color-bg-surface);
154
+ --card-border: var(--color-border-default);
155
+ --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
156
+
157
+ /* Navigation */
158
+ --nav-bg: var(--color-bg-elevated);
159
+ --nav-text: var(--color-text-secondary);
160
+ --nav-text-active: var(--color-text-primary);
161
+ --nav-hover-bg: var(--color-bg-surface);
162
+
163
+ /* Form inputs */
164
+ --input-bg: var(--color-bg-elevated);
165
+ --input-border: var(--color-border-default);
166
+ --input-border-focus: var(--color-border-focus);
167
+ --input-text: var(--color-text-primary);
168
+ --input-placeholder: var(--color-text-tertiary);
169
+ ```
170
+
171
+ ---
172
+
173
+ ## Light Mode Palette
174
+
175
+ ### Light Mode Color Strategy
176
+
177
+ Light mode should feel crisp and spacious. Key principles:
178
+
179
+ 1. **Background hierarchy** — Use 2–3 background shades (page, surface, elevated) for depth
180
+ 2. **Text hierarchy** — 3 text levels (primary, secondary, tertiary) with clear contrast steps
181
+ 3. **Avoid pure black** — `--primitive-gray-900` (#111827) reads softer than #000 on light backgrounds
182
+ 4. **Subtle borders** — Borders should be visible but not harsh. `--primitive-gray-200` (#e5e7eb)
183
+
184
+ ### Full Light Mode Palette
185
+
186
+ ```css
187
+ :root,
188
+ :root[data-theme="light"] {
189
+ /* Surfaces — layered depth */
190
+ --color-bg-page: #ffffff;
191
+ --color-bg-surface: #f9fafb;
192
+ --color-bg-raised: #ffffff;
193
+ --color-bg-overlay: #111827;
194
+ --color-bg-sunken: #f3f4f6;
195
+
196
+ /* Text — three levels */
197
+ --color-text-primary: #111827; /* 16.1:1 on white — AAA */
198
+ --color-text-secondary: #4b5563; /* 7.0:1 on white — AAA */
199
+ --color-text-tertiary: #9ca3af; /* 3.0:1 on white — only for decorative/disabled */
200
+ --color-text-inverse: #ffffff;
201
+
202
+ /* Accent — primary brand color */
203
+ --color-accent: #3b82f6; /* 4.6:1 on white — AA */
204
+ --color-accent-hover: #2563eb;
205
+ --color-accent-muted: #dbeafe;
206
+ --color-accent-subtle: #eff6ff;
207
+
208
+ /* Borders */
209
+ --color-border-default: #e5e7eb;
210
+ --color-border-strong: #d1d5db;
211
+ --color-border-focus: #3b82f6;
212
+
213
+ /* Semantic */
214
+ --color-success: #16a34a;
215
+ --color-warning: #d97706;
216
+ --color-error: #dc2626;
217
+ --color-info: #2563eb;
218
+ }
219
+ ```
220
+
221
+ ---
222
+
223
+ ## Dark Mode
224
+
225
+ ### Dark Mode Considerations
226
+
227
+ 1. **Don't just invert** — Dark mode is not a photo negative. Colors behave differently in dark environments.
228
+ 2. **Reduce saturation** — Highly saturated colors are jarring in dark mode. Desaturate by 10–20%.
229
+ 3. **Elevate surfaces** — Dark backgrounds use lighter grays for raised elements (opposite of light mode).
230
+ 4. **Preserve accent vibrancy** — Brand accents can remain saturated; they're accent, not background.
231
+ 5. **Test on actual dark theme** — sRGB on a bright phone in a dark room is very different from a dark room on a dim monitor.
232
+
233
+ ### Full Dark Mode Palette
234
+
235
+ ```css
236
+ @media (prefers-color-scheme: dark) {
237
+ :root {
238
+ /* Surfaces — lighter on top (inverted hierarchy from light mode) */
239
+ --color-bg-page: #0a0a0a;
240
+ --color-bg-surface: #111827;
241
+ --color-bg-raised: #1f2937;
242
+ --color-bg-overlay: #f9fafb;
243
+ --color-bg-sunken: #030712;
244
+
245
+ /* Text — softer whites */
246
+ --color-text-primary: #f9fafb; /* ~21:1 on #0a0a */
247
+ --color-text-secondary: #9ca3af; /* ~7:1 on #0a0a */
248
+ --color-text-tertiary: #6b7280; /* ~4.5:1 on #0a0a */
249
+ --color-text-inverse: #111827;
250
+
251
+ /* Accent — slightly desaturated but still vibrant */
252
+ --color-accent: #60a5fa; /* ~5.2:1 on dark bg */
253
+ --color-accent-hover: #93c5fd;
254
+ --color-accent-muted: #1e3a8a;
255
+ --color-accent-subtle: #172554;
256
+
257
+ /* Borders — lighter in dark mode for visibility */
258
+ --color-border-default: #374151;
259
+ --color-border-strong: #4b5563;
260
+ --color-border-focus: #60a5fa;
261
+
262
+ /* Semantic — keep colors vivid enough to communicate meaning */
263
+ --color-success: #22c55e;
264
+ --color-warning: #f59e0b;
265
+ --color-error: #ef4444;
266
+ --color-info: #60a5fa;
267
+ }
268
+ }
269
+ ```
270
+
271
+ ### Class-Based Dark Mode Toggle
272
+
273
+ ```css
274
+ /* Default: light mode via CSS custom properties */
275
+ :root {
276
+ --color-bg-page: #ffffff;
277
+ --color-text-primary: #111827;
278
+ /* ... */
279
+ }
280
+
281
+ /* Dark mode override */
282
+ [data-theme="dark"] {
283
+ --color-bg-page: #0a0a0a;
284
+ --color-text-primary: #f9fafb;
285
+ /* ... */
286
+ }
287
+ ```
288
+
289
+ ```javascript
290
+ // Toggle function
291
+ function toggleTheme() {
292
+ const html = document.documentElement;
293
+ const current = html.getAttribute('data-theme');
294
+ html.setAttribute('data-theme', current === 'dark' ? 'light' : 'dark');
295
+ }
296
+ ```
297
+
298
+ ---
299
+
300
+ ## WCAG Contrast Reference Table
301
+
302
+ ### Contrast Ratios for Common Color Combinations
303
+
304
+ | Foreground | Background | Ratio | WCAG AA | WCAG AAA |
305
+ |------------|------------|--------|---------|----------|
306
+ | #111827 (gray-900) | #ffffff | 16.1:1 | ✅ AA | ✅ AAA |
307
+ | #1f2937 (gray-800) | #ffffff | 13.8:1 | ✅ AA | ✅ AAA |
308
+ | #374151 (gray-700) | #ffffff | 9.0:1 | ✅ AA | ✅ AAA |
309
+ | #4b5563 (gray-600) | #ffffff | 7.0:1 | ✅ AA | ✅ AAA |
310
+ | #6b7280 (gray-500) | #ffffff | 4.5:1 | ✅ AA | ❌ |
311
+ | #9ca3af (gray-400) | #ffffff | 3.0:1 | ⚠️ Large| ❌ |
312
+ | #3b82f6 (blue-500) | #ffffff | 3.0:1 | ⚠️ Large| ❌ |
313
+ | #2563eb (blue-600) | #ffffff | 4.6:1 | ✅ AA | ❌ |
314
+ | #1d4ed8 (blue-700) | #ffffff | 5.9:1 | ✅ AA | ❌ |
315
+ | #ffffff | #111827 | 16.1:1 | ✅ AA | ✅ AAA |
316
+ | #ffffff | #1f2937 | 13.8:1 | ✅ AA | ✅ AAA |
317
+ | #ffffff | #2563eb | 4.6:1 | ✅ AA | ❌ |
318
+ | #ffffff | #dc2626 | 4.6:1 | ✅ AA | ❌ |
319
+ | #ffffff | #16a34a | 4.5:1 | ✅ AA | ❌ |
320
+ | #d1d5db (gray-300) | #111827 | 7.2:1 | ✅ AA | ✅ AAA |
321
+ | #9ca3af (gray-400) | #111827 | 4.6:1 | ✅ AA | ❌ |
322
+
323
+ ### WCAG 2.1 Requirements Summary
324
+
325
+ | Level | Normal Text (< 18pt / < 14pt bold) | Large Text (≥ 18pt / ≥ 14pt bold) |
326
+ |-------|-------------------------------------|------------------------------------|
327
+ | AA | 4.5:1 minimum | 3.0:1 minimum |
328
+ | AAA | 7.0:1 minimum | 4.5:1 minimum |
329
+ | UI Components | 3.0:1 minimum (against adjacent color) |
330
+
331
+ ### Gray-500 Warning
332
+
333
+ `#6b7280` (gray-500) on `#ffffff` is **exactly 4.5:1** — the minimum AA threshold.
334
+ This is too risky for body text because:
335
+ - Browser rendering differences can reduce actual contrast
336
+ - Subpixel antialiasing affects perceived contrast
337
+ - It passes technically but fails practically
338
+
339
+ **Safe choice:** Use `#4b5563` (gray-600) or darker for body text. Reserve gray-500 for captions only.
340
+
341
+ ---
342
+
343
+ ## Color for Animation
344
+
345
+ ### HSL: Hue, Saturation, Lightness
346
+
347
+ HSL is the most intuitive color space for animation. Adjust any axis independently.
348
+
349
+ ```css
350
+ :root {
351
+ --accent-hue: 220;
352
+ --accent-sat: 70%;
353
+ --accent-light: 50%;
354
+ --accent: hsl(var(--accent-hue), var(--accent-sat), var(--accent-light));
355
+ }
356
+
357
+ /* Smooth color transitions */
358
+ .animated-accent {
359
+ background: hsl(220, 70%, 50%);
360
+ transition: background 0.3s ease;
361
+ }
362
+ .animated-accent:hover {
363
+ background: hsl(220, 70%, 60%);
364
+ }
365
+ ```
366
+
367
+ ### OKLCH: perceptually uniform
368
+
369
+ OKLCH is the modern replacement for HSL. It's perceptually uniform, meaning
370
+ equal steps in lightness look equally different to the human eye.
371
+
372
+ ```css
373
+ /* OKLCH syntax: oklch(L C H) */
374
+ /* L = Lightness (0–1, or 0%–100%) */
375
+ /* C = Chroma (color intensity, roughly 0–0.4) */
376
+ /* H = Hue (0–360 degrees) */
377
+
378
+ :root {
379
+ --color-accent: oklch(55% 0.2 250); /* Vibrant blue */
380
+ --color-accent-hover: oklch(60% 0.22 250);
381
+ --color-accent-muted: oklch(90% 0.05 250);
382
+ }
383
+
384
+ /* Smooth gradient with OKLCH — no muddy midpoints */
385
+ .gradient-hero {
386
+ background: linear-gradient(
387
+ 135deg,
388
+ oklch(55% 0.25 250) 0%, /* Blue */
389
+ oklch(65% 0.25 300) 50%, /* Purple — no hue gap */
390
+ oklch(60% 0.25 340) 100% /* Pink */
391
+ );
392
+ }
393
+ ```
394
+
395
+ ### OKLCH vs HSL for Gradients
396
+
397
+ HSL gradients create muddy midpoints because the hue channel isn't perceptually uniform:
398
+
399
+ ```
400
+ HSL: hsl(220, 70%, 50%) → hsl(280, 70%, 60%)
401
+ Midpoint: hsl(250, 70%, 55%) — looks grayish/muddy
402
+
403
+ OKLCH: oklch(55% 0.2 250) → oklch(65% 0.2 280)
404
+ Midpoint: oklch(60% 0.2 265) — stays vibrant throughout
405
+ ```
406
+
407
+ ### Color Transitions for Hover States
408
+
409
+ ```css
410
+ /* Button hover — smooth lift + color shift */
411
+ .button {
412
+ background: oklch(50% 0.15 250);
413
+ border: 1px solid oklch(60% 0.15 250);
414
+ transition:
415
+ background 0.2s ease,
416
+ border-color 0.2s ease,
417
+ transform 0.2s ease,
418
+ box-shadow 0.2s ease;
419
+ }
420
+ .button:hover {
421
+ background: oklch(55% 0.18 250);
422
+ border-color: oklch(65% 0.18 250);
423
+ transform: translateY(-1px);
424
+ box-shadow: 0 4px 12px oklch(50% 0.2 250 / 0.3);
425
+ }
426
+ ```
427
+
428
+ ---
429
+
430
+ ## CSS Custom Properties Implementation
431
+
432
+ ### Dark Mode with CSS Custom Properties
433
+
434
+ ```css
435
+ /* File: tokens/colors.css */
436
+
437
+ /* ============================================
438
+ 1. PRIMITIVE TOKENS (raw values)
439
+ ============================================ */
440
+ :root {
441
+ /* Grays */
442
+ --primitive-white: #ffffff;
443
+ --primitive-gray-50: #f9fafb;
444
+ --primitive-gray-100: #f3f4f6;
445
+ --primitive-gray-200: #e5e7eb;
446
+ --primitive-gray-300: #d1d5db;
447
+ --primitive-gray-400: #9ca3af;
448
+ --primitive-gray-500: #6b7280;
449
+ --primitive-gray-600: #4b5563;
450
+ --primitive-gray-700: #374151;
451
+ --primitive-gray-800: #1f2937;
452
+ --primitive-gray-900: #111827;
453
+ --primitive-black: #000000;
454
+
455
+ /* Brand */
456
+ --primitive-blue-50: #eff6ff;
457
+ --primitive-blue-500: #3b82f6;
458
+ --primitive-blue-600: #2563eb;
459
+ --primitive-blue-700: #1d4ed8;
460
+ }
461
+
462
+ /* ============================================
463
+ 2. SEMANTIC TOKENS (light mode default)
464
+ ============================================ */
465
+ :root {
466
+ --color-bg: var(--primitive-white);
467
+ --color-bg-subtle: var(--primitive-gray-50);
468
+ --color-text: var(--primitive-gray-900);
469
+ --color-text-muted: var(--primitive-gray-600);
470
+ --color-border: var(--primitive-gray-200);
471
+ --color-accent: var(--primitive-blue-500);
472
+ --color-accent-hover: var(--primitive-blue-600);
473
+ }
474
+
475
+ /* ============================================
476
+ 3. SEMANTIC TOKENS (dark mode)
477
+ ============================================ */
478
+ @media (prefers-color-scheme: dark) {
479
+ :root {
480
+ --color-bg: var(--primitive-gray-950);
481
+ --color-bg-subtle: var(--primitive-gray-900);
482
+ --color-text: var(--primitive-gray-50);
483
+ --color-text-muted: var(--primitive-gray-400);
484
+ --color-border: var(--primitive-gray-700);
485
+ --color-accent: var(--primitive-blue-400);
486
+ --color-accent-hover: var(--primitive-blue-300);
487
+ }
488
+ }
489
+
490
+ /* ============================================
491
+ 4. COMPONENT TOKENS (reference semantics)
492
+ ============================================ */
493
+ :root {
494
+ --button-bg: var(--color-accent);
495
+ --button-bg-hover: var(--color-accent-hover);
496
+ --button-text: var(--primitive-white);
497
+ --card-bg: var(--color-bg-subtle);
498
+ --card-border: var(--color-border);
499
+ --input-bg: var(--color-bg);
500
+ --input-border: var(--color-border);
501
+ --input-focus-ring: var(--color-accent);
502
+ }
503
+ ```
504
+
505
+ ### Usage in Components
506
+
507
+ ```css
508
+ /* Components ONLY reference semantic tokens */
509
+ .button {
510
+ background: var(--button-bg);
511
+ color: var(--button-text);
512
+ border: 1px solid var(--button-border);
513
+ border-radius: 0.375rem;
514
+ padding: 0.5rem 1rem;
515
+ font-weight: 500;
516
+ cursor: pointer;
517
+ transition: background 0.2s ease;
518
+ }
519
+
520
+ .button:hover {
521
+ background: var(--button-bg-hover);
522
+ }
523
+
524
+ .button:focus-visible {
525
+ outline: 2px solid var(--input-focus-ring);
526
+ outline-offset: 2px;
527
+ }
528
+
529
+ .card {
530
+ background: var(--card-bg);
531
+ border: 1px solid var(--card-border);
532
+ border-radius: 0.5rem;
533
+ padding: 1.5rem;
534
+ }
535
+ ```
536
+
537
+ ---
538
+
539
+ ## Color Accessibility
540
+
541
+ ### Always Test These Combinations
542
+
543
+ For every color system, verify at minimum:
544
+
545
+ 1. **Primary text on background** — `--color-text` on `--color-bg`
546
+ 2. **Secondary text on background** — `--color-text-muted` on `--color-bg`
547
+ 3. **Accent on background** — `--color-accent` on `--color-bg`
548
+ 4. **Accent on white** — `--color-accent` on white (for buttons on light cards)
549
+ 5. **Inverse text on accent** — white text on `--color-accent` (button text)
550
+ 6. **All semantic colors** — success/warning/error on their backgrounds
551
+
552
+ ### Contrast Tools
553
+
554
+ - **WebAIM Contrast Checker:** https://webaim.org/resources/contrastchecker/
555
+ - **Accessible Colors (generate palettes):** https://accessiblepalette.com/
556
+ - **Stark (Figma plugin):** Contrast checking directly in design files
557
+ - **axe DevTools:** Browser extension for automated accessibility testing
558
+
559
+ ### Non-Text Color (Charts, Graphs, Status Indicators)
560
+
561
+ Non-text color must pass 3:1 against adjacent colors AND be supplemented with shape, pattern, or text:
562
+
563
+ ```css
564
+ /* Bad: color alone conveys status */
565
+ .status-error { color: red; }
566
+ .status-success { color: green; }
567
+
568
+ /* Good: color + icon + text */
569
+ .status {
570
+ display: inline-flex;
571
+ align-items: center;
572
+ gap: 0.5rem;
573
+ padding: 0.25rem 0.5rem;
574
+ border-radius: 9999px;
575
+ font-size: 0.875rem;
576
+ font-weight: 500;
577
+ }
578
+ .status-error {
579
+ background: oklch(90% 0.15 25);
580
+ color: oklch(45% 0.2 25);
581
+ }
582
+ .status-error svg { fill: currentColor; }
583
+ .status-success {
584
+ background: oklch(90% 0.15 145);
585
+ color: oklch(45% 0.2 145);
586
+ }
587
+ ```
588
+
589
+ ### Focus Indicator Colors
590
+
591
+ Focus rings must have sufficient contrast (3:1 against both the background and the element):
592
+
593
+ ```css
594
+ /* Good: high contrast focus ring */
595
+ :focus-visible {
596
+ outline: 2px solid var(--primitive-blue-500); /* 4.6:1 on white */
597
+ outline-offset: 2px;
598
+ }
599
+
600
+ /* Bad: low contrast focus ring */
601
+ :focus-visible {
602
+ outline: 1px solid var(--primitive-gray-300); /* 2.5:1 on white — fails */
603
+ }
604
+ ```