Add static white and black color options to color picker

This commit is contained in:
Andrew Kingston 2021-08-13 12:39:57 +01:00
parent 0879f2aaf0
commit 6c7d3c171e
1 changed files with 16 additions and 3 deletions

View File

@ -72,6 +72,9 @@
"blue-700", "blue-700",
"indigo-700", "indigo-700",
"magenta-700", "magenta-700",
"static-white",
"static-black",
], ],
}, },
] ]
@ -101,10 +104,20 @@
} }
const getCheckColor = value => { const getCheckColor = value => {
return /^.*(white|(gray-(50|75|100|200|300|400|500)))\)$/.test(value) // Use dynamic color for theme grays
if (value?.includes("gray")) {
return /^.*(gray-(50|75|100|200|300|400|500))\)$/.test(value)
? "var(--spectrum-global-color-gray-900)" ? "var(--spectrum-global-color-gray-900)"
: "var(--spectrum-global-color-gray-50)" : "var(--spectrum-global-color-gray-50)"
} }
// Use black check for static white
if (value?.includes("static-black")) {
return "var(--spectrum-global-color-static-gray-50)"
}
return "var(--spectrum-global-color-static-gray-900)"
}
</script> </script>
<div class="container"> <div class="container">