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 ec5e3e27a3
commit d79ea9364b
1 changed files with 16 additions and 3 deletions

View File

@ -72,6 +72,9 @@
"blue-700",
"indigo-700",
"magenta-700",
"static-white",
"static-black",
],
},
]
@ -101,9 +104,19 @@
}
const getCheckColor = value => {
return /^.*(white|(gray-(50|75|100|200|300|400|500)))\)$/.test(value)
? "var(--spectrum-global-color-gray-900)"
: "var(--spectrum-global-color-gray-50)"
// 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-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>