Skip to content

Commit 6122f15

Browse files
authored
[Vega] fix Vega icon on dark mode (#268693)
## Summary The Vega logo doesn't shows up correctly in dark mode, this PR fixes it. Before: <img width="251" height="273" alt="Screenshot 2026-05-11 at 16 28 26" src="https://github.com/user-attachments/assets/715ffe0f-115e-4844-b736-63250d03293e" /> <img width="294" height="443" alt="Screenshot 2026-05-11 at 16 28 51" src="https://github.com/user-attachments/assets/9ed93c27-d2b2-45d3-89c5-d30a852a3b44" /> After: <img width="216" height="251" alt="Screenshot 2026-05-11 at 16 27 43" src="https://github.com/user-attachments/assets/9eabb5e5-0eb9-4f92-891a-539ea057d649" /> <img width="246" height="430" alt="Screenshot 2026-05-11 at 16 29 19" src="https://github.com/user-attachments/assets/c43762cf-91d9-40aa-8105-1e6894376802" /> fix #268694
1 parent 68f0d9f commit 6122f15

4 files changed

Lines changed: 28 additions & 19 deletions

File tree

src/platform/plugins/private/vis_types/vega/public/add_vega_panel_action.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,20 @@
99

1010
import React from 'react';
1111

12-
import { EuiIcon, type IconType } from '@elastic/eui';
12+
import type { IconType } from '@elastic/eui';
13+
import { EuiIcon } from '@elastic/eui';
1314
import { ADD_PANEL_VISUALIZATION_GROUP } from '@kbn/embeddable-plugin/public';
1415
import type { EmbeddableApiContext } from '@kbn/presentation-publishing';
1516
import { apiHasAppContext } from '@kbn/presentation-publishing';
1617

1718
import type { VegaPluginStartDependencies } from './plugin';
18-
import VegaLogoSVG from './vega_logo.svg';
1919
import { vegaVisType } from './vega_type';
20+
import { VegaIcon } from './vega_icon';
2021

2122
export function getAddVegaPanelAction(deps: VegaPluginStartDependencies) {
2223
return {
2324
id: 'addVegaPanelAction',
24-
getIconType: () => VegaIcon,
25+
getIconType: () => VegaPanelIcon,
2526
order: 0,
2627
isCompatible: async () => true,
2728
execute: async ({ embeddable }: EmbeddableApiContext) => {
@@ -45,6 +46,6 @@ export function getAddVegaPanelAction(deps: VegaPluginStartDependencies) {
4546
};
4647
}
4748

48-
export const VegaIcon: IconType = (props) => (
49-
<EuiIcon type={VegaLogoSVG} title={vegaVisType.titleInWizard} size="m" {...props} />
49+
const VegaPanelIcon: IconType = (props) => (
50+
<EuiIcon type={VegaIcon} title={vegaVisType.titleInWizard} size="m" {...props} />
5051
);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
import React from 'react';
10+
import type { IconType } from '@elastic/eui';
11+
12+
import { vegaVisType } from './vega_type';
13+
14+
export const VegaIcon: IconType = (props) => (
15+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 303 251" fill="currentColor" {...props}>
16+
<title>{vegaVisType.titleInWizard}</title>
17+
<path d="M.707.5h84l41.5 115.5-30 114.5 81.5-230h84.5l39.5 84h-58.5l19-84-88 250h-85L.707.5Z" />
18+
<path d="m262.207.5-88 250h-85L.707.5h84l41.5 115.5-30 114.5 81.5-230h84.5Zm0 0-19 84h58.5l-39.5-84Z" />
19+
</svg>
20+
);

src/platform/plugins/private/vis_types/vega/public/vega_logo.svg

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/platform/plugins/private/vis_types/vega/public/vega_type.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { getInfoMessage } from './components/vega_info_message';
2323
import { VegaVisEditorComponent } from './components/vega_vis_editor_lazy';
2424

2525
import type { VisParams } from './vega_fn';
26-
import { VegaIcon } from './add_vega_panel_action';
26+
import { VegaIcon } from './vega_icon';
2727

2828
export const vegaVisType: VisTypeDefinition<VisParams> = {
2929
name: 'vega',
@@ -33,7 +33,7 @@ export const vegaVisType: VisTypeDefinition<VisParams> = {
3333
defaultMessage: 'Use the Vega syntax to create new types of visualizations.',
3434
description: 'Vega and Vega-Lite are product names and should not be translated',
3535
}),
36-
icon: VegaIcon,
36+
icon: VegaIcon, // VegaIcon svg is wrapped into EUIIcon
3737
group: VisGroups.PROMOTED,
3838
titleInWizard: i18n.translate('visTypeVega.type.vegaTitleInWizard', {
3939
defaultMessage: 'Vega',

0 commit comments

Comments
 (0)