Skip to content

Commit d61dff9

Browse files
committed
🤖 fix: use CSS variables for thinking slider colors
Replace hardcoded HSL values with --color-thinking-mode CSS variable so the slider adapts to theme (especially solarized). _Generated with mux_
1 parent 20e8d4f commit d61dff9

File tree

2 files changed

+33
-22
lines changed

2 files changed

+33
-22
lines changed

src/browser/components/ThinkingSlider.tsx

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,48 +7,59 @@ import { getThinkingPolicyForModel } from "@/browser/utils/thinking/policy";
77
import { updatePersistedState } from "@/browser/hooks/usePersistedState";
88
import { getLastThinkingByModelKey } from "@/common/constants/storage";
99

10-
// Subtle consistent glow for active levels
11-
const GLOW = {
12-
track: "0 0 6px 1px hsl(271 76% 53% / 0.3)",
13-
thumb: "0 0 4px 1px hsl(271 76% 53% / 0.3)",
14-
};
15-
10+
// Uses CSS variable --color-thinking-mode for theme compatibility
11+
// Glow is applied via CSS using color-mix with the theme color
1612
const GLOW_INTENSITIES: Record<number, { track: string; thumb: string }> = {
1713
0: { track: "none", thumb: "none" },
18-
1: GLOW,
19-
2: GLOW,
20-
3: GLOW,
14+
1: {
15+
track: "0 0 6px 1px color-mix(in srgb, var(--color-thinking-mode) 30%, transparent)",
16+
thumb: "0 0 4px 1px color-mix(in srgb, var(--color-thinking-mode) 30%, transparent)",
17+
},
18+
2: {
19+
track: "0 0 6px 1px color-mix(in srgb, var(--color-thinking-mode) 30%, transparent)",
20+
thumb: "0 0 4px 1px color-mix(in srgb, var(--color-thinking-mode) 30%, transparent)",
21+
},
22+
3: {
23+
track: "0 0 6px 1px color-mix(in srgb, var(--color-thinking-mode) 30%, transparent)",
24+
thumb: "0 0 4px 1px color-mix(in srgb, var(--color-thinking-mode) 30%, transparent)",
25+
},
2126
};
2227

23-
// Continuous function for text styling based on level (n: 0-3)
24-
const getTextStyle = (n: number) => {
28+
// Text styling based on level (n: 0-3)
29+
// Uses CSS variables for theme compatibility
30+
const getTextStyle = (n: number): React.CSSProperties => {
2531
if (n === 0) {
2632
return {
27-
color: "#606060",
33+
color: "var(--color-muted)",
2834
fontWeight: 400,
2935
textShadow: "none",
3036
fontSize: "10px",
3137
};
3238
}
3339

34-
// Continuous interpolation for n = 1-3
35-
const hue = 271 + (n - 1) * 7; // 271 → 278 → 285
36-
const lightness = 65 - (n - 1) * 5; // 65 → 60 → 55
40+
// Active levels use the thinking mode color with increasing intensity
3741
const fontWeight = 400 + n * 100; // 500 → 600 → 700
38-
const shadowBlur = n * 4; // 4 → 8 → 12
39-
const shadowOpacity = 0.3 + n * 0.15; // 0.45 → 0.6 → 0.75
42+
// Use color-mix to lighten the base color for lower levels
43+
const lightnessAdjust = (3 - n) * 10; // high=0%, medium=10%, low=20% lighter
4044

4145
return {
42-
color: `hsl(${hue} 76% ${lightness}%)`,
46+
color:
47+
lightnessAdjust > 0
48+
? `color-mix(in srgb, var(--color-thinking-mode-light) ${lightnessAdjust}%, var(--color-thinking-mode))`
49+
: "var(--color-thinking-mode)",
4350
fontWeight,
44-
textShadow: `0 0 ${shadowBlur}px hsl(${hue} 76% ${lightness}% / ${shadowOpacity})`,
51+
textShadow:
52+
n > 0
53+
? `0 0 ${n * 4}px color-mix(in srgb, var(--color-thinking-mode) ${30 + n * 15}%, transparent)`
54+
: "none",
4555
fontSize: "10px",
4656
};
4757
};
4858

4959
const getSliderStyles = (value: number, isHover = false) => {
5060
const effectiveValue = isHover ? Math.min(value + 1, 3) : value;
51-
const thumbBg = value === 0 ? "#606060" : `hsl(271 76% ${53 + value * 5}%)`;
61+
// Use CSS variable for thumb color when active
62+
const thumbBg = value === 0 ? "var(--color-muted)" : "var(--color-thinking-mode)";
5263

5364
return {
5465
trackShadow: GLOW_INTENSITIES[effectiveValue].track,

src/browser/styles/globals.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,7 +1622,7 @@ pre code {
16221622
width: 12px;
16231623
height: 12px;
16241624
border-radius: 50%;
1625-
background: var(--thumb-bg, #606060);
1625+
background: var(--thumb-bg, var(--color-muted));
16261626
cursor: pointer;
16271627
transition:
16281628
background 0.2s ease,
@@ -1634,7 +1634,7 @@ pre code {
16341634
width: 12px;
16351635
height: 12px;
16361636
border-radius: 50%;
1637-
background: var(--thumb-bg, #606060);
1637+
background: var(--thumb-bg, var(--color-muted));
16381638
cursor: pointer;
16391639
border: none;
16401640
transition:

0 commit comments

Comments
 (0)