We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents fbd0cd8 + cf69340 commit ac92956Copy full SHA for ac92956
modules/colors.html
@@ -189,9 +189,9 @@
189
190
function createHWB(h, s, l, opacity) {
191
const cell = document.querySelector("#HWB td");
192
- const hsv = (s * ((l < 50) ? l : 100 - l)) / 100;
193
- let W = (hsv === 0) ? 0 : ((2 * hsv) / (l + hsv)) * 100;
194
- let B = l + hsv;
+ const chroma = s * (1 - Math.abs(l/50 - 1));
+ let W = l - chroma / 2;
+ let B = 100 - l - chroma / 2;
195
W = W.toFixed(1);
196
B = B.toFixed(1);
197
if (opacity === 1) {
0 commit comments