Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
feat: add space theme and configurable theme cycle (#3755)
Igor Dykhtaaf5ded87b4bf
diff --git a/docs/api-reference/custom-theme/README.md b/docs/api-reference/custom-theme/README.mdindex 9a3800fce..9c281356e 100644--- a/docs/api-reference/custom-theme/README.md+++ b/docs/api-reference/custom-theme/README.md@@ -22,19 +22,20 @@ const Map = props => (| ------- | ------- || `dark` (default) |  || `light` |  |+| `space` | Azure surfaces with a blue accent; same layout as `dark`. || `base` |  |### Theme Toggle Control-To show a map control that lets users switch between light and dark themes at runtime, enable it via application config:+To show a map control that cycles UI themes at runtime, pass the list of theme names. The first name is the default. The switcher is shown only when the list has two or more themes.```jsimport {initApplicationConfig} from '@kepler.gl/utils';-initApplicationConfig({enableThemeToggle: true});+initApplicationConfig({themes: ['dark', 'light', 'space']});```-When enabled, the active theme is stored in `uiState.theme` (`'light'` | `'dark'`) and can be initialized through `keplerGlReducer.initialState`:+When a list is set, the active theme is stored in `uiState.theme` and can be initialized through `keplerGlReducer.initialState`:```jskeplerGlReducer.initialState({diff --git a/src/actions/src/ui-state-actions.ts b/src/actions/src/ui-state-actions.tsindex 9afe9f091..ff0f00861 100644--- a/src/actions/src/ui-state-actions.ts+++ b/src/actions/src/ui-state-actions.ts@@ -498,7 +498,7 @@ export type SetThemeUpdaterAction = {payload: {theme: string};};/**- * Set UI `theme` value (`light` or `dark`)+ * Set UI `theme` value (`light`, `dark`, or `space`)* @memberof uiStateActions* @param theme - theme of the UI* @publicdiff --git a/src/components/src/common/icons/index.tsx b/src/components/src/common/icons/index.tsxindex b5c36d6f4..aa08526f6 100644--- a/src/components/src/common/icons/index.tsx+++ b/src/components/src/common/icons/index.tsx@@ -99,6 +99,7 @@ export {default as CursorPoint} from './cursor-point';export {default as Calendar} from './calendar';export {default as LocationMarker} from './location-marker';export {default as Globe} from './globe';+export {default as Space} from './space';export {default as Sun} from './sun';export {default as Sunrise} from './sunrise';export {default as Sunset} from './sunset';diff --git a/src/components/src/common/icons/space.tsx b/src/components/src/common/icons/space.tsxnew file mode 100644index 000000000..5a29283d3--- /dev/null+++ b/src/components/src/common/icons/space.tsx@@ -0,0 +1,24 @@+// SPDX-License-Identifier: MIT+// Copyright contributors to the kepler.gl project++import React, {Component} from 'react';+import Base, {BaseProps} from './base';++export default class Space extends Component<Partial<BaseProps>> {+ static defaultProps = {+ height: '16px',+ viewBox: '0 0 16 16',+ predefinedClassName: 'data-ex-icons-space'+ };++ render() {+ return (+ <Base {...this.props}>+ <rect x="1.5" y="1.5" width="5.5" height="5.5" rx="1" />+ <rect x="9" y="1.5" width="5.5" height="5.5" rx="1" />+ <rect x="1.5" y="9" width="5.5" height="5.5" rx="1" />+ <rect x="9" y="9" width="5.5" height="5.5" rx="1" />+ </Base>+ );+ }+}diff --git a/src/components/src/kepler-gl.tsx b/src/components/src/kepler-gl.tsxindex 50e151026..2cabb06af 100644--- a/src/components/src/kepler-gl.tsx+++ b/src/components/src/kepler-gl.tsx@@ -69,10 +69,17 @@ import {observeDimensions,unobserveDimensions,hasPortableWidth,- getApplicationConfig+ getApplicationConfig,+ getConfiguredThemes} from '@kepler.gl/utils';-import {theme as basicTheme, themeLT, themeBS, breakPointValues} from '@kepler.gl/styles';+import {+ theme as basicTheme,+ themeLT,+ themeBS,+ themeSpace,+ breakPointValues+} from '@kepler.gl/styles';import {KeplerGlState} from '@kepler.gl/reducers';import {Provider} from '@kepler.gl/cloud-providers';@@ -554,8 +561,13 @@ function KeplerGlFactory(this.themeSelector,this.uiThemeSelector,(theme, uiTheme) => {- // When theme toggle is enabled, uiState.theme drives light/dark switching.- const themeInput = getApplicationConfig().enableThemeToggle ? uiTheme || THEME.dark : theme;+ const configuredThemes = getConfiguredThemes();+ // A configured list drives named theme switching; otherwise the `theme` prop is used.+ const themeInput = configuredThemes.length+ ? configuredThemes.includes(uiTheme)+ ? uiTheme+ : configuredThemes[0]+ : theme;if (typeof themeInput === 'object' && themeInput !== null) {return {@@ -569,6 +581,9 @@ function KeplerGlFactory(if (themeInput === THEME.base) {return themeBS;}+ if (themeInput === THEME.space) {+ return themeSpace;+ }// THEME.dark and unknown values fall back to the default dark themereturn basicTheme;}diff --git a/src/components/src/map/theme-toggle-button.tsx b/src/components/src/map/theme-toggle-button.tsxindex 26efd277a..7981a6a2e 100644--- a/src/components/src/map/theme-toggle-button.tsx+++ b/src/components/src/map/theme-toggle-button.tsx@@ -6,22 +6,29 @@ import classnames from 'classnames';import {THEME} from '@kepler.gl/constants';import {MapControls} from '@kepler.gl/types';-import {getApplicationConfig} from '@kepler.gl/utils';+import {getNextUiTheme, shouldShowThemeSwitcher} from '@kepler.gl/utils';-import {Moon, Sun} from '../common/icons';+import {Moon, Space, Sun} from '../common/icons';import {MapControlButton} from '../common/styled-components';import MapControlTooltipFactory from './map-control-tooltip';interface ThemeToggleButtonIcons {sun: ComponentType<any>;moon: ComponentType<any>;+ space: ComponentType<any>;}+const NEXT_THEME_TOOLTIP: Record<string, string> = {+ [THEME.light]: 'tooltip.switchToLightTheme',+ [THEME.dark]: 'tooltip.switchToDarkTheme',+ [THEME.space]: 'tooltip.switchToSpaceTheme'+};+export type ThemeToggleButtonProps = {themeName?: string;onSetTheme: (theme: string) => void;mapControls: MapControls;- actionIcons?: ThemeToggleButtonIcons;+ actionIcons?: Partial<ThemeToggleButtonIcons>;};ThemeToggleButtonFactory.deps = [MapControlTooltipFactory];@@ -29,26 +36,28 @@ ThemeToggleButtonFactory.deps = [MapControlTooltipFactory];function ThemeToggleButtonFactory(MapControlTooltip: ReturnType<typeof MapControlTooltipFactory>) {const defaultActionIcons = {sun: Sun,- moon: Moon+ moon: Moon,+ space: Space};const ThemeToggleButton: React.FC<ThemeToggleButtonProps> = ({themeName = THEME.dark,onSetTheme,mapControls,- actionIcons = defaultActionIcons+ actionIcons: customActionIcons}) => {- const isLight = themeName === THEME.light;+ const actionIcons = {...defaultActionIcons, ...customActionIcons};+ const upcomingTheme = getNextUiTheme(themeName);const onClick = useCallback(event => {event.preventDefault();- onSetTheme(isLight ? THEME.dark : THEME.light);+ onSetTheme(getNextUiTheme(themeName));},- [isLight, onSetTheme]+ [themeName, onSetTheme]);- if (!getApplicationConfig().enableThemeToggle) {+ if (!shouldShowThemeSwitcher()) {return null;}@@ -57,17 +66,25 @@ function ThemeToggleButtonFactory(MapControlTooltip: ReturnType<typeof MapControreturn null;}- const Icon = isLight ? actionIcons.moon : actionIcons.sun;+ const Icon =+ upcomingTheme === THEME.light+ ? actionIcons.sun+ : upcomingTheme === THEME.space+ ? actionIcons.space+ : actionIcons.moon;return (<MapControlTooltipid="toggle-theme"- message={isLight ? 'tooltip.switchToDarkTheme' : 'tooltip.switchToLightTheme'}+ message={NEXT_THEME_TOOLTIP[upcomingTheme] || 'tooltip.switchToDarkTheme'}><MapControlButton- className={classnames('map-control-button', 'toggle-theme', {light: isLight})}+ className={classnames('map-control-button', 'toggle-theme', {+ light: themeName === THEME.light,+ space: themeName === THEME.space+ })}onClick={onClick}- active={isLight}+ active={themeName !== THEME.dark}><Icon height="18px" /></MapControlButton>diff --git a/src/constants/src/default-settings.ts b/src/constants/src/default-settings.tsindex e13b25d49..2a095c171 100644--- a/src/constants/src/default-settings.ts+++ b/src/constants/src/default-settings.ts@@ -137,7 +137,8 @@ export const DIMENSIONS = {/*** Theme name that can be passed to `KeplerGl` `prop.theme`.- * Available themes are `THEME.light` and `THEME.dark`. Default theme is `THEME.dark`+ * Available themes are `THEME.light`, `THEME.dark`, and `THEME.space`.+ * Default theme is `THEME.dark`* @constant* @type {object}* @public@@ -149,6 +150,7 @@ export const DIMENSIONS = {export const THEME = keyMirror({light: null,dark: null,+ space: null,base: null});diff --git a/src/localization/src/translations/ca.ts b/src/localization/src/translations/ca.tsindex 50f279fbf..5664ab18a 100644--- a/src/localization/src/translations/ca.ts+++ b/src/localization/src/translations/ca.ts@@ -354,6 +354,7 @@ export default {selectLocale: 'Selecciona configuració regional',switchToLightTheme: 'Canvia al tema clar',switchToDarkTheme: 'Canvia al tema fosc',+ switchToSpaceTheme: 'Canvia al tema space',showAiAssistantPanel: 'Mostra el tauler de AI Assistant',hideAiAssistantPanel: 'Oculta el tauler de AI Assistant',hideLayerPanel: 'Oculta el tauler de capes',diff --git a/src/localization/src/translations/cn.ts b/src/localization/src/translations/cn.tsindex 9c5c6f078..ef99b1e8d 100644--- a/src/localization/src/translations/cn.ts+++ b/src/localization/src/translations/cn.ts@@ -339,6 +339,7 @@ export default {selectLocale: '选择语言',switchToLightTheme: '切换到浅色主题',switchToDarkTheme: '切换到深色主题',+ switchToSpaceTheme: '切换到 Space 主题',showAiAssistantPanel: '显示 AI 助手面板',hideAiAssistantPanel: '隐藏 AI 助手面板',hideLayerPanel: '隐藏图层面板',diff --git a/src/localization/src/translations/en.ts b/src/localization/src/translations/en.tsindex a1e8ec139..59cbb1880 100644--- a/src/localization/src/translations/en.ts+++ b/src/localization/src/translations/en.ts@@ -443,6 +443,7 @@ export default {selectLocale: 'Select locale',switchToLightTheme: 'Switch to light theme',switchToDarkTheme: 'Switch to dark theme',+ switchToSpaceTheme: 'Switch to space theme',showAiAssistantPanel: 'Show AI Assistant',hideAiAssistantPanel: 'Hide AI Assistant',hideLayerPanel: 'Hide layer panel',diff --git a/src/localization/src/translations/es.ts b/src/localization/src/translations/es.tsindex 442baf9c3..ddb1b0ca6 100644--- a/src/localization/src/translations/es.ts+++ b/src/localization/src/translations/es.ts@@ -355,6 +355,7 @@ export default {selectLocale: 'Seleccionar configuración regional',switchToLightTheme: 'Cambiar a tema claro',switchToDarkTheme: 'Cambiar a tema oscuro',+ switchToSpaceTheme: 'Cambiar a tema space',showAiAssistantPanel: 'Mostrar el panel de AI Assistant',hideAiAssistantPanel: 'Ocultar el panel de AI Assistant',hideLayerPanel: 'Ocultar la tabla de capas',diff --git a/src/localization/src/translations/fi.ts b/src/localization/src/translations/fi.tsindex 9d7696d63..59e9f807a 100644--- a/src/localization/src/translations/fi.ts+++ b/src/localization/src/translations/fi.ts@@ -353,6 +353,7 @@ export default {selectLocale: 'Valitse kielisyys',switchToLightTheme: 'Vaihda vaaleaan teemaan',switchToDarkTheme: 'Vaihda tummaan teemaan',+ switchToSpaceTheme: 'Vaihda Space-teemaan',showAiAssistantPanel: 'Näytä AI-apuohjelman paneeli',hideAiAssistantPanel: 'Piilota AI-apuohjelman paneeli',hideLayerPanel: 'Piilota tasopaneeli',diff --git a/src/localization/src/translations/ja.ts b/src/localization/src/translations/ja.tsindex 7f0e15165..fdcfe7bd0 100644--- a/src/localization/src/translations/ja.ts+++ b/src/localization/src/translations/ja.ts@@ -350,6 +350,7 @@ export default {selectLocale: '言語設定',switchToLightTheme: 'ライトテーマに切り替え',switchToDarkTheme: 'ダークテーマに切り替え',+ switchToSpaceTheme: 'Spaceテーマに切り替え',showAiAssistantPanel: 'AI 助手パネルを表示',hideAiAssistantPanel: 'AI 助手パネルを非表示',hideLayerPanel: 'レイヤパネルを非表示',diff --git a/src/localization/src/translations/pt.ts b/src/localization/src/translations/pt.tsindex 107d8211b..409172d48 100644--- a/src/localization/src/translations/pt.ts+++ b/src/localization/src/translations/pt.ts@@ -355,6 +355,7 @@ export default {selectLocale: 'Selecionar língua',switchToLightTheme: 'Mudar para tema claro',switchToDarkTheme: 'Mudar para tema escuro',+ switchToSpaceTheme: 'Mudar para tema space',showAiAssistantPanel: 'Mostrar painel de AI Assistant',hideAiAssistantPanel: 'Esconder painel de AI Assistant',hideLayerPanel: 'Esconder painel de camada',diff --git a/src/localization/src/translations/ru.ts b/src/localization/src/translations/ru.tsindex d4d2506ea..d5def96c6 100644--- a/src/localization/src/translations/ru.ts+++ b/src/localization/src/translations/ru.ts@@ -352,6 +352,7 @@ export default {selectLocale: 'Выберите регион',switchToLightTheme: 'Переключить на светлую тему',switchToDarkTheme: 'Переключить на тёмную тему',+ switchToSpaceTheme: 'Переключить на тему Space',showAiAssistantPanel: 'Показать панель AI Assistant',hideAiAssistantPanel: 'Скрыть панель AI Assistant',hideLayerPanel: 'Скрыть панель слоев',diff --git a/src/reducers/src/ui-state-updaters.ts b/src/reducers/src/ui-state-updaters.tsindex 00f4b20f6..da5d89823 100644--- a/src/reducers/src/ui-state-updaters.ts+++ b/src/reducers/src/ui-state-updaters.ts@@ -19,7 +19,9 @@ import {createNotification,errorNotification,calculateExportImageSize,- getApplicationConfig+ getApplicationConfig,+ getConfiguredThemes,+ getDefaultUiTheme} from '@kepler.gl/utils';import {payload_, apply_, compose_} from './composer-helpers';@@ -299,7 +301,7 @@ export const INITIAL_UI_STATE: UiState = {loadFiles: DEFAULT_LOAD_FILES,// Locale of the UIlocale: LOCALE_CODES.en,- // Theme of the UI (used when enableThemeToggle is on)+ // Theme of the UI (`light` | `dark` | `space`). First of `themes` is the default when set.theme: THEME.dark,layerPanelListView: 'list',filterPanelListView: 'list',@@ -316,10 +318,19 @@ export const initUiStateUpdater = (type?: (typeof ActionTypes)['INIT'];payload: KeplerGlInitPayload;}-): UiState => ({- ...state,- ...(action.payload || {}).initialUiState-});+): UiState => {+ const initialUiState = (action.payload || {}).initialUiState || {};+ const themes = getConfiguredThemes();+ const requested = initialUiState.theme ?? state.theme;+ const theme =+ themes.length === 0 ? requested : themes.includes(requested) ? requested : getDefaultUiTheme();++ return {+ ...state,+ ...initialUiState,+ theme+ };+};/*** Toggle active side paneldiff --git a/src/styles/src/index.ts b/src/styles/src/index.tsindex 88a2bc2b8..d6f3ff35d 100644--- a/src/styles/src/index.ts+++ b/src/styles/src/index.ts@@ -2,4 +2,5 @@// Copyright contributors to the kepler.gl projectexport * from './base';+export * from './space-theme';export * from './media-breakpoints';diff --git a/src/styles/src/space-theme.ts b/src/styles/src/space-theme.tsnew file mode 100644index 000000000..8638428d6--- /dev/null+++ b/src/styles/src/space-theme.ts@@ -0,0 +1,200 @@+// SPDX-License-Identifier: MIT+// Copyright contributors to the kepler.gl project++import {theme} from './base';++/**+ * Color palette for the space UI theme+ */+const COLOR = {+ AZURE: '#0E111A',+ AZURE950: '#161B29',+ AZURE900: '#1C2233',+ AZURE800: '#262D40',+ AZURE700: '#2E364D',+ AZURE600: '#313A52',+ AZURE500: '#363F59',+ AZURE300: '#3D4866',+ AZURE200: '#54638C',+ AZURE150: '#5C6C99',+ AZURE100: '#7A90CC',++ GREY: '#8F90BC',+ GREY20: '#D5D5E6',+ GREY10: '#ECECF3',++ BLUE: '#5558DB',+ BLUE110: '#4F52CC',++ VIOLET: '#8863F8',+ ORANGE: '#F7B26B',+ GREEN: '#4BB34B',+ RED: '#F05C44',+ RED80: 'rgba(240, 92, 68, 0.8)',++ WHITE: '#F7F8FA',+ PURE_WHITE: '#FFFFFF'+};++/**+ * Space color theme. Kepler dark layout/sizing, with azure surfaces and a blue accent.+ */+export const themeSpace = {+ ...theme,++ activeColor: COLOR.BLUE,+ activeColorHover: COLOR.BLUE110,+ secondaryActiveColor: COLOR.GREEN,+ errorColor: COLOR.RED,+ logoColor: COLOR.BLUE,+ borderColor: COLOR.AZURE900,++ textColor: COLOR.WHITE,+ textColorHl: COLOR.WHITE,+ textColorLT: COLOR.AZURE300,+ titleTextColor: COLOR.WHITE,+ subtextColor: COLOR.AZURE200,+ subtextColorLT: COLOR.AZURE200,+ subtextColorActive: COLOR.WHITE,+ labelColor: COLOR.AZURE150,+ labelColorLT: COLOR.GREY,+ labelHoverColor: COLOR.AZURE100,+ titleColorLT: COLOR.AZURE,+ fontWhiteColor: COLOR.AZURE200,++ sidePanelBg: COLOR.AZURE,+ sidePanelHeaderBg: COLOR.AZURE900,+ sideBarCloseBtnBgd: COLOR.AZURE900,+ sideBarCloseBtnColor: COLOR.WHITE,+ sideBarCloseBtnBgdHover: COLOR.AZURE800,++ panelBackground: COLOR.AZURE900,+ panelContentBackground: COLOR.AZURE950,+ panelBackgroundHover: COLOR.AZURE800,+ panelBackgroundLT: COLOR.PURE_WHITE,+ panelBorderColor: COLOR.AZURE900,+ panelBorder: `1px solid ${COLOR.AZURE900}`,+ panelHeaderIcon: COLOR.AZURE200,+ panelHeaderIconActive: COLOR.WHITE,+ panelHeaderIconHover: COLOR.WHITE,+ panelToggleBorderColor: COLOR.BLUE,+ panelTabColor: COLOR.AZURE200,+ mapPanelBackgroundColor: COLOR.AZURE,+ mapPanelHeaderBackgroundColor: COLOR.AZURE900,+ bottomWidgetBgd: COLOR.AZURE900,+ chickletBgd: COLOR.AZURE500,+ layerPanelToggleOptionColor: COLOR.AZURE200,+ layerPanelToggleOptionColorActive: COLOR.WHITE,+ layerConfiguratorBorderColor: COLOR.AZURE500,++ primaryBtnBgd: COLOR.BLUE,+ primaryBtnActBgd: COLOR.BLUE110,+ primaryBtnBgdHover: COLOR.BLUE110,+ primaryBtnColor: COLOR.WHITE,+ primaryBtnActColor: COLOR.WHITE,+ secondaryBtnBgd: COLOR.AZURE700,+ secondaryBtnColor: COLOR.WHITE,+ secondaryBtnActBgd: COLOR.AZURE600,+ secondaryBtnBgdHover: COLOR.AZURE600,+ secondaryBtnActColor: COLOR.WHITE,+ floatingBtnBgd: COLOR.AZURE900,+ floatingBtnActBgd: COLOR.AZURE800,+ floatingBtnBgdHover: COLOR.AZURE800,+ floatingBtnColor: COLOR.AZURE200,+ floatingBtnActColor: COLOR.WHITE,+ ctaBtnBgd: COLOR.BLUE110,+ ctaBtnBgdHover: COLOR.BLUE,+ ctaBtnActBgd: COLOR.BLUE,+ ctaBtnColor: COLOR.WHITE,+ ctaBtnActColor: COLOR.WHITE,+ negativeBtnBgd: COLOR.RED,+ negativeBtnActBgd: COLOR.RED80,+ negativeBtnBgdHover: COLOR.RED80,+ negativeBtnColor: COLOR.WHITE,+ negativeBtnActColor: COLOR.WHITE,+ linkBtnColor: COLOR.AZURE200,+ linkBtnActColor: COLOR.AZURE100,+ selectionBtnColor: COLOR.AZURE200,+ selectionBtnActColor: COLOR.BLUE,+ selectionBtnBorderColor: COLOR.AZURE200,+ selectionBtnBorderActColor: COLOR.BLUE,++ inputBgd: COLOR.AZURE900,+ inputColor: COLOR.WHITE,+ inputBgdHover: COLOR.AZURE800,+ inputBgdActive: COLOR.AZURE800,+ inputBorderColor: COLOR.AZURE900,+ inputBorderHoverColor: COLOR.AZURE800,+ inputBorderActiveColor: COLOR.BLUE,+ inputPlaceholderColor: COLOR.AZURE200,+ inputPlaceholderColorLT: COLOR.AZURE200,+ secondaryInputBgd: COLOR.AZURE800,+ secondaryInputColor: COLOR.WHITE,+ secondaryInputBgdActive: COLOR.AZURE700,+ secondaryInputBgdHover: COLOR.AZURE700,+ secondaryInputBorderColor: COLOR.AZURE800,+ secondaryInputBorderActiveColor: COLOR.BLUE,++ selectColor: COLOR.WHITE,+ selectColorPlaceHolder: COLOR.AZURE200,+ selectBackground: COLOR.AZURE900,+ selectBackgroundHover: COLOR.AZURE800,+ selectBorderColor: COLOR.AZURE800,+ selectBackgroundLT: COLOR.GREY10,+ selectBorderColorLT: COLOR.GREY10,+ inputBorderActiveColorLT: COLOR.BLUE,+ inputBorderHoverColorLT: COLOR.GREY20,+ inputBgdActiveLT: COLOR.GREY20,+ dropdownListBgd: COLOR.AZURE900,+ dropdownListHighlightBg: COLOR.AZURE800,+ dropdownListBorderTop: COLOR.AZURE800,+ toolbarItemBgdHover: COLOR.AZURE800,+ toolbarItemIconHover: COLOR.BLUE,++ switchTrackBgd: COLOR.AZURE800,+ secondarySwitchTrackBgd: COLOR.AZURE800,+ switchTrackBgdActive: COLOR.BLUE,+ secondarySwitchBtnBgd: COLOR.AZURE200,+ switchBtnBgd: COLOR.AZURE200,+ switchBtnBgdActive: COLOR.WHITE,++ checkboxBoxBgdChecked: COLOR.BLUE,+ checkboxBoxBgd: 'transparent',+ checkboxBorderColor: COLOR.AZURE200,++ scrollbarThumbColorLT: COLOR.AZURE200,+ scrollbarThumbColorHoverLT: COLOR.GREY,++ tooltipBg: COLOR.AZURE300,+ tooltipColor: COLOR.WHITE,++ sliderHandleColor: COLOR.WHITE,+ sliderHandleTextColor: COLOR.BLUE,+ sliderHandleHoverColor: COLOR.WHITE,+ sliderBarColor: COLOR.BLUE,+ sliderBarBgd: COLOR.AZURE900,+ sliderBarHoverColor: COLOR.AZURE100,+ rangeBrushBgd: COLOR.AZURE700,+ histogramFillInRange: COLOR.BLUE,+ histogramFillOutRange: COLOR.AZURE600,+ histogramOverlayColor: COLOR.AZURE600,+ axisFontColor: COLOR.AZURE200,++ effectPanelTextMain: COLOR.WHITE,+ effectPanelTextSecondary1: COLOR.AZURE100,+ effectPanelTextSecondary2: COLOR.AZURE200,+ effectPanelTextSecondary3: COLOR.AZURE300,+ effectPanelElementColor: COLOR.AZURE800,+ effectPanelElementColorSelected: COLOR.AZURE700,+ effectPanelElementColorActive: COLOR.AZURE300,+ effectPanelElementColorHovered: COLOR.AZURE200,+ effectPanelElementColorSun: COLOR.ORANGE,++ notificationColors: {+ info: COLOR.VIOLET,+ error: COLOR.RED,+ success: COLOR.GREEN,+ warning: COLOR.ORANGE+ },+ progressBarColor: COLOR.BLUE+};diff --git a/src/types/reducers.d.ts b/src/types/reducers.d.tsindex e0ae22b70..c2055fc9f 100644--- a/src/types/reducers.d.ts+++ b/src/types/reducers.d.ts@@ -591,7 +591,7 @@ export type UiState = {loadFiles: LoadFiles;// Locale of the UIlocale: Locale;- // Theme of the UI (`light` | `dark`), used when enableThemeToggle is on+ // Theme of the UI (`light` | `dark` | `space`). First of `themes` is the default when set.theme: UiTheme;// view layers by list or datasetlayerPanelListView: PanelListView;diff --git a/src/utils/src/application-config.ts b/src/utils/src/application-config.tsindex f77a1cc46..8b5f3a5c6 100644--- a/src/utils/src/application-config.ts+++ b/src/utils/src/application-config.ts@@ -214,8 +214,13 @@ export type KeplerApplicationConfig = {/** Whether to enable the layer groups feature. Enabled by default. */enableLayerGroups?: boolean;- /** Whether to show a map control to toggle between light and dark UI themes. Disabled by default. */- enableThemeToggle?: boolean;+ /**+ * Named UI themes to cycle (`dark`, `light`, `space`, `base`).+ * Empty (default): dark theme, no switcher.+ * One theme: that theme is used, no switcher.+ * Two or more: first is the default, a map control cycles the list.+ */+ themes?: string[];/** Whether to show column statistics in the data table modal. Enabled by default. */enableColumnStats?: boolean;@@ -422,7 +427,7 @@ const DEFAULT_APPLICATION_CONFIG: Required<KeplerApplicationConfig> = {enableLayerGroups: true,- enableThemeToggle: false,+ themes: [],enableColumnStats: true,diff --git a/src/utils/src/index.ts b/src/utils/src/index.tsindex 2d50dbd46..bc461c6fd 100644--- a/src/utils/src/index.ts+++ b/src/utils/src/index.ts@@ -217,6 +217,12 @@ export {DataRow} from './data-row';// Application configexport {getApplicationConfig, initApplicationConfig} from './application-config';+export {+ getConfiguredThemes,+ shouldShowThemeSwitcher,+ getDefaultUiTheme,+ getNextUiTheme+} from './theme-utils';export type {KeplerApplicationConfig,KeplerAcceptedFileFormat,diff --git a/src/utils/src/theme-utils.ts b/src/utils/src/theme-utils.tsnew file mode 100644index 000000000..359a5989f--- /dev/null+++ b/src/utils/src/theme-utils.ts@@ -0,0 +1,35 @@+// SPDX-License-Identifier: MIT+// Copyright contributors to the kepler.gl project++import {THEME} from '@kepler.gl/constants';++import {getApplicationConfig} from './application-config';++/** Configured UI theme names, in cycle order. Empty when unset. */+export function getConfiguredThemes(): string[] {+ const {themes} = getApplicationConfig();+ if (!Array.isArray(themes)) {+ return [];+ }+ return themes.filter((name): name is string => typeof name === 'string' && name.length > 0);+}++/** True when the map control should cycle themes (two or more names). */+export function shouldShowThemeSwitcher(): boolean {+ return getConfiguredThemes().length > 1;+}++/** First configured theme, or dark when none are set. */+export function getDefaultUiTheme(): string {+ return getConfiguredThemes()[0] || THEME.dark;+}++/** Next theme in the configured cycle. */+export function getNextUiTheme(current?: string): string {+ const themes = getConfiguredThemes();+ if (themes.length === 0) {+ return THEME.dark;+ }+ const index = current ? themes.indexOf(current) : -1;+ return themes[index === -1 ? 0 : (index + 1) % themes.length];+}