[Charts] Fix borealis theme overrides (#209595)

## Summary

This removes an override that was applied to the charts theme prior to
updating the `Theme` in `@elastic/charts`. This is no longer needed and
is now using the wrong color.

## Release note

Fixes issue with `Amsterdam` theme where charts render with the
incorrect background color.
This commit is contained in:
Nick Partridge 2025-02-04 12:54:19 -06:00 committed by GitHub
parent bdc3470658
commit 595406176f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,8 +11,7 @@ import { useEffect, useRef, useState } from 'react';
import { Observable, BehaviorSubject } from 'rxjs';
import { CoreSetup, CoreTheme } from '@kbn/core/public';
import { DARK_THEME, LIGHT_THEME, PartialTheme, Theme } from '@elastic/charts';
import { euiThemeVars } from '@kbn/ui-theme';
import { LIGHT_THEME, PartialTheme, Theme, getChartsTheme } from '@elastic/charts';
export class ThemeService {
/** Returns default charts theme */
@ -104,20 +103,7 @@ export class ThemeService {
public init(theme: CoreSetup['theme']) {
this.theme$ = theme.theme$;
this.theme$.subscribe((newTheme) => {
this._chartsBaseTheme$.next(getChartTheme(newTheme));
this._chartsBaseTheme$.next(getChartsTheme(newTheme));
});
}
}
// TODO: define these overrides in elastic/charts when Borealis becomes default
function getChartTheme(theme: CoreTheme): Theme {
const chartTheme = theme.darkMode ? DARK_THEME : LIGHT_THEME;
if (theme.name !== 'amsterdam') {
const backgroundColor = euiThemeVars.euiColorEmptyShade;
chartTheme.background.color = backgroundColor;
chartTheme.background.fallbackColor = backgroundColor;
}
return chartTheme;
}