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 438ce61 commit d262c7e
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions content/practices/high-contrast/high-contrast-practice.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ function getHTMLColorName (systemColorName, colorHex) {
return `${systemColorName} is ${colorHex}`;
}

for( let i = 0; i < htmlColorValues.length; i += 1) {
for (let i = 0; i < htmlColorValues.length; i += 1) {
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

Insert `⏎····`

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

View workflow job for this annotation

GitHub Actions / lint-js

Insert `⏎····`
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 @@ -646,10 +646,10 @@ function getHTMLColorName (systemColorName, colorHex) {

// Look for closest color

let closestValue =htmlColorValues[0];
let closestValue = htmlColorValues[0];
let closestComputedDistance = computeDistance(closestValue.hex, colorHex);

htmlColorValues.forEach( (v) => {
htmlColorValues.forEach((v) => {
const cd = computeDistance(v.hex, colorHex);
if (cd < closestComputedDistance) {
closestValue = v;
Expand Down Expand Up @@ -755,7 +755,7 @@ const systemColorValues = [
value:'VisitedText',

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

View workflow job for this annotation

GitHub Actions / lint-js

Insert `·`

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

View workflow job for this annotation

GitHub Actions / lint-js

Insert `·`
name: 'Visited text',
desc: 'Text of visited links',
}
},
];

/*
Expand All @@ -776,8 +776,6 @@ function rgb2Hex(rgb) {

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

console.log(`[rgb]: ${rgb} [a]: ${a}`);

if (a < 0.01) {
return 'transparent';
}
Expand All @@ -804,9 +802,9 @@ function rgb2Hex(rgb) {
window.addEventListener('load', () => {
const tbodyNode = document.getElementById('samples');

systemColorValues.forEach( v => {
systemColorValues.forEach((v) => {
if (v.value) {
const tr = document.createElement('tr');
const tr = document.createElement('tr');
const tdv = document.createElement('td');
tdv.textContent = v.value;
tr.appendChild(tdv);
Expand All @@ -827,7 +825,7 @@ window.addEventListener('load', () => {
tbodyNode.appendChild(tr);
const cStyle = window.getComputedStyle(div);
const colorHex = rgb2Hex(cStyle.backgroundColor);
tdc.textContent =colorHex;
tdc.textContent = colorHex;
div.ariaLabel = getHTMLColorName(v.name, colorHex);
}
});
Expand Down

0 comments on commit d262c7e

Please sign in to comment.