From 6c7d3c171ed66c6673e5f7986eb1a9c08dd6a238 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 13 Aug 2021 12:39:57 +0100 Subject: [PATCH] Add static white and black color options to color picker --- .../bbui/src/ColorPicker/ColorPicker.svelte | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/bbui/src/ColorPicker/ColorPicker.svelte b/packages/bbui/src/ColorPicker/ColorPicker.svelte index 4d248d6190..e6adb81640 100644 --- a/packages/bbui/src/ColorPicker/ColorPicker.svelte +++ b/packages/bbui/src/ColorPicker/ColorPicker.svelte @@ -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)" }