From e2426ed6e5004b518cf4b374db1a89f8d6e79697 Mon Sep 17 00:00:00 2001 From: Larvey Date: Tue, 25 Apr 2023 17:02:53 -0400 Subject: [PATCH] Make color picker button prioritize config colors --- .../Settings/Customization/Theme/ColorSelector.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/Settings/Customization/Theme/ColorSelector.tsx b/src/components/Settings/Customization/Theme/ColorSelector.tsx index a8725e9c7..c31cf748e 100644 --- a/src/components/Settings/Customization/Theme/ColorSelector.tsx +++ b/src/components/Settings/Customization/Theme/ColorSelector.tsx @@ -21,10 +21,13 @@ interface ColorControlProps { export function ColorSelector({ type, defaultValue }: ColorControlProps) { const { t } = useTranslation('settings/customization/color-selector'); - const [color, setColor] = useState(defaultValue); + const { config, name: configName } = useConfigContext(); + const [color, setColor] = + type === 'primary' + ? useState(config?.settings.customization.colors.primary || defaultValue) + : useState(config?.settings.customization.colors.secondary || defaultValue); const [popoverOpened, popover] = useDisclosure(false); const { setPrimaryColor, setSecondaryColor } = useColorTheme(); - const { config, name: configName } = useConfigContext(); const updateConfig = useConfigStore((x) => x.updateConfig); const theme = useMantineTheme();