Skip to content

Commit ff748b8

Browse files
authored
fix(app): simplify themes (#17274)
1 parent 9fafa57 commit ff748b8

5 files changed

Lines changed: 168 additions & 370 deletions

File tree

packages/ui/src/theme/color.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -136,23 +136,23 @@ export function generateScale(seed: HexColor, isDark: boolean): HexColor[] {
136136

137137
const lightSteps = isDark
138138
? [
139-
0.182,
140-
0.21,
141-
0.261,
142-
0.302,
143-
0.341,
144-
0.387,
145-
0.443,
146-
0.514,
147-
base.l,
148-
Math.max(0, base.l - 0.017),
149-
Math.min(0.94, Math.max(0.84, base.l + 0.02)),
150-
0.975,
139+
0.118,
140+
0.138,
141+
0.167,
142+
0.202,
143+
0.246,
144+
0.304,
145+
0.378,
146+
0.468,
147+
clamp(base.l * 0.825, 0.53, 0.705),
148+
clamp(base.l * 0.89, 0.61, 0.79),
149+
clamp(base.l + 0.033, 0.868, 0.943),
150+
0.984,
151151
]
152152
: [0.993, 0.983, 0.962, 0.936, 0.906, 0.866, 0.811, 0.74, base.l, Math.max(0, base.l - 0.036), 0.49, 0.27]
153153

154154
const chromaMultipliers = isDark
155-
? [0.34, 0.45, 0.64, 0.82, 0.96, 1.06, 1.14, 1.2, 1.24, 1.28, 1.34, 1.08]
155+
? [0.52, 0.68, 0.86, 1.02, 1.14, 1.24, 1.36, 1.48, 1.56, 1.64, 1.62, 1.15]
156156
: [0.12, 0.24, 0.46, 0.68, 0.84, 0.98, 1.08, 1.16, 1.22, 1.26, 1.18, 0.98]
157157

158158
for (let i = 0; i < 12; i++) {
@@ -180,26 +180,26 @@ export function generateNeutralScale(seed: HexColor, isDark: boolean, ink?: HexC
180180
const sink = (tone: number) =>
181181
oklchToHex({
182182
l: base.l * (1 - tone),
183-
c: base.c * Math.max(0, 1 - tone * 0.3),
183+
c: base.c * Math.max(0, 1 - tone * (isDark ? 0.12 : 0.3)),
184184
h: base.h,
185185
})
186186
const bg = isDark
187-
? sink(clamp(0.06 + Math.max(0, base.l - 0.18) * 0.22 + base.c * 1.4, 0.06, 0.14))
187+
? sink(clamp(0.19 + Math.max(0, base.l - 0.12) * 0.33 + base.c * 1.95, 0.17, 0.27))
188188
: base.l < 0.82
189189
? lift(0.86)
190190
: lift(clamp(0.1 + base.c * 3.2 + Math.max(0, 0.95 - base.l) * 0.35, 0.1, 0.28))
191191
const steps = isDark
192-
? [0, 0.03, 0.055, 0.085, 0.125, 0.18, 0.255, 0.35, 0.5, 0.67, 0.84, 0.975]
192+
? [0, 0.018, 0.039, 0.064, 0.097, 0.143, 0.212, 0.31, 0.46, 0.649, 0.845, 0.984]
193193
: [0, 0.022, 0.042, 0.068, 0.102, 0.146, 0.208, 0.296, 0.432, 0.61, 0.81, 0.965]
194194
return steps.map((step) => mixColors(bg, ink, step))
195195
}
196196

197197
const base = hexToOklch(seed)
198198
const scale: HexColor[] = []
199-
const neutralChroma = Math.min(base.c, isDark ? 0.05 : 0.04)
199+
const neutralChroma = Math.min(base.c, isDark ? 0.068 : 0.04)
200200

201201
const lightSteps = isDark
202-
? [0.2, 0.226, 0.256, 0.277, 0.301, 0.325, 0.364, 0.431, base.l, 0.593, 0.706, 0.946]
202+
? [0.138, 0.156, 0.178, 0.202, 0.232, 0.272, 0.326, 0.404, clamp(base.l * 0.83, 0.43, 0.55), 0.596, 0.719, 0.956]
203203
: [0.991, 0.979, 0.964, 0.946, 0.931, 0.913, 0.891, 0.83, base.l, 0.617, 0.542, 0.205]
204204

205205
for (let i = 0; i < 12; i++) {

packages/ui/src/theme/desktop-theme.schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@
8787
"type": "object",
8888
"description": "A compact semantic palette used to derive the full theme programmatically",
8989
"additionalProperties": false,
90-
"required": ["neutral", "primary", "success", "warning", "error", "info"],
90+
"required": ["neutral", "ink", "primary", "success", "warning", "error", "info"],
9191
"properties": {
9292
"neutral": {
9393
"$ref": "#/definitions/HexColor",
9494
"description": "Base neutral color for generating the gray scale"
9595
},
9696
"ink": {
9797
"$ref": "#/definitions/HexColor",
98-
"description": "Optional foreground or chrome color used to derive text and border tones"
98+
"description": "Foreground or chrome color used to derive text and border tones"
9999
},
100100
"primary": {
101101
"$ref": "#/definitions/HexColor",

0 commit comments

Comments
 (0)