@@ -76,24 +76,13 @@ table.deltaE td.dE5 { background: rgb(243, 103, 68); color: white}
7676
7777<script>
7878document.addEventListener("DOMContentLoaded", ()=>{
79- const testEl = document.createElement("div");
80- document.body.appendChild(testEl);
8179 [...document.querySelectorAll(".swatch")] .forEach(e=>{
82- /* test that the swatch color is recognized */
83- const testColor = getComputedStyle(e).getPropertyValue("--color");
84- testEl.style.color = "#010203";
85- const controlColor = getComputedStyle(testEl).color;
86- testEl.style.color = testColor;
87- const resultColor = getComputedStyle(testEl).color;
88- if(resultColor != controlColor) {
89- /* success! */
90- return
80+ const swatchColor = getComputedStyle(e).getPropertyValue("--color");
81+ if(!CSS.supports('color' , swatchColor)) {
82+ e.style.background = "repeating-linear-gradient(135deg, red 0, red 4px, white 4px, white 8px)";
83+ e.setAttribute("title", "Your browser does not recognize this color value, so we can't preview it.");
9184 }
92- /* otherwise, indicate it's a failure */
93- e.style.background = "repeating-linear-gradient(135deg, red 0, red 4px, white 4px, white 8px)";
94- e.setAttribute("title", "Your browser does not recognize this color value, so we can't preview it.");
9585 });
96- document.body.removeChild(testEl);
9786});
9887</script>
9988
0 commit comments