Skip to content

Commit ff7b424

Browse files
authored
feat: DH-21259: Add map_style to theme (#2605)
This doesn't really block deephaven/deephaven-plugins#1279 but is used for it. I do think it's best to allow anyone to override the `map_style` in the theme if we want it to be allowed in the theme, although this method is a bit wonky so I'm not sure if it's the best way to do it.
1 parent 1af8bc2 commit ff7b424

10 files changed

Lines changed: 34 additions & 6 deletions

File tree

package-lock.json

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"@types/memoizee": "^0.4.5",
9393
"@types/node": "^24.8.0",
9494
"@types/papaparse": "5.3.2",
95-
"@types/plotly.js": "^3.0.0",
95+
"@types/plotly.js": "^3.0.8",
9696
"@types/pouchdb-browser": "^6.1.3",
9797
"@types/react": "^18.3.12",
9898
"@types/react-dom": "^18.3.1",

packages/chart/src/ChartTheme.module.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,7 @@
2626
indicator-increasing: var(--dh-color-chart-indicator-increase);
2727
indicator-decreasing: var(--dh-color-chart-indicator-decrease);
2828
indicator-gauge: var(--dh-color-chart-indicator-gauge);
29+
30+
/* Map */
31+
map-style: var(--dh-color-chart-map-style);
2932
}

packages/chart/src/ChartTheme.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ export interface ChartTheme {
3333
indicator_increasing: string;
3434
indicator_decreasing: string;
3535
indicator_gauge: string;
36+
37+
// Map
38+
map_style: string;
3639
}
3740

3841
export function defaultChartTheme(): Readonly<ChartTheme> {
@@ -74,6 +77,8 @@ export function defaultChartTheme(): Readonly<ChartTheme> {
7477
indicator_increasing: chartTheme['indicator-increasing'],
7578
indicator_decreasing: chartTheme['indicator-decreasing'],
7679
indicator_gauge: chartTheme['indicator-gauge'],
80+
// Map
81+
map_style: chartTheme['map-style'],
7782
});
7883
}
7984

packages/chart/src/ChartUtils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,6 +2142,7 @@ class ChartUtils {
21422142
ocean_color,
21432143
lake_color,
21442144
river_color,
2145+
map_style,
21452146
/* eslint-disable camelcase */
21462147
} = theme;
21472148

@@ -2196,6 +2197,9 @@ class ChartUtils {
21962197
lakecolor: lake_color,
21972198
rivercolor: river_color,
21982199
},
2200+
map: {
2201+
style: map_style,
2202+
},
21992203
};
22002204
layout.datarevision = 0;
22012205

packages/chart/src/__snapshots__/ChartTheme.test.ts.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ exports[`defaultChartTheme should create the default chart theme 1`] = `
1313
"land_color": "chartTheme['land-color']",
1414
"legend_color": "chartTheme['legend-color']",
1515
"linecolor": "chartTheme['linecolor']",
16+
"map_style": "chartTheme['map-style']",
1617
"ocean_color": "chartTheme['ocean-color']",
1718
"ohlc_decreasing": "chartTheme['ohlc-decreasing']",
1819
"ohlc_increasing": "chartTheme['ohlc-increasing']",

packages/chart/src/__snapshots__/ChartUtils.test.ts.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ exports[`makeDefaultTemplate should create a default template 1`] = `
104104
"color": "ChartTheme['title_color']",
105105
},
106106
},
107+
"map": {
108+
"style": "ChartTheme['map_style']",
109+
},
107110
"margin": {
108111
"b": 60,
109112
"l": 60,

packages/code-studio/src/styleguide/colorUtils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ export function buildColorGroups(
189189

190190
group = groupRemap[group] ?? group;
191191

192+
// Skip maps as there is no swatch to show currently
193+
if (group === 'map') {
194+
return acc;
195+
}
196+
192197
if (acc[group] == null) {
193198
acc[group] = [];
194199
}

packages/components/src/theme/theme-dark/theme-dark-semantic-chart.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,7 @@
5252
--dh-color-chart-indicator-increase: var(--dh-color-visual-green);
5353
--dh-color-chart-indicator-decrease: var(--dh-color-visual-red);
5454
--dh-color-chart-indicator-gauge: var(--dh-color-green-1000);
55+
56+
/* Map */
57+
--dh-color-chart-map-style: dark;
5558
}

packages/components/src/theme/theme-light/theme-light-semantic-chart.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,7 @@
5252
--dh-color-chart-indicator-increase: var(--dh-color-visual-green);
5353
--dh-color-chart-indicator-decrease: var(--dh-color-visual-red);
5454
--dh-color-chart-indicator-gauge: var(--dh-color-green-1000);
55+
56+
/* Map */
57+
--dh-color-chart-map-style: light;
5558
}

0 commit comments

Comments
 (0)