diff --git a/src/plugins/vis_type_vega/public/__snapshots__/vega_visualization.test.js.snap b/src/plugins/vis_type_vega/public/__snapshots__/vega_visualization.test.js.snap index 001382d946df6..639559dff3091 100644 --- a/src/plugins/vis_type_vega/public/__snapshots__/vega_visualization.test.js.snap +++ b/src/plugins/vis_type_vega/public/__snapshots__/vega_visualization.test.js.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`VegaVisualizations VegaVisualization - basics should show vega blank rectangle on top of a map (vegamap) 1`] = `"
"`; +exports[`VegaVisualizations VegaVisualization - basics should show vega blank rectangle on top of a map (vegamap) 1`] = `""`; -exports[`VegaVisualizations VegaVisualization - basics should show vega graph (may fail in dev env) 1`] = `""`; +exports[`VegaVisualizations VegaVisualization - basics should show vega graph (may fail in dev env) 1`] = `""`; -exports[`VegaVisualizations VegaVisualization - basics should show vegalite graph and update on resize (may fail in dev env) 1`] = `""`; +exports[`VegaVisualizations VegaVisualization - basics should show vegalite graph and update on resize (may fail in dev env) 1`] = `""`; -exports[`VegaVisualizations VegaVisualization - basics should show vegalite graph and update on resize (may fail in dev env) 2`] = `""`; +exports[`VegaVisualizations VegaVisualization - basics should show vegalite graph and update on resize (may fail in dev env) 2`] = `""`; diff --git a/src/plugins/vis_type_vega/public/data_model/vega_parser.test.js b/src/plugins/vis_type_vega/public/data_model/vega_parser.test.js index ac92f31b890ed..4883a8129903a 100644 --- a/src/plugins/vis_type_vega/public/data_model/vega_parser.test.js +++ b/src/plugins/vis_type_vega/public/data_model/vega_parser.test.js @@ -18,6 +18,7 @@ */ import { cloneDeep } from 'lodash'; +import { euiThemeVars } from '@kbn/ui-shared-deps/theme'; import { VegaParser } from './vega_parser'; import { bypassExternalUrlCheck } from '../vega_view/vega_base_view'; @@ -70,8 +71,31 @@ describe(`VegaParser._setDefaultColors`, () => { `vegalite`, check({}, true, { config: { + axis: { + domainColor: euiThemeVars.euiColorChartLines, + gridColor: euiThemeVars.euiColorChartLines, + tickColor: euiThemeVars.euiColorChartLines, + }, + background: 'transparent', range: { category: { scheme: 'elastic' } }, mark: { color: '#54B399' }, + style: { + 'group-title': { + fill: euiThemeVars.euiColorDarkestShade, + }, + 'guide-label': { + fill: euiThemeVars.euiColorDarkShade, + }, + 'guide-title': { + fill: euiThemeVars.euiColorDarkestShade, + }, + 'group-subtitle': { + fill: euiThemeVars.euiColorDarkestShade, + }, + }, + title: { + color: euiThemeVars.euiColorDarkestShade, + }, }, }) ); @@ -80,6 +104,12 @@ describe(`VegaParser._setDefaultColors`, () => { `vega`, check({}, false, { config: { + axis: { + domainColor: euiThemeVars.euiColorChartLines, + gridColor: euiThemeVars.euiColorChartLines, + tickColor: euiThemeVars.euiColorChartLines, + }, + background: 'transparent', range: { category: { scheme: 'elastic' } }, arc: { fill: '#54B399' }, area: { fill: '#54B399' }, @@ -90,6 +120,23 @@ describe(`VegaParser._setDefaultColors`, () => { shape: { stroke: '#54B399' }, symbol: { fill: '#54B399' }, trail: { fill: '#54B399' }, + style: { + 'group-title': { + fill: euiThemeVars.euiColorDarkestShade, + }, + 'guide-label': { + fill: euiThemeVars.euiColorDarkShade, + }, + 'guide-title': { + fill: euiThemeVars.euiColorDarkestShade, + }, + 'group-subtitle': { + fill: euiThemeVars.euiColorDarkestShade, + }, + }, + title: { + color: euiThemeVars.euiColorDarkestShade, + }, }, }) ); diff --git a/src/plugins/vis_type_vega/public/data_model/vega_parser.ts b/src/plugins/vis_type_vega/public/data_model/vega_parser.ts index aceeefd953655..da5c76fa6beab 100644 --- a/src/plugins/vis_type_vega/public/data_model/vega_parser.ts +++ b/src/plugins/vis_type_vega/public/data_model/vega_parser.ts @@ -21,7 +21,8 @@ import _ from 'lodash'; import schemaParser from 'vega-schema-url-parser'; import versionCompare from 'compare-versions'; import hjson from 'hjson'; -import { VISUALIZATION_COLORS } from '@elastic/eui'; +import { euiPaletteColorBlind } from '@elastic/eui'; +import { euiThemeVars } from '@kbn/ui-shared-deps/theme'; import { i18n } from '@kbn/i18n'; // @ts-ignore import { vega, vegaLite } from '../lib/vega'; @@ -47,7 +48,7 @@ import { } from './types'; // Set default single color to match other Kibana visualizations -const defaultColor: string = VISUALIZATION_COLORS[0]; +const defaultColor: string = euiPaletteColorBlind()[0]; const locToDirMap: Record