Skip to content

Commit 3aed42a

Browse files
estelleteoli2003
andauthored
Update modules/colors.html
Co-authored-by: Jean-Yves Perrier <jypenator@gmail.com>
1 parent 614929a commit 3aed42a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

modules/colors.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,14 @@
179179
function createHWB(h, s, l, opacity) {
180180
const cell = document.querySelector("#HWB td");
181181
const hsv = (s * ((l < 50) ? l : 100 - l)) / 100;
182-
const W = (hsv === 0) ? 0 : ((2 * hsv) / (l + hsv)) * 100;
183-
const B = l + hsv;
182+
let W = (hsv === 0) ? 0 : ((2 * hsv) / (l + hsv)) * 100;
183+
let B = l + hsv;
184+
W = W.toFixed(1);
185+
B = B.toFixed(1);
184186
if (opacity === 1) {
185-
cell.textContent = `hwb(${h} ${W.toFixed(1)}% ${B.toFixed(1)}%)`;
187+
cell.textContent = `hwb(${h} ${W}% ${B}%)`;
186188
} else {
187-
cell.textContent = `hwb(${h} ${W.toFixed(1)}% ${B.toFixed(
188-
1
189-
)}% / ${opacity})`;
189+
cell.textContent = `hwb(${h} ${W}% ${B}% / ${opacity})`;
190190
}
191191
}
192192

0 commit comments

Comments
 (0)