From dc5b1e694dace16b4502c5e96b308513836ffdf0 Mon Sep 17 00:00:00 2001 From: medievalshell Date: Sun, 31 May 2026 17:16:23 +0200 Subject: [PATCH] feat(fortune-wheel): expose wheel colors as CSS custom properties The slice/rim/divider/hub colors are now read from --wheel-* CSS variables with the current values as fallbacks, so the stock look is unchanged while a runtime theme can recolor the wheel without rebuilding. --- src/components/fortune-wheel/FortuneWheelView.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/fortune-wheel/FortuneWheelView.tsx b/src/components/fortune-wheel/FortuneWheelView.tsx index 5a0f76c..c15b10d 100644 --- a/src/components/fortune-wheel/FortuneWheelView.tsx +++ b/src/components/fortune-wheel/FortuneWheelView.tsx @@ -8,9 +8,13 @@ import { FortuneWheelSettingsView } from './FortuneWheelSettingsView'; import { WheelWinReveal } from './WheelWinReveal'; import { renderPrizeIcon } from './wheelPrizeIcon'; -// Stock UI palette (white / light-blue / grey / black). -const SLICE_COLORS = [ '#eef2f5', '#c3dcec' ]; -const RIM = '#4c606c'; +// Stock UI palette (white / light-blue / grey / black). Exposed as CSS custom +// properties so a runtime theme can recolor the wheel without changing defaults +// (the fallback values keep the stock look when no theme overrides them). +const SLICE_COLORS = [ 'var(--wheel-slice-1, #eef2f5)', 'var(--wheel-slice-2, #c3dcec)' ]; +const RIM = 'var(--wheel-rim, #4c606c)'; +const DIVIDER = 'var(--wheel-divider, rgba(76,96,108,0.3))'; +const HUB = 'var(--wheel-hub, #eef2f5)'; const WHEEL_SIZE = 420; const ICON_RADIUS = 150; const FULL_TURNS = 5; @@ -223,7 +227,7 @@ export const FortuneWheelView: FC<{}> = () =>
+ style={ { width: '2px', height: `${ WHEEL_SIZE / 2 }px`, transform: `translateX(-1px) rotate(${ i * sliceAngle }deg)`, background: DIVIDER } } /> )) } { prizes.map((prize, i) => { @@ -239,7 +243,7 @@ export const FortuneWheelView: FC<{}> = () =>
); }) } -
+
{ LocalizeText('wheel.free.today', [ 'count' ], [ freeSpins.toString() ]) }