@@ -23,6 +23,17 @@ type PassiveLightingStyleInput = {
2323 muted ?: boolean ;
2424} ;
2525
26+ type RainbowStyle = CSSProperties & {
27+ "--rainbow-duration" ?: string ;
28+ "--rainbow-delay" ?: string ;
29+ "--rainbow-alpha" ?: string ;
30+ } ;
31+
32+ type BreathingStyle = CSSProperties & {
33+ "--breathing-duration" ?: string ;
34+ "--breathing-min" ?: string ;
35+ } ;
36+
2637export const getPassiveLightingStyle = ( input : PassiveLightingStyleInput ) : { className ?: string ; style ?: CSSProperties } => {
2738 const {
2839 passiveMode,
@@ -40,7 +51,7 @@ export const getPassiveLightingStyle = (input: PassiveLightingStyleInput): { cla
4051 const hueOffsetSteps = ( ledIndex * 8 ) % 192 ; // firmware: per-LED hue offset = led * 8 (mod 192)
4152 const delaySec = - ( hueOffsetSteps * step ) / 1000 ; // align phase offset in time
4253 const rainbowAlpha = ( muted ? MUTED_ALPHA_SCALE : 1 ) * BASE_RAINBOW_ALPHA ;
43- const rainbowStyle : CSSProperties = {
54+ const rainbowStyle : RainbowStyle = {
4455 "--rainbow-duration" : `${ durationSec } s` ,
4556 "--rainbow-delay" : `${ delaySec } s` ,
4657 "--rainbow-alpha" : `${ rainbowAlpha } ` ,
@@ -58,7 +69,7 @@ export const getPassiveLightingStyle = (input: PassiveLightingStyleInput): { cla
5869 const primaryAlpha = BASE_PRIMARY_ALPHA * alphaScale ;
5970 const secondaryAlpha = BASE_SECONDARY_ALPHA * alphaScale ;
6071 const borderAlpha = BASE_BORDER_ALPHA * alphaScale ;
61- const breathingStyle : CSSProperties | undefined = passiveMode === "Breathing"
72+ const breathingStyle : BreathingStyle | undefined = passiveMode === "Breathing"
6273 ? {
6374 "--breathing-duration" : `${ durationSec } s` ,
6475 "--breathing-min" : `${ Math . max ( 0.05 , Math . min ( 0.95 , minPercent / 100 ) ) } ` ,
0 commit comments