An open source alternative to Tableau. Embeddable visual analytic
TypeScript bidatadata-analysisdata-miningdata-visualizationedak6skanarieslow-codepivot-tablereacttableautableau-alternativetypescriptvegavega-litevisualization
feat: add danqing and sodapop built-in themes
Elwynn Chen70439ec97a6c
diff --git a/packages/graphic-walker/src/components/visualConfig/index.tsx b/packages/graphic-walker/src/components/visualConfig/index.tsxindex e651133a..58a2fa9d 100644--- a/packages/graphic-walker/src/components/visualConfig/index.tsx+++ b/packages/graphic-walker/src/components/visualConfig/index.tsx@@ -269,6 +269,8 @@ const VisualConfigPanel: React.FC = () => {{ value: 'vega', label: 'vega' },{ value: 'g2', label: 'g2' },{ value: 'streamlit', label: 'streamlit' },+ { value: 'danqing', label: 'danqing' },+ { value: 'sodapop', label: 'sodapop' },]}/></div>diff --git a/packages/graphic-walker/src/interfaces.ts b/packages/graphic-walker/src/interfaces.tsindex 006749e3..c48a94bd 100644--- a/packages/graphic-walker/src/interfaces.ts+++ b/packages/graphic-walker/src/interfaces.ts@@ -475,7 +475,7 @@ export enum ISegmentKey {chat = 'chat',}-export type IThemeKey = 'vega' | 'g2' | 'streamlit';+export type IThemeKey = 'vega' | 'g2' | 'streamlit' | 'danqing' | 'sodapop';export type IDarkMode = 'media' | 'light' | 'dark';export type IComputationFunction = (payload: IDataQueryPayload) => Promise<IRow[]>;diff --git a/packages/graphic-walker/src/utils/useTheme.ts b/packages/graphic-walker/src/utils/useTheme.tsindex 1f20cc09..05eb9635 100644--- a/packages/graphic-walker/src/utils/useTheme.ts+++ b/packages/graphic-walker/src/utils/useTheme.ts@@ -59,7 +59,7 @@ function parsePalette(v?: RangeScheme): string[] | undefined {}export function getColor(theme: VegaGlobalConfig) {- const stroke = theme.point?.stroke ?? DEFAULT_COLOR;+ const stroke = theme.point?.stroke ?? theme.point?.fill ?? DEFAULT_COLOR;const primaryColor = typeof stroke === 'string' ? stroke : DEFAULT_COLOR;const nominalPalette = parsePalette(theme.range?.category) ?? getPalette('tableau10');const quantitativePalette = parsePalette(theme.range?.ramp) ?? getPalette('blues');diff --git a/packages/graphic-walker/src/vis/theme.ts b/packages/graphic-walker/src/vis/theme.tsindex a62da79f..bd4d9ece 100644--- a/packages/graphic-walker/src/vis/theme.ts+++ b/packages/graphic-walker/src/vis/theme.ts@@ -296,10 +296,181 @@ export const AntVTheme: GWGlobalConfig = {},};+const DANQING_COLOR = '#38699b';+const DANQING_COLOR_DARK = '#7fa8ce';+const DANQING_TITLE_FONT = '"Source Han Serif SC", "Songti SC", "Noto Serif SC", Georgia, serif';++/**+ * DanQing — inspired by traditional Chinese mineral pigment painting:+ * azurite blue as the primary, alternating warm and cool hues (vermilion, gamboge,+ * malachite, rouge) so adjacent categories stay distinguishable. The sequential ramp+ * runs moon-white to indigo-black, while the heatmap deliberately switches to a warm+ * paper-to-vermilion scale. Dotted grid lines and hollow points give an ink-outline feel.+ */+export const DanQingTheme: GWGlobalConfig = {+ light: {+ background: 'transparent',+ area: { fill: DANQING_COLOR },+ bar: { fill: DANQING_COLOR, binSpacing: 2 },+ circle: { fill: DANQING_COLOR },+ line: { stroke: DANQING_COLOR, strokeWidth: 2 },+ point: { stroke: DANQING_COLOR, strokeWidth: 1.5 },+ rect: { fill: DANQING_COLOR },+ tick: { fill: DANQING_COLOR },+ arc: { fill: DANQING_COLOR },+ boxplot: { ticks: true },+ title: { font: DANQING_TITLE_FONT, fontWeight: 600 },+ axis: {+ gridColor: '#e3ddcf',+ gridDash: [1, 3],+ domainColor: '#b3ac9c',+ tickColor: '#b3ac9c',+ labelColor: '#6e6a61',+ titleColor: '#4a453b',+ },+ legend: { labelColor: '#6e6a61', titleColor: '#4a453b' },+ header: { labelColor: '#6e6a61', titleColor: '#4a453b' },+ view: { stroke: '#e3ddcf' },+ range: {+ category: ['#38699b', '#d45e3c', '#d9a73e', '#4e8d74', '#7d5fa6', '#c05a78', '#64a6b8', '#9c6b3f', '#8e96cc', '#97a254'],+ diverging: ['#93321c', '#b04c2d', '#cb6a45', '#e19067', '#efbb9c', '#f2ede3', '#bcd0d4', '#8fb3bd', '#62909f', '#3c6c82', '#1f4a63'],+ heatmap: ['#faf6ed', '#f0e3c8', '#e5c99e', '#daa871', '#cc8250', '#b85c3b', '#9a3d2c', '#742a22', '#4c1d18'],+ ramp: ['#f4f8f8', '#deebea', '#c2d9da', '#9fc2c8', '#78a6b2', '#568a9c', '#3c6e86', '#28536d', '#183b52', '#0c2638'],+ },+ // scale for geo only+ scale: {+ continuous: { range: ['#deebea', '#28536d'] },+ },+ },+ dark: {+ background: 'transparent',+ area: { fill: DANQING_COLOR_DARK },+ bar: { fill: DANQING_COLOR_DARK, binSpacing: 2 },+ circle: { fill: DANQING_COLOR_DARK },+ line: { stroke: DANQING_COLOR_DARK, strokeWidth: 2 },+ point: { stroke: DANQING_COLOR_DARK, strokeWidth: 1.5 },+ rect: { fill: DANQING_COLOR_DARK },+ tick: { fill: DANQING_COLOR_DARK },+ arc: { fill: DANQING_COLOR_DARK },+ boxplot: {+ ticks: { fill: '#c9c2b4' },+ rule: { color: '#c9c2b4' },+ },+ title: { font: DANQING_TITLE_FONT, fontWeight: 600, color: '#ece5d8' },+ axis: {+ gridColor: '#3a362e',+ gridDash: [1, 3],+ domainColor: '#c9c2b4',+ tickColor: '#c9c2b4',+ labelColor: '#c9c2b4',+ titleColor: '#c9c2b4',+ },+ legend: { labelColor: '#c9c2b4', titleColor: '#c9c2b4' },+ header: { labelColor: '#c9c2b4', titleColor: '#c9c2b4' },+ text: { color: '#c9c2b4' },+ view: { stroke: '#3a362e' },+ range: {+ category: ['#7fa8ce', '#e68a66', '#e5c168', '#7cb89e', '#a98fcc', '#d98ba1', '#8fc6d4', '#c09468', '#aeb5de', '#b8c177'],+ diverging: ['#93321c', '#b04c2d', '#cb6a45', '#e19067', '#efbb9c', '#f2ede3', '#bcd0d4', '#8fb3bd', '#62909f', '#3c6c82', '#1f4a63'],+ heatmap: ['#4c1d18', '#742a22', '#9a3d2c', '#b85c3b', '#cc8250', '#daa871', '#e5c99e', '#f0e3c8', '#faf6ed'],+ ramp: ['#0c2638', '#183b52', '#28536d', '#3c6e86', '#568a9c', '#78a6b2', '#9fc2c8', '#c2d9da', '#deebea', '#f4f8f8'],+ },+ // scale for geo only+ scale: {+ continuous: { range: ['#183b52', '#c2d9da'] },+ },+ },+};++const SODAPOP_COLOR = '#f4636e';+const SODAPOP_COLOR_DARK = '#ff8a8f';++/**+ * Soda Pop — candy-bright hues at uniform lightness: watermelon, mint, lemon,+ * grape, soda blue. The sequential ramp runs cream to grape, and the heatmap is a+ * lemon-watermelon-grape sunset scale. Rounded bars, thicker lines and filled points+ * keep every mark soft and playful. Dark mode brightens each hue into neon candy.+ * Note: point config must not set a stroke here — the color encoding only overrides+ * fill on filled points, so a config-level stroke would stick on every scatter point.+ */+export const SodaPopTheme: GWGlobalConfig = {+ light: {+ background: 'transparent',+ area: { fill: SODAPOP_COLOR },+ bar: { fill: SODAPOP_COLOR, binSpacing: 5, cornerRadiusEnd: 4 },+ circle: { fill: SODAPOP_COLOR },+ line: { stroke: SODAPOP_COLOR, strokeWidth: 2.5 },+ point: { filled: true, fill: SODAPOP_COLOR, size: 45 },+ rect: { fill: SODAPOP_COLOR },+ tick: { fill: SODAPOP_COLOR },+ arc: { fill: SODAPOP_COLOR },+ boxplot: { ticks: true },+ axis: {+ gridColor: '#eef0f4',+ domainColor: '#d8dce4',+ tickColor: '#d8dce4',+ labelColor: '#5a6172',+ titleColor: '#5a6172',+ },+ legend: { labelColor: '#5a6172', titleColor: '#5a6172' },+ header: { labelColor: '#5a6172', titleColor: '#5a6172' },+ view: { stroke: '#eef0f4' },+ range: {+ category: ['#f4636e', '#35c4b5', '#ffc145', '#7b61ff', '#3d9bf5', '#71c24f', '#ff9052', '#ef6ec0', '#2c9c6e', '#8d96a8'],+ diverging: ['#b3253a', '#d24e56', '#ea7a78', '#f8a79e', '#fdd3c8', '#f3f1ee', '#c9e0fb', '#9ac4f5', '#6ba5ec', '#3d83db', '#1d5fbf'],+ heatmap: ['#fff3c9', '#ffde8a', '#ffc145', '#ff9052', '#f4636e', '#d6407e', '#a82f8b', '#712a86', '#43206b'],+ ramp: ['#f6f4ff', '#e5deff', '#cfc2ff', '#b5a3ff', '#9a82fb', '#7f63ee', '#654ad5', '#4c35b2', '#352387', '#20155c'],+ },+ // scale for geo only+ scale: {+ continuous: { range: ['#e5deff', '#4c35b2'] },+ },+ },+ dark: {+ background: 'transparent',+ area: { fill: SODAPOP_COLOR_DARK },+ bar: { fill: SODAPOP_COLOR_DARK, binSpacing: 5, cornerRadiusEnd: 4 },+ circle: { fill: SODAPOP_COLOR_DARK },+ line: { stroke: SODAPOP_COLOR_DARK, strokeWidth: 2.5 },+ point: { filled: true, fill: SODAPOP_COLOR_DARK, size: 45 },+ rect: { fill: SODAPOP_COLOR_DARK },+ tick: { fill: SODAPOP_COLOR_DARK },+ arc: { fill: SODAPOP_COLOR_DARK },+ boxplot: {+ ticks: { fill: '#b9becc' },+ rule: { color: '#b9becc' },+ },+ title: { color: '#eceef5' },+ axis: {+ gridColor: '#2b2d3a',+ domainColor: '#b9becc',+ tickColor: '#b9becc',+ labelColor: '#b9becc',+ titleColor: '#b9becc',+ },+ legend: { labelColor: '#b9becc', titleColor: '#b9becc' },+ header: { labelColor: '#b9becc', titleColor: '#b9becc' },+ text: { color: '#b9becc' },+ view: { stroke: '#2b2d3a' },+ range: {+ category: ['#ff8a8f', '#5bd9c9', '#ffd06e', '#9c88ff', '#6fb6ff', '#93d46f', '#ffab7a', '#f794d4', '#57bf92', '#a3acbe'],+ diverging: ['#b3253a', '#d24e56', '#ea7a78', '#f8a79e', '#fdd3c8', '#f3f1ee', '#c9e0fb', '#9ac4f5', '#6ba5ec', '#3d83db', '#1d5fbf'],+ heatmap: ['#43206b', '#712a86', '#a82f8b', '#d6407e', '#f4636e', '#ff9052', '#ffc145', '#ffde8a', '#fff3c9'],+ ramp: ['#20155c', '#352387', '#4c35b2', '#654ad5', '#7f63ee', '#9a82fb', '#b5a3ff', '#cfc2ff', '#e5deff', '#f6f4ff'],+ },+ // scale for geo only+ scale: {+ continuous: { range: ['#352387', '#cfc2ff'] },+ },+ },+};+export const builtInThemes: { [themeKey: string]: { light: VegaGlobalConfig; dark: VegaGlobalConfig } } = {vega: VegaTheme,g2: AntVTheme,streamlit: StreamlitTheme as unknown as GWGlobalConfig,+ danqing: DanQingTheme,+ sodapop: SodaPopTheme,};export const getPrimaryColor = (defaultColor: string) => {