Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vega vis needs to have visible fonts for dark theme dashboard #73675

Merged
merged 14 commits into from
Aug 17, 2020
15 changes: 13 additions & 2 deletions src/plugins/vis_type_vega/public/data_model/vega_parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ 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';
// @ts-ignore
import { euiPaletteColorBlind } from '@elastic/eui/lib/services';
VladLasitsa marked this conversation as resolved.
Show resolved Hide resolved
import { euiThemeVars } from '@kbn/ui-shared-deps/theme';
import { i18n } from '@kbn/i18n';
// @ts-ignore
import { vega, vegaLite } from '../lib/vega';
Expand All @@ -47,7 +49,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<string, ControlsLocation> = {
left: 'row-reverse',
Expand Down Expand Up @@ -654,6 +656,15 @@ export class VegaParser {
this._setDefaultValue(defaultColor, 'config', 'trail', 'fill');
}
}

// provide right colors for light and dark themes
this._setDefaultValue(euiThemeVars.euiTextColor, 'config', 'title', 'color');
this._setDefaultValue(euiThemeVars.euiTextColor, 'config', 'style', 'guide-label', 'fill');
this._setDefaultValue(euiThemeVars.euiTextColor, 'config', 'style', 'guide-title', 'fill');
this._setDefaultValue(euiThemeVars.euiTextColor, 'config', 'axis', 'tickColor');
this._setDefaultValue(euiThemeVars.euiTextColor, 'config', 'axis', 'domainColor');
this._setDefaultValue(euiThemeVars.euiColorDarkShade, 'config', 'axis', 'gridColor');
this._setDefaultValue('transparent', 'config', 'background');
VladLasitsa marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/vis_type_vega/public/vega_view/vega_base_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ import moment from 'moment';
import dateMath from '@elastic/datemath';
import { vega, vegaLite } from '../lib/vega';
import { Utils } from '../data_model/utils';
import { VISUALIZATION_COLORS } from '@elastic/eui';
import { euiPaletteColorBlind } from '@elastic/eui/lib/services';
import { i18n } from '@kbn/i18n';
import { TooltipHandler } from './vega_tooltip';
import { esFilters } from '../../../data/public';

import { getEnableExternalUrls } from '../services';

vega.scheme('elastic', VISUALIZATION_COLORS);
vega.scheme('elastic', euiPaletteColorBlind());

// Vega's extension functions are global. When called,
// we forward execution to the instance-specific handler
Expand Down