({h, s, l, a}: HSLA, poleFg: HSLA, poleBg: HSLA)
| 114 | } |
| 115 | |
| 116 | function modifyLightModeHSL({h, s, l, a}: HSLA, poleFg: HSLA, poleBg: HSLA): HSLA { |
| 117 | const isDark = l < 0.5; |
| 118 | let isNeutral: boolean; |
| 119 | if (isDark) { |
| 120 | isNeutral = l < 0.2 || s < 0.12; |
| 121 | } else { |
| 122 | const isBlue = h > 200 && h < 280; |
| 123 | isNeutral = s < 0.24 || (l > 0.8 && isBlue); |
| 124 | } |
| 125 | |
| 126 | let hx = h; |
| 127 | let sx = s; |
| 128 | if (isNeutral) { |
| 129 | if (isDark) { |
| 130 | hx = poleFg.h; |
| 131 | sx = poleFg.s; |
| 132 | } else { |
| 133 | hx = poleBg.h; |
| 134 | sx = poleBg.s; |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | const lx = scale(l, 0, 1, poleFg.l, poleBg.l); |
| 139 | |
| 140 | return {h: hx, s: sx, l: lx, a}; |
| 141 | } |
| 142 | |
| 143 | const MAX_BG_LIGHTNESS = 0.4; |
| 144 |
nothing calls this directly
no test coverage detected
searching dependent graphs…