simplify theme3 variable code and fix some issues

This commit is contained in:
Henry Jameson 2025-03-26 17:37:41 +02:00
commit a2d9c4db6a
2 changed files with 14 additions and 16 deletions

View file

@ -112,10 +112,7 @@ export const colorFunctions = {
const color = convert(findColor(colorArg, { dynamicVars, staticVars })).rgb
const amount = Number(amountArg)
const effectiveBackground = dynamicVars.lowerLevelBackground ??
dynamicVars.background ??
dynamicVars.inheritedBackground ??
staticVars[colorArg]
const effectiveBackground = dynamicVars.lowerLevelBackground ?? color
const isLightOnDark = relativeLuminance(convert(effectiveBackground).rgb) < 0.5
const mod = isLightOnDark ? 1 : -1
return brightness(amount * mod, color).rgb