Skip to content

Commit 02a9c37

Browse files
committed
refactor: design tokens and colors
1 parent 3f07928 commit 02a9c37

File tree

14 files changed

+235
-239
lines changed

14 files changed

+235
-239
lines changed

.cursor/rules/04-registry-components.mdc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Registry components are organized in three main locations:
1818
- Pass the rest of `...props` to the most important element.
1919
- Use `React.ComponentPropsWithRef` over `React.ComponentPropsWithoutRef`.
2020
- For composable parts, prefer `React.ReactNode` over `string`, e.g. labels.
21+
- Use the color tokens defined in [basil.css](mdc:app/basil.css) `--color-*` vars, e.g. "--color-primary" will be bg-primary, text-primary, etc.
2122

2223
## Adding a New Component
2324

app/app.css

Lines changed: 11 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
1-
@import 'tailwindcss';
2-
@import 'tw-animate-css';
3-
4-
@theme {
5-
--font-sans:
6-
'Inter', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
7-
'Noto Color Emoji';
8-
}
9-
10-
@custom-variant dark (&:is(.dark *));
11-
@custom-variant open (&:is([open], [data-open], [data-state="open"]));
12-
@custom-variant closed (&:is([closed], [data-closed], [data-state="closed"]));
13-
@custom-variant disabled (&:is([disabled], [data-disabled], [data-state="disabled"]));
14-
@custom-variant highlighted (&:is([data-highlighted]));
15-
@custom-variant pressed (&:is([pressed], [data-pressed], [data-state="pressed"], [aria-pressed=true]));
1+
@import './basil.css';
162

173
/* @custom-variant hidden (&:is([hidden])); */
184
/*
@@ -32,126 +18,25 @@
3218
light: ':root &, .light &',
3319
invalid: '&:is([aria-invalid])',*/
3420

35-
@theme inline {
36-
--color-background: var(--background);
37-
--color-foreground: var(--foreground);
38-
--color-muted-foreground: var(--muted-foreground);
39-
--color-surface-1: var(--surface-1);
40-
--color-surface-2: var(--surface-2);
41-
--color-surface-3: var(--surface-3);
42-
--color-primary: var(--primary);
43-
--color-primary-foreground: var(--primary-foreground);
44-
--color-accent: var(--accent);
45-
--color-accent-foreground: var(--accent-foreground);
46-
--color-destructive: var(--destructive);
47-
--color-destructive-foreground: var(--destructive-foreground);
48-
--color-border: var(--border);
49-
--color-input: var(--input);
50-
--color-ring: var(--ring);
51-
52-
--radius-sm: calc(var(--radius) - 4px);
53-
--radius-md: calc(var(--radius) - 2px);
54-
--radius-lg: var(--radius);
55-
--radius-xl: calc(var(--radius) + 4px);
56-
57-
--z-index-1: 1;
58-
--z-index-high: 100;
59-
--z-index-highest: 200;
60-
}
61-
62-
:root {
63-
--radius: 0.625rem;
64-
/* Colors */
65-
--background: #f9f9f9;
66-
--foreground: oklch(0.145 0 0);
67-
--muted-foreground: oklch(0.145 0 0 / 0.5);
68-
--surface-1: #fcfcfc;
69-
--surface-2: #ffffff;
70-
--surface-3: #f2f2f2;
71-
--primary: hsl(151, 51%, 52%);
72-
--primary-foreground: hsl(151, 80%, 4%);
73-
--accent: hsl(251, 51%, 52%);
74-
--accent-foreground: hsl(251, 80%, 94%);
75-
--destructive: hsl(351, 51%, 52%);
76-
--destructive-foreground: hsl(351, 80%, 94%);
77-
--border: oklch(0.922 0 0);
78-
--input: oklch(0.922 0 0);
79-
--ring: oklch(0.708 0 0);
80-
81-
/* Brand colors */
82-
--ui-color-primary: hsl(151, 51%, 50%);
83-
--ui-color-primary-subtle: hsl(151, 51%, 60%);
84-
--ui-color-primary-strong: hsl(151, 51%, 40%);
85-
86-
--ui-color-secondary: hsl(325, 47%, 55%);
87-
--ui-color-secondary-subtle: hsl(325, 47%, 65%);
88-
--ui-color-secondary-strong: hsl(325, 47%, 45%);
89-
90-
/* Base light/dark colors */
91-
--ui-color-light-1: hsl(210, 18%, 98%);
92-
--ui-color-light-2: hsl(210, 18%, 95%);
93-
--ui-color-light-3: hsl(210, 18%, 90%);
94-
--ui-color-light-4: hsl(210, 18%, 85%);
95-
--ui-color-light-5: hsl(210, 18%, 80%);
96-
97-
--ui-color-dark-1: hsl(210, 28%, 12%);
98-
--ui-color-dark-2: hsl(210, 28%, 15%);
99-
--ui-color-dark-3: hsl(210, 28%, 20%);
100-
--ui-color-dark-4: hsl(210, 28%, 25%);
101-
--ui-color-dark-5: hsl(210, 28%, 30%);
102-
103-
/* Background colors */
104-
--ui-color-surface-1: light-dark(var(--color-light-1), var(--color-dark-1));
105-
--ui-color-surface-2: light-dark(var(--color-light-2), var(--color-dark-2));
106-
--ui-color-surface-3: light-dark(var(--color-light-3), var(--color-dark-3));
107-
108-
/* Foreground colors */
109-
--ui-color-foreground-1: light-dark(var(--color-dark-1), var(--color-light-1));
110-
--ui-color-foreground-2: light-dark(var(--color-dark-3), var(--color-light-3));
111-
--ui-color-foreground-3: light-dark(var(--color-dark-5), var(--color-light-5));
112-
113-
/* Border colors */
114-
--ui-color-line-1: light-dark(var(--color-light-3), var(--color-dark-3));
115-
--ui-color-line-2: light-dark(var(--color-light-4), var(--color-dark-4));
116-
--ui-color-line-3: light-dark(var(--color-light-5), var(--color-dark-5));
117-
118-
/* State colors */
119-
--ui-color-destructive: hsl(351, 51%, 52%);
120-
--ui-color-destructive-subtle: hsl(351, 51%, 60%);
121-
--ui-color-destructive-strong: hsl(351, 51%, 40%);
122-
}
123-
124-
.dark {
125-
/* Colors */
126-
--background: hsl(0, 0%, 5%);
127-
--foreground: hsl(0, 0%, 98%);
128-
--muted-foreground: hsl(0, 0%, 75%);
129-
--surface-1: hsl(0, 0%, 7%);
130-
--surface-2: hsl(0, 0%, 10%);
131-
--surface-3: hsl(0, 0%, 16%);
132-
--border: hsl(0, 0%, 23%);
133-
--input: oklch(1 0 0 / 15%);
134-
--ring: oklch(0.556 0 0);
135-
}
136-
13721
@layer base {
138-
* {
139-
@apply border-border outline-ring/50 relative;
22+
:root {
23+
/* Brand colors */
24+
--ui-color-basil: hsl(151, 51%, 50%);
25+
--ui-color-basil-foreground: var(--ui-color-dark-0);
26+
--ui-color-basil-subtle: hsl(151, 51%, 60%);
27+
--ui-color-basil-strong: hsl(151, 51%, 40%);
14028
}
29+
14130
body {
142-
@apply bg-background text-foreground;
31+
@apply bg-background text-foreground font-sans antialiased;
14332
min-width: 300px;
14433
}
14534

14635
p a {
147-
@apply text-primary;
36+
@apply var(--ui-color-basil);
14837
}
14938

15039
p a:hover {
151-
@apply text-primary/80;
152-
}
153-
154-
[hidden] {
155-
@apply hidden;
40+
@apply var(--ui-color-basil-strong);
15641
}
15742
}

0 commit comments

Comments
 (0)