Skip to content

Commit 614929a

Browse files
authored
js syntax
=== and () around tertiaries
1 parent b7711ca commit 614929a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

modules/colors.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
const G = parseInt(hexArray[1], 16);
137137
const B = parseInt(hexArray[2], 16);
138138

139-
if (opacity == 1) {
139+
if (opacity === 1) {
140140
cell.textContent = `rgb(${R} ${G} ${B})`;
141141
} else {
142142
cell.textContent = `rgb(${R} ${G} ${B} / ${opacity})`;
@@ -154,21 +154,21 @@
154154
s = 0,
155155
l = 0;
156156

157-
if (delta == 0) h = 0;
158-
else if (cmax == r) h = ((g - b) / delta) % 6;
159-
else if (cmax == g) h = (b - r) / delta + 2;
157+
if (delta === 0) h = 0;
158+
else if (cmax === r) h = ((g - b) / delta) % 6;
159+
else if (cmax === g) h = (b - r) / delta + 2;
160160
else h = (r - g) / delta + 4;
161161

162162
h = Math.round(h * 60);
163163

164164
if (h < 0) h += 360;
165165

166166
l = (cmax + cmin) / 2;
167-
s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
167+
s = (delta === 0) ? 0 : delta / (1 - Math.abs(2 * l - 1));
168168
s = +(s * 100).toFixed(1);
169169
l = +(l * 100).toFixed(1);
170170

171-
if (opacity == 1) {
171+
if (opacity === 1) {
172172
cell.textContent = `hsl(${h} ${s}% ${l}%)`;
173173
} else {
174174
cell.textContent = `hsl(${h} ${s}% ${l}% / ${opacity})`;
@@ -178,8 +178,8 @@
178178

179179
function createHWB(h, s, l, opacity) {
180180
const cell = document.querySelector("#HWB td");
181-
const hsv = (s * (l < 50 ? l : 100 - l)) / 100;
182-
const W = hsv === 0 ? 0 : ((2 * hsv) / (l + hsv)) * 100;
181+
const hsv = (s * ((l < 50) ? l : 100 - l)) / 100;
182+
const W = (hsv === 0) ? 0 : ((2 * hsv) / (l + hsv)) * 100;
183183
const B = l + hsv;
184184
if (opacity === 1) {
185185
cell.textContent = `hwb(${h} ${W.toFixed(1)}% ${B.toFixed(1)}%)`;

0 commit comments

Comments
 (0)