File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change 136
136
const G = parseInt ( hexArray [ 1 ] , 16 ) ;
137
137
const B = parseInt ( hexArray [ 2 ] , 16 ) ;
138
138
139
- if ( opacity == 1 ) {
139
+ if ( opacity === 1 ) {
140
140
cell . textContent = `rgb(${ R } ${ G } ${ B } )` ;
141
141
} else {
142
142
cell . textContent = `rgb(${ R } ${ G } ${ B } / ${ opacity } )` ;
154
154
s = 0 ,
155
155
l = 0 ;
156
156
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 ;
160
160
else h = ( r - g ) / delta + 4 ;
161
161
162
162
h = Math . round ( h * 60 ) ;
163
163
164
164
if ( h < 0 ) h += 360 ;
165
165
166
166
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 ) ) ;
168
168
s = + ( s * 100 ) . toFixed ( 1 ) ;
169
169
l = + ( l * 100 ) . toFixed ( 1 ) ;
170
170
171
- if ( opacity == 1 ) {
171
+ if ( opacity === 1 ) {
172
172
cell . textContent = `hsl(${ h } ${ s } % ${ l } %)` ;
173
173
} else {
174
174
cell . textContent = `hsl(${ h } ${ s } % ${ l } % / ${ opacity } )` ;
178
178
179
179
function createHWB ( h , s , l , opacity ) {
180
180
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 ;
183
183
const B = l + hsv ;
184
184
if ( opacity === 1 ) {
185
185
cell . textContent = `hwb(${ h } ${ W . toFixed ( 1 ) } % ${ B . toFixed ( 1 ) } %)` ;
You can’t perform that action at this time.
0 commit comments