From d3d696645d2e1fa96e78eabc5d4b760b374d29b3 Mon Sep 17 00:00:00 2001 From: Dave Falke Date: Fri, 22 Nov 2024 13:10:15 -0500 Subject: [PATCH] Expose all coreui color definitions as css custom properties. --- .../coreui/src/components/theming/UIThemeProvider.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/libs/coreui/src/components/theming/UIThemeProvider.tsx b/packages/libs/coreui/src/components/theming/UIThemeProvider.tsx index b6c35d226c..db0c10088b 100644 --- a/packages/libs/coreui/src/components/theming/UIThemeProvider.tsx +++ b/packages/libs/coreui/src/components/theming/UIThemeProvider.tsx @@ -3,6 +3,7 @@ import { css, Global, ThemeProvider } from '@emotion/react'; import { useCoreUIFonts } from '../../hooks'; import { UITheme } from './types'; +import colors from '../../definitions/colors'; export type UIThemeProviderProps = { theme: UITheme; @@ -21,6 +22,15 @@ export default function UIThemeProvider({ + typeof byHueOrValue === 'string' + ? [`--coreui-${colorName}: ${byHueOrValue};`] + : Object.entries(byHueOrValue).map( + ([hueName, colorValue]) => + `--coreui-${colorName}-${hueName}: ${colorValue};` + ) + )} + --coreui-color-primary: ${theme.palette.primary.hue[ theme.palette.primary.level ]};