Skip to content

Commit 092ac84

Browse files
committed
feat: make crab color theme the default
1 parent e646a9b commit 092ac84

File tree

3 files changed

+36
-26
lines changed

3 files changed

+36
-26
lines changed

constants/themes.json

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
[
2+
[
3+
"#ef6061",
4+
{
5+
"--theme-color-name": "crab",
6+
"--c-primary": "rgb(var(--rgb-primary))",
7+
"--c-primary-active": "#d3474c",
8+
"--c-primary-light": "#ef606180",
9+
"--c-primary-fade": "#e95b5d1a",
10+
"--rgb-primary": "239, 96, 97",
11+
"--c-dark-primary": "rgb(var(--rgb-dark-primary))",
12+
"--c-dark-primary-active": "#d94c50",
13+
"--c-dark-primary-light": "#f5656580",
14+
"--c-dark-primary-fade": "#ef60611a",
15+
"--rgb-dark-primary": "239, 96, 97"
16+
}
17+
],
218
[
319
"#cc7d24",
420
{
@@ -126,21 +142,5 @@
126142
"--c-dark-primary-fade": "#e65da91a",
127143
"--rgb-dark-primary": "230, 93, 169"
128144
}
129-
],
130-
[
131-
"#ef6061",
132-
{
133-
"--theme-color-name": "#ef6061",
134-
"--c-primary": "rgb(var(--rgb-primary))",
135-
"--c-primary-active": "#d3474c",
136-
"--c-primary-light": "#ef606180",
137-
"--c-primary-fade": "#e95b5d1a",
138-
"--rgb-primary": "239, 96, 97",
139-
"--c-dark-primary": "rgb(var(--rgb-dark-primary))",
140-
"--c-dark-primary-active": "#d94c50",
141-
"--c-dark-primary-light": "#f5656580",
142-
"--c-dark-primary-fade": "#ef60611a",
143-
"--rgb-dark-primary": "239, 96, 97"
144-
}
145145
]
146146
]

scripts/generate-themes.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,22 @@ export const themesColor = Array.from(
77
(_, i) => chroma.hcl((67.14 + i * 40) % 360, 62.19, 59.56).hex(),
88
)
99

10+
function isCrabColor(color: string) {
11+
return color === '#ef6061'
12+
}
13+
14+
function getColorName(color: string) {
15+
return isCrabColor(color) ? 'crab' : color
16+
}
17+
18+
themesColor.sort((primaryA, primaryB) => isCrabColor(primaryA) ? -1 : isCrabColor(primaryB) ? 1 : 0)
19+
1020
export function getThemeColors(primary: string): ThemeColors {
1121
const c = chroma(primary)
1222
const dc = c.brighten(0.1)
1323

1424
return {
15-
'--theme-color-name': primary,
25+
'--theme-color-name': getColorName(primary),
1626

1727
'--c-primary': 'rgb(var(--rgb-primary))',
1828
'--c-primary-active': c.darken(0.5).hex(),

styles/default-theme.css

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
:root {
2-
--theme-color-name: #cc7d24;
2+
--theme-color-name: crab;
33
--c-primary: rgb(var(--rgb-primary));
4-
--c-primary-active: #b16605;
5-
--c-primary-light: #cc7d2480;
6-
--c-primary-fade: #c7781f1a;
7-
--rgb-primary: 204, 125, 36;
4+
--c-primary-active: #d3474c;
5+
--c-primary-light: #ef606180;
6+
--c-primary-fade: #e95b5d1a;
7+
--rgb-primary: 239, 96, 97;
88
--c-dark-primary: rgb(var(--rgb-dark-primary));
9-
--c-dark-primary-active: #b66b0d;
10-
--c-dark-primary-light: #d1822980;
11-
--c-dark-primary-fade: #cc7d241a;
12-
--rgb-dark-primary: 204, 125, 36;
9+
--c-dark-primary-active: #d94c50;
10+
--c-dark-primary-light: #f5656580;
11+
--c-dark-primary-fade: #ef60611a;
12+
--rgb-dark-primary: 239, 96, 97;
1313
}

0 commit comments

Comments
 (0)