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 6, 2024
1 parent 764061a commit 2d423a0
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions content/practices/high-contrast/high-contrast-practice.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,18 +580,17 @@ function computeDistance(hex1, hex2) {
r: parseInt(hex1.substring(1, 2), 16),
b: parseInt(hex1.substring(3, 4), 16),
g: parseInt(hex1.substring(5, 6), 16),
}
};

const rgb2 = {
r: parseInt(hex2.substring(1, 2), 16),
b: parseInt(hex2.substring(3, 4), 16),
g: parseInt(hex2.substring(5, 6), 16),
}
};

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

Replace `Math.pow((rgb1.r·-·rgb2.r)` with `(⏎····Math.pow(rgb1.r·-·rgb2.r`

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

View workflow job for this annotation

GitHub Actions / lint-js

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

Math.pow((rgb1.g - rgb2.g), 2) +

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

View workflow job for this annotation

GitHub Actions / lint-js

Replace `((rgb1.g·-·rgb2.g)` with `(rgb1.g·-·rgb2.g`

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

View workflow job for this annotation

GitHub Actions / lint-js

Replace `((rgb1.g·-·rgb2.g)` with `(rgb1.g·-·rgb2.g`
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

Replace `((rgb1.b·-·rgb2.b),·2` with `(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

Replace `((rgb1.b·-·rgb2.b),·2` with `(rgb1.b·-·rgb2.b,·2)⏎··`
}

/*
Expand Down Expand Up @@ -772,9 +771,9 @@ const systemColorValues = [

function rgb2Hex(rgb) {
// Choose correct separator
let sep = rgb.indexOf(",") > -1 ? "," : " ";
let sep = rgb.indexOf(',') > -1 ? ',' : ' ';
// Turn "rgb(r,g,b)" into [r,g,b]
rgb = rgb.split("(")[1].split(")")[0].split(sep);
rgb = rgb.split('(')[1].split(')')[0].split(sep);

let a = rgb[3] ? parseFloat(rgb[3]) : 1;

Expand All @@ -784,18 +783,18 @@ 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)
r = "0" + r;
r = '0' + r;
if (g.length == 1)
g = "0" + g;
g = '0' + g;
if (b.length == 1)
b = "0" + b;
b = '0' + b;

return "#" + r + g + b;
return '#' + r + g + b;
}

// Fill in System color table
Expand Down

0 comments on commit 2d423a0

Please sign in to comment.