Skip to content

Commit

Permalink
fixed linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jongund committed Jun 7, 2024
1 parent 2d423a0 commit 438ce61
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions content/practices/high-contrast/high-contrast-practice.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,9 +588,9 @@ function computeDistance(hex1, hex2) {
g: parseInt(hex2.substring(5, 6), 16),
};

return Math.pow((rgb1.r - rgb2.r), 2) +
Math.pow((rgb1.g - rgb2.g), 2) +
Math.pow((rgb1.b - rgb2.b), 2);
return Math.pow(rgb1.r - rgb2.r, 2) +

Check failure on line 591 in content/practices/high-contrast/high-contrast-practice.js

View workflow job for this annotation

GitHub Actions / lint-js

Insert `(⏎····`

Check failure on line 591 in content/practices/high-contrast/high-contrast-practice.js

View workflow job for this annotation

GitHub Actions / lint-js

Insert `(⏎····`
Math.pow(rgb1.g - rgb2.g, 2) +
Math.pow(rgb1.b - rgb2.b, 2);

Check failure on line 593 in content/practices/high-contrast/high-contrast-practice.js

View workflow job for this annotation

GitHub Actions / lint-js

Insert `)⏎··`

Check failure on line 593 in content/practices/high-contrast/high-contrast-practice.js

View workflow job for this annotation

GitHub Actions / lint-js

Insert `)⏎··`
}

/*
Expand All @@ -609,10 +609,10 @@ function getHTMLColorName (systemColorName, colorHex) {
// Check for transparent

if (colorHex[0] !== '#') {
return `${systemColorName} is ${colorHex}`
return `${systemColorName} is ${colorHex}`;
}

for(let i = 0; i < htmlColorValues.length; i += 1) {
for( let i = 0; i < htmlColorValues.length; i += 1) {

Check failure on line 615 in content/practices/high-contrast/high-contrast-practice.js

View workflow job for this annotation

GitHub Actions / lint-js

Replace `(·` with `·(`

Check failure on line 615 in content/practices/high-contrast/high-contrast-practice.js

View workflow job for this annotation

GitHub Actions / lint-js

Replace `(·` with `·(`
const v = htmlColorValues[i];
if (v.hex.toLowerCase() === colorHex) {
return `${systemColorName} is ${v.name.toLowerCase()}`;
Expand All @@ -621,8 +621,8 @@ function getHTMLColorName (systemColorName, colorHex) {

// See if shade of gray

if ((colorHex.substring(1,2) === colorHex.substring(3,4)) &&
(colorHex.substring(1,2) === colorHex.substring(5,6))) {
if ((colorHex.substring(1, 2) === colorHex.substring(3, 4)) &&

Check failure on line 624 in content/practices/high-contrast/high-contrast-practice.js

View workflow job for this annotation

GitHub Actions / lint-js

Replace `(colorHex.substring(1,·2)·===·colorHex.substring(3,·4))` with `⏎····colorHex.substring(1,·2)·===·colorHex.substring(3,·4)`

Check failure on line 624 in content/practices/high-contrast/high-contrast-practice.js

View workflow job for this annotation

GitHub Actions / lint-js

Replace `(colorHex.substring(1,·2)·===·colorHex.substring(3,·4))` with `⏎····colorHex.substring(1,·2)·===·colorHex.substring(3,·4)`
(colorHex.substring(1, 2) === colorHex.substring(5, 6))) {

Check failure on line 625 in content/practices/high-contrast/high-contrast-practice.js

View workflow job for this annotation

GitHub Actions / lint-js

Replace `······(colorHex.substring(1,·2)·===·colorHex.substring(5,·6)))·{⏎` with `····colorHex.substring(1,·2)·===·colorHex.substring(5,·6)⏎··)·{`

Check failure on line 625 in content/practices/high-contrast/high-contrast-practice.js

View workflow job for this annotation

GitHub Actions / lint-js

Replace `······(colorHex.substring(1,·2)·===·colorHex.substring(5,·6)))·{⏎` with `····colorHex.substring(1,·2)·===·colorHex.substring(5,·6)⏎··)·{`

switch (colorHex[1]) {
case '0':
Expand All @@ -649,7 +649,7 @@ function getHTMLColorName (systemColorName, colorHex) {
let closestValue =htmlColorValues[0];

Check failure on line 649 in content/practices/high-contrast/high-contrast-practice.js

View workflow job for this annotation

GitHub Actions / lint-js

Insert `·`

Check failure on line 649 in content/practices/high-contrast/high-contrast-practice.js

View workflow job for this annotation

GitHub Actions / lint-js

Insert `·`
let closestComputedDistance = computeDistance(closestValue.hex, colorHex);

htmlColorValues.forEach( v => {
htmlColorValues.forEach( (v) => {

Check failure on line 652 in content/practices/high-contrast/high-contrast-practice.js

View workflow job for this annotation

GitHub Actions / lint-js

Delete `·`

Check failure on line 652 in content/practices/high-contrast/high-contrast-practice.js

View workflow job for this annotation

GitHub Actions / lint-js

Delete `·`
const cd = computeDistance(v.hex, colorHex);
if (cd < closestComputedDistance) {
closestValue = v;
Expand Down Expand Up @@ -752,10 +752,9 @@ const systemColorValues = [
desc: 'Text of selected items',
},
{
value:
'VisitedText',
value:'VisitedText',
name: 'Visited text',
desc: 'Text of visited links'
desc: 'Text of visited links',
}
];

Expand Down Expand Up @@ -783,16 +782,19 @@ function rgb2Hex(rgb) {
return 'transparent';
}

let r = (Math.round(parseInt(rgb[0]) * a)).toString(16),
g = (Math.round(parseInt(rgb[1]) * a)).toString(16),
b = (Math.round(parseInt(rgb[2]) * a)).toString(16);
let r = Math.round(parseInt(rgb[0]) * a).toString(16),
g = Math.round(parseInt(rgb[1]) * a).toString(16),
b = Math.round(parseInt(rgb[2]) * a).toString(16);

if (r.length == 1)
if (r.length == 1) {
r = '0' + r;
if (g.length == 1)
}
if (g.length == 1) {
g = '0' + g;
if (b.length == 1)
}
if (b.length == 1) {
b = '0' + b;
}

return '#' + r + g + b;
}
Expand All @@ -817,7 +819,7 @@ window.addEventListener('load', () => {
tr.appendChild(tds);
const tdc = document.createElement('td');
tdc.style.fontFamily = 'monospace';
tdc.textContent = "??";
tdc.textContent = '??';
tr.appendChild(tdc);
const tdd = document.createElement('td');
tdd.textContent = v.desc;
Expand Down

0 comments on commit 438ce61

Please sign in to comment.