Skip to content

Commit 3a41452

Browse files
committed
updated table
1 parent 3032084 commit 3a41452

File tree

1 file changed

+59
-57
lines changed

1 file changed

+59
-57
lines changed

content/practices/color-settings/js/color-settings-practice.js

+59-57
Original file line numberDiff line numberDiff line change
@@ -868,66 +868,68 @@ window.addEventListener('load', () => {
868868

869869
systemColorValues.forEach((v) => {
870870
if (v.value) {
871-
// System Color Name
872-
const tr = document.createElement('tr');
873-
const thv = document.createElement('th');
874-
thv.textContent = v.value;
875-
tr.appendChild(thv);
876-
877-
// Windows 11 Contrast Theme Value
878-
const tdct = document.createElement('td');
879-
tdct.textContent = v.contrastTheme;
880-
tr.appendChild(tdct);
881-
882-
// Chromium Support
883-
const tdchrome = document.createElement('td');
884-
v.chromium ?
885-
tdchrome.textContent = 'Yes' :
886-
tdchrome.textContent = '-';
887-
888-
tr.appendChild(tdchrome);
889-
890-
// Mozilla Support
891-
const tdmoz = document.createElement('td');
892-
v.mozilla ?
893-
tdmoz.textContent = 'Yes' :
894-
tdmoz.textContent = '-';
895-
tr.appendChild(tdmoz);
896-
897-
// Color Sample
898-
const tds = document.createElement('td');
899-
const div = document.createElement('div');
900-
div.role = 'img';
901-
div.classList.add('sample');
902-
div.style.backgroundColor = v.value;
903-
tds.appendChild(div);
904-
const divHex = document.createElement('div');
905-
divHex.className = 'color';
906-
tds.appendChild(divHex);
907-
tr.appendChild(tds);
908-
// const tdRGB = document.createElement('td');
909-
// tdRGB.className = 'font';
910-
// tdRGB.textContent = '??';
911-
// tr.appendChild(tdRGB);
912-
const tdHex = document.createElement('td');
913-
tdHex.className = 'font';
914-
tdHex.textContent = '??';
915-
916-
// System Color Description
917-
const tdd = document.createElement('td');
918-
tdd.textContent = v.desc;
919-
tr.appendChild(tdd);
920-
921-
tbodyNode.appendChild(tr);
922-
const cStyle = window.getComputedStyle(div);
923-
// tdRGB.textContent = cStyle.backgroundColor;
924-
const colorHex = rgb2Hex(cStyle.backgroundColor);
925-
divHex.textContent = colorHex;
926-
div.ariaLabel = getHTMLColorName(v.name, colorHex);
871+
if (v.chromium && v.mozilla) {
872+
// System Color Name
873+
const tr = document.createElement('tr');
874+
const thv = document.createElement('th');
875+
thv.textContent = v.value;
876+
tr.appendChild(thv);
877+
878+
// Windows 11 Contrast Theme Value
879+
const tdct = document.createElement('td');
880+
tdct.textContent = v.contrastTheme;
881+
tr.appendChild(tdct);
882+
883+
// Chromium Support
884+
const tdchrome = document.createElement('td');
885+
v.chromium ?
886+
tdchrome.textContent = 'Yes' :
887+
tdchrome.textContent = '-';
888+
889+
tr.appendChild(tdchrome);
890+
891+
// Mozilla Support
892+
const tdmoz = document.createElement('td');
893+
v.mozilla ?
894+
tdmoz.textContent = 'Yes' :
895+
tdmoz.textContent = '-';
896+
tr.appendChild(tdmoz);
897+
898+
// Color Sample
899+
const tds = document.createElement('td');
900+
const div = document.createElement('div');
901+
div.role = 'img';
902+
div.classList.add('sample');
903+
div.style.backgroundColor = v.value;
904+
tds.appendChild(div);
905+
const divHex = document.createElement('div');
906+
divHex.className = 'color';
907+
tds.appendChild(divHex);
908+
tr.appendChild(tds);
909+
// const tdRGB = document.createElement('td');
910+
// tdRGB.className = 'font';
911+
// tdRGB.textContent = '??';
912+
// tr.appendChild(tdRGB);
913+
const tdHex = document.createElement('td');
914+
tdHex.className = 'font';
915+
tdHex.textContent = '??';
916+
917+
// System Color Description
918+
const tdd = document.createElement('td');
919+
tdd.textContent = v.desc;
920+
tr.appendChild(tdd);
921+
922+
tbodyNode.appendChild(tr);
923+
const cStyle = window.getComputedStyle(div);
924+
// tdRGB.textContent = cStyle.backgroundColor;
925+
const colorHex = rgb2Hex(cStyle.backgroundColor);
926+
divHex.textContent = colorHex;
927+
div.ariaLabel = getHTMLColorName(v.name, colorHex);
928+
}
927929
}
928930

929931
// Usable colors list
930-
if (v.chromium && v.mozilla) {
932+
if (!v.chromium || !v.mozilla) {
931933
const liNode = document.createElement('li');
932934
const codeNode = document.createElement('code');
933935
codeNode.textContent = v.value;

0 commit comments

Comments
 (0)