diff --git a/packages/osd-ui-shared-deps/theme.ts b/packages/osd-ui-shared-deps/theme.ts index f7dfc371c89b..c803a5e37ef7 100644 --- a/packages/osd-ui-shared-deps/theme.ts +++ b/packages/osd-ui-shared-deps/theme.ts @@ -28,6 +28,7 @@ * under the License. */ +// ToDo: Use `THEME_SOURCES` from `src/core/server/rendering/views/theme` to generate the logic below. import LightTheme from '@elastic/eui/dist/eui_theme_light.json'; const globals: any = typeof window === 'undefined' ? {} : window; diff --git a/src/core/server/rendering/views/fonts.tsx b/src/core/server/rendering/views/fonts.tsx index 3f2196b56558..61005f2bf209 100644 --- a/src/core/server/rendering/views/fonts.tsx +++ b/src/core/server/rendering/views/fonts.tsx @@ -36,7 +36,7 @@ import { RenderingMetadata } from '../types'; interface Props { url: RenderingMetadata['uiPublicUrl']; - theme: string; + theme: RenderingMetadata['themeVersion']; } interface FontFace { diff --git a/src/core/server/rendering/views/styles.tsx b/src/core/server/rendering/views/styles.tsx index 6b63924dad5d..c3edbfe01bfd 100644 --- a/src/core/server/rendering/views/styles.tsx +++ b/src/core/server/rendering/views/styles.tsx @@ -33,12 +33,19 @@ import React, { FunctionComponent } from 'react'; import { RenderingMetadata } from '../types'; +import { getThemeDefinition, ThemeColorSchemes } from './theme'; interface Props { darkMode: RenderingMetadata['darkMode']; + theme: RenderingMetadata['themeVersion']; } -export const Styles: FunctionComponent = ({ darkMode }) => { +export const Styles: FunctionComponent = ({ theme, darkMode }) => { + const themeDefinition = getThemeDefinition( + theme, + darkMode ? ThemeColorSchemes.DARK : ThemeColorSchemes.LIGHT + ); + return (