Skip to content

Commit 39575b7

Browse files
authored
feat(tokens): introduce foundational CSS design token system (Part 1 of #6606) (#7315)
* feat: add centralized CSS design tokens system Introduces tokens.css with semantic variables for colors, spacing, typography, and shadows. Includes support for light, dark, and high-contrast themes. * Added the minimal import @import url in tokens.css
1 parent 4178833 commit 39575b7

2 files changed

Lines changed: 150 additions & 0 deletions

File tree

css/style.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@import url("tokens.css");
2+
13
html, body {
24
overscroll-behavior-x: none;
35
}

css/tokens.css

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
/**
2+
* MusicBlocks Design Tokens
3+
* A centralized design system for consistent UI theming.
4+
*/
5+
6+
:root {
7+
/* =========================================================================
8+
Base Colors (Light Theme Default)
9+
========================================================================= */
10+
--color-bg-primary: #ffffff;
11+
--color-bg-secondary: #f3f4f6;
12+
--color-bg-tertiary: #e5e7eb;
13+
14+
--color-text-primary: #1f2937;
15+
--color-text-secondary: #4b5563;
16+
--color-text-tertiary: #9ca3af;
17+
--color-text-inverse: #ffffff;
18+
19+
--color-border-primary: #d1d5db;
20+
--color-border-secondary: #e5e7eb;
21+
22+
/* Semantic Brand & State Colors */
23+
--color-brand-primary: #3b82f6;
24+
--color-brand-primary-hover: #2563eb;
25+
--color-brand-secondary: #8b5cf6;
26+
27+
--color-success: #10b981;
28+
--color-success-bg: #d1fae5;
29+
--color-warning: #f59e0b;
30+
--color-warning-bg: #fef3c7;
31+
--color-error: #ef4444;
32+
--color-error-bg: #fee2e2;
33+
--color-info: #3b82f6;
34+
--color-info-bg: #dbeafe;
35+
36+
/* =========================================================================
37+
Spacing (Base 4px scale)
38+
========================================================================= */
39+
--spacing-xs: 0.25rem; /* 4px */
40+
--spacing-sm: 0.5rem; /* 8px */
41+
--spacing-md: 1rem; /* 16px */
42+
--spacing-lg: 1.5rem; /* 24px */
43+
--spacing-xl: 2rem; /* 32px */
44+
--spacing-2xl: 3rem; /* 48px */
45+
46+
/* =========================================================================
47+
Typography
48+
========================================================================= */
49+
--font-family-system: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
50+
--font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
51+
52+
--font-size-xs: 0.75rem; /* 12px */
53+
--font-size-sm: 0.875rem; /* 14px */
54+
--font-size-md: 1rem; /* 16px */
55+
--font-size-lg: 1.125rem; /* 18px */
56+
--font-size-xl: 1.25rem; /* 20px */
57+
--font-size-2xl: 1.5rem; /* 24px */
58+
59+
--font-weight-normal: 400;
60+
--font-weight-medium: 500;
61+
--font-weight-semibold: 600;
62+
--font-weight-bold: 700;
63+
64+
--line-height-tight: 1.25;
65+
--line-height-normal: 1.5;
66+
--line-height-loose: 2;
67+
68+
/* =========================================================================
69+
Border Radius
70+
========================================================================= */
71+
--radius-sm: 0.25rem; /* 4px */
72+
--radius-md: 0.375rem; /* 6px */
73+
--radius-lg: 0.5rem; /* 8px */
74+
--radius-xl: 0.75rem; /* 12px */
75+
--radius-full: 9999px; /* Pill shape */
76+
77+
/* =========================================================================
78+
Shadows
79+
========================================================================= */
80+
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
81+
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
82+
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
83+
--shadow-focus: 0 0 0 3px rgba(59, 130, 246, 0.5);
84+
}
85+
86+
/* ==========================================================================
87+
Dark Theme
88+
========================================================================== */
89+
[data-theme="dark"] {
90+
--color-bg-primary: #111827;
91+
--color-bg-secondary: #1f2937;
92+
--color-bg-tertiary: #374151;
93+
94+
--color-text-primary: #f9fafb;
95+
--color-text-secondary: #d1d5db;
96+
--color-text-tertiary: #9ca3af;
97+
--color-text-inverse: #111827;
98+
99+
--color-border-primary: #4b5563;
100+
--color-border-secondary: #374151;
101+
102+
--color-brand-primary: #60a5fa;
103+
--color-brand-primary-hover: #3b82f6;
104+
--color-brand-secondary: #a78bfa;
105+
106+
/* Adjusted state backgrounds for dark mode */
107+
--color-success-bg: rgba(16, 185, 129, 0.2);
108+
--color-warning-bg: rgba(245, 158, 11, 0.2);
109+
--color-error-bg: rgba(239, 68, 68, 0.2);
110+
--color-info-bg: rgba(59, 130, 246, 0.2);
111+
112+
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
113+
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.4);
114+
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
115+
--shadow-focus: 0 0 0 3px rgba(96, 165, 250, 0.5);
116+
}
117+
118+
/* ==========================================================================
119+
High-Contrast Theme
120+
========================================================================== */
121+
[data-theme="high-contrast"] {
122+
--color-bg-primary: #000000;
123+
--color-bg-secondary: #000000;
124+
--color-bg-tertiary: #000000;
125+
126+
--color-text-primary: #ffffff;
127+
--color-text-secondary: #ffff00;
128+
--color-text-tertiary: #ffffff;
129+
--color-text-inverse: #000000;
130+
131+
--color-border-primary: #ffffff;
132+
--color-border-secondary: #ffffff;
133+
134+
--color-brand-primary: #ffff00;
135+
--color-brand-primary-hover: #ffffff;
136+
--color-brand-secondary: #00ffff;
137+
138+
--color-success: #00ff00;
139+
--color-success-bg: #000000;
140+
--color-warning: #ffaa00;
141+
--color-warning-bg: #000000;
142+
--color-error: #ff0000;
143+
--color-error-bg: #000000;
144+
--color-info: #00ffff;
145+
--color-info-bg: #000000;
146+
147+
--shadow-focus: 0 0 0 4px #ffff00;
148+
}

0 commit comments

Comments
 (0)