From b929822d72359a5a94993877e86792e86fc97051 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 21 Apr 2021 15:34:08 +0200 Subject: [PATCH] Theme: Renames theme.palette to theme.colors (#33214) * Theme: Rename theme.palette to theme.colors * renaming files --- ...tePalette.test.ts => createColors.test.ts} | 6 +- .../{createPalette.ts => createColors.ts} | 98 +++++++++---------- .../src/themes/createComponents.ts | 32 +++--- .../grafana-data/src/themes/createShadows.ts | 6 +- .../src/themes/createTheme.test.ts | 10 +- .../grafana-data/src/themes/createTheme.ts | 20 ++-- .../src/themes/createTypography.ts | 4 +- .../grafana-data/src/themes/createV1Theme.ts | 52 +++++----- packages/grafana-data/src/themes/index.ts | 4 +- .../src/themes/{colors.ts => palette.ts} | 11 +-- packages/grafana-data/src/themes/types.ts | 6 +- .../grafana-ui/.storybook/storybookTheme.ts | 24 ++--- .../grafana-ui/src/components/Alert/Alert.tsx | 10 +- .../components/AlphaNotice/AlphaNotice.tsx | 4 +- .../src/components/Button/Button.tsx | 22 ++--- .../src/components/Button/ToolbarButton.tsx | 22 ++--- .../grafana-ui/src/components/Card/Card.tsx | 12 +-- .../components/ConfirmModal/ConfirmModal.tsx | 2 +- .../CustomScrollbar/CustomScrollbar.tsx | 4 +- .../components/DataLinks/DataLinkInput.tsx | 4 +- .../Forms/RadioButtonGroup/RadioButton.tsx | 10 +- .../src/components/Forms/commonStyles.ts | 14 +-- .../IconButton/IconButton.story.tsx | 2 +- .../src/components/IconButton/IconButton.tsx | 4 +- .../src/components/InfoBox/InfoBox.tsx | 2 +- .../grafana-ui/src/components/Input/Input.tsx | 8 +- .../grafana-ui/src/components/Menu/Menu.tsx | 4 +- .../src/components/Menu/MenuGroup.tsx | 2 +- .../src/components/Menu/MenuItem.tsx | 10 +- .../src/components/Modal/getModalStyles.ts | 6 +- .../src/components/PageLayout/PageToolbar.tsx | 2 +- .../src/components/Select/SelectBase.tsx | 2 +- .../src/components/Select/getSelectStyles.ts | 14 +-- .../src/components/Slider/styles.ts | 10 +- .../src/components/Switch/Switch.tsx | 12 +-- .../src/components/Table/FilterList.tsx | 2 +- .../src/components/Tabs/Counter.tsx | 4 +- .../grafana-ui/src/components/Tabs/Tab.tsx | 14 +-- .../src/components/Tabs/TabContent.tsx | 2 +- .../src/components/Tabs/TabsBar.tsx | 2 +- .../src/components/TextArea/TextArea.tsx | 2 +- .../components/ThemeDemos/EmotionPerfTest.tsx | 2 +- .../src/components/ThemeDemos/ThemeDemo.tsx | 64 ++++++------ .../TimeRangePicker/TimePickerContent.tsx | 14 +-- .../TimeRangePicker/TimePickerFooter.tsx | 2 +- .../TimeRangePicker/TimeRangeOption.tsx | 4 +- .../src/themes/GlobalStyles/elements.ts | 22 ++--- .../src/themes/_variables.dark.scss.tmpl.ts | 72 +++++++------- .../src/themes/_variables.light.scss.tmpl.ts | 68 ++++++------- packages/grafana-ui/src/themes/getTheme.ts | 2 +- packages/grafana-ui/src/themes/mixins.ts | 2 +- .../src/utils/storybook/withPaddedStory.tsx | 2 +- .../src/utils/storybook/withTheme.tsx | 4 +- .../core/components/PageHeader/PageHeader.tsx | 4 +- public/app/core/services/toggleTheme.ts | 6 +- public/app/core/utils/ConfigProvider.tsx | 2 +- .../PanelEditor/OptionsPaneCategory.tsx | 12 +-- .../PanelEditor/OptionsPaneOptions.tsx | 6 +- .../PanelEditor/PanelEditorTabs.tsx | 2 +- .../TransformationsEditor.tsx | 4 +- .../components/VersionHistory/DiffValues.tsx | 4 +- .../VizTypePicker/PanelTypeCard.tsx | 8 +- .../app/features/users/TokenRevokedModal.tsx | 2 +- scripts/cli/generateSassVariableFiles.ts | 2 +- 64 files changed, 391 insertions(+), 400 deletions(-) rename packages/grafana-data/src/themes/{createPalette.test.ts => createColors.test.ts} (69%) rename packages/grafana-data/src/themes/{createPalette.ts => createColors.ts} (76%) rename packages/grafana-data/src/themes/{colors.ts => palette.ts} (84%) diff --git a/packages/grafana-data/src/themes/createPalette.test.ts b/packages/grafana-data/src/themes/createColors.test.ts similarity index 69% rename from packages/grafana-data/src/themes/createPalette.test.ts rename to packages/grafana-data/src/themes/createColors.test.ts index 59f729e9a74..a5a6de291bf 100644 --- a/packages/grafana-data/src/themes/createPalette.test.ts +++ b/packages/grafana-data/src/themes/createColors.test.ts @@ -1,13 +1,13 @@ -import { createPalette } from './createPalette'; +import { createColors } from './createColors'; describe('createColors', () => { it('Should enrich colors', () => { - const palette = createPalette({}); + const palette = createColors({}); expect(palette.primary.name).toBe('primary'); }); it('Should allow overrides', () => { - const palette = createPalette({ + const palette = createColors({ primary: { main: '#FF0000', }, diff --git a/packages/grafana-data/src/themes/createPalette.ts b/packages/grafana-data/src/themes/createColors.ts similarity index 76% rename from packages/grafana-data/src/themes/createPalette.ts rename to packages/grafana-data/src/themes/createColors.ts index d237f2ac704..348019f4581 100644 --- a/packages/grafana-data/src/themes/createPalette.ts +++ b/packages/grafana-data/src/themes/createColors.ts @@ -1,14 +1,14 @@ import { merge } from 'lodash'; import { alpha, darken, emphasize, getContrastRatio, lighten } from './colorManipulator'; -import { colors } from './colors'; -import { DeepPartial, ThemePaletteColor } from './types'; +import { palette } from './palette'; +import { DeepPartial, ThemeRichColor } from './types'; /** @internal */ -export type ThemePaletteMode = 'light' | 'dark'; +export type ThemeColorsMode = 'light' | 'dark'; /** @internal */ -export interface ThemePaletteBase { - mode: ThemePaletteMode; +export interface ThemeColorsBase { + mode: ThemeColorsMode; primary: TColor; secondary: TColor; @@ -71,7 +71,7 @@ export interface ThemePaletteBase { export interface ThemeHoverStrengh {} /** @beta */ -export interface ThemePalette extends ThemePaletteBase { +export interface ThemeColors extends ThemeColorsBase { /** Returns a text color for the background */ getContrastText(background: string): string; /* Brighten or darken a color by specified factor (0-1) */ @@ -79,10 +79,10 @@ export interface ThemePalette extends ThemePaletteBase { } /** @internal */ -export type ThemePaletteInput = DeepPartial>; +export type ThemeColorsInput = DeepPartial>; -class DarkPalette implements ThemePaletteBase> { - mode: ThemePaletteMode = 'dark'; +class DarkColors implements ThemeColorsBase> { + mode: ThemeColorsMode = 'dark'; whiteBase = '201, 209, 217'; @@ -90,14 +90,14 @@ class DarkPalette implements ThemePaletteBase> { primary: `rgb(${this.whiteBase})`, secondary: `rgba(${this.whiteBase}, 0.65)`, disabled: `rgba(${this.whiteBase}, 0.40)`, - link: colors.blueDarkText, - maxContrast: colors.white, + link: palette.blueDarkText, + maxContrast: palette.white, }; primary = { - main: colors.blueDarkMain, - text: colors.blueDarkText, - border: colors.blueDarkText, + main: palette.blueDarkMain, + text: palette.blueDarkText, + border: palette.blueDarkText, }; secondary = { @@ -110,24 +110,24 @@ class DarkPalette implements ThemePaletteBase> { info = this.primary; error = { - main: colors.redDarkMain, - text: colors.redDarkText, + main: palette.redDarkMain, + text: palette.redDarkText, }; success = { - main: colors.greenDarkMain, - text: colors.greenDarkText, + main: palette.greenDarkMain, + text: palette.greenDarkText, }; warning = { - main: colors.orangeDarkMain, - text: colors.orangeDarkText, + main: palette.orangeDarkMain, + text: palette.orangeDarkText, }; background = { - canvas: colors.gray05, - primary: colors.gray10, - secondary: colors.gray15, + canvas: palette.gray05, + primary: palette.gray10, + secondary: palette.gray15, }; border = { @@ -156,15 +156,15 @@ class DarkPalette implements ThemePaletteBase> { tonalOffset = 0.15; } -class LightPalette implements ThemePaletteBase> { - mode: ThemePaletteMode = 'light'; +class LightColors implements ThemeColorsBase> { + mode: ThemeColorsMode = 'light'; blackBase = '36, 41, 46'; primary = { - main: colors.blueLightMain, - border: colors.blueLightText, - text: colors.blueLightText, + main: palette.blueLightMain, + border: palette.blueLightText, + text: palette.blueLightText, }; secondary = { @@ -174,24 +174,24 @@ class LightPalette implements ThemePaletteBase> { }; info = { - main: colors.blueLightMain, - text: colors.blueLightText, + main: palette.blueLightMain, + text: palette.blueLightText, }; error = { - main: colors.redLightMain, - text: colors.redLightText, - border: colors.redLightText, + main: palette.redLightMain, + text: palette.redLightText, + border: palette.redLightText, }; success = { - main: colors.greenLightMain, - text: colors.greenLightText, + main: palette.greenLightMain, + text: palette.greenLightText, }; warning = { - main: colors.orangeLightMain, - text: colors.orangeLightText, + main: palette.orangeLightMain, + text: palette.orangeLightText, }; text = { @@ -199,13 +199,13 @@ class LightPalette implements ThemePaletteBase> { secondary: `rgba(${this.blackBase}, 0.75)`, disabled: `rgba(${this.blackBase}, 0.50)`, link: this.primary.text, - maxContrast: colors.black, + maxContrast: palette.black, }; background = { - canvas: colors.gray90, - primary: colors.white, - secondary: colors.gray100, + canvas: palette.gray90, + primary: palette.white, + secondary: palette.gray100, }; border = { @@ -236,10 +236,10 @@ class LightPalette implements ThemePaletteBase> { tonalOffset = 0.2; } -export function createPalette(palette: ThemePaletteInput): ThemePalette { - const dark = new DarkPalette(); - const light = new LightPalette(); - const base = (palette.mode ?? 'dark') === 'dark' ? dark : light; +export function createColors(colors: ThemeColorsInput): ThemeColors { + const dark = new DarkColors(); + const light = new LightColors(); + const base = (colors.mode ?? 'dark') === 'dark' ? dark : light; const { primary = base.primary, secondary = base.secondary, @@ -251,7 +251,7 @@ export function createPalette(palette: ThemePaletteInput): ThemePalette { hoverFactor = base.hoverFactor, contrastThreshold = base.contrastThreshold, ...other - } = palette; + } = colors; function getContrastText(background: string) { const contrastText = @@ -262,7 +262,7 @@ export function createPalette(palette: ThemePaletteInput): ThemePalette { return contrastText; } - const getRichColor = ({ color, name }: GetRichColorProps): ThemePaletteColor => { + const getRichColor = ({ color, name }: GetRichColorProps): ThemeRichColor => { color = { ...color, name }; if (!color.main) { throw new Error(`Missing main color for ${name}`); @@ -282,7 +282,7 @@ export function createPalette(palette: ThemePaletteInput): ThemePalette { if (!color.contrastText) { color.contrastText = getContrastText(color.main); } - return color as ThemePaletteColor; + return color as ThemeRichColor; }; return merge( @@ -304,6 +304,6 @@ export function createPalette(palette: ThemePaletteInput): ThemePalette { } interface GetRichColorProps { - color: Partial; + color: Partial; name: string; } diff --git a/packages/grafana-data/src/themes/createComponents.ts b/packages/grafana-data/src/themes/createComponents.ts index b44edd5448d..6024258bf33 100644 --- a/packages/grafana-data/src/themes/createComponents.ts +++ b/packages/grafana-data/src/themes/createComponents.ts @@ -1,4 +1,4 @@ -import { ThemePalette } from './createPalette'; +import { ThemeColors } from './createColors'; import { ThemeShadows } from './createShadows'; /** @beta */ @@ -32,12 +32,12 @@ export interface ThemeComponents { }; } -export function createComponents(palette: ThemePalette, shadows: ThemeShadows): ThemeComponents { +export function createComponents(colors: ThemeColors, shadows: ThemeShadows): ThemeComponents { const panel = { padding: 1, headerHeight: 4, - background: palette.background.primary, - border: palette.background.primary, + background: colors.background.primary, + border: colors.background.primary, boxShadow: shadows.z0, }; @@ -48,26 +48,26 @@ export function createComponents(palette: ThemePalette, shadows: ThemeShadows): lg: 6, }, input: - palette.mode === 'dark' + colors.mode === 'dark' ? { - background: palette.background.canvas, - border: palette.border.medium, - borderHover: palette.border.strong, - text: palette.text.primary, + background: colors.background.canvas, + border: colors.border.medium, + borderHover: colors.border.strong, + text: colors.text.primary, } : { - background: palette.background.primary, - border: palette.border.medium, - borderHover: palette.border.strong, - text: palette.text.primary, + background: colors.background.primary, + border: colors.border.medium, + borderHover: colors.border.strong, + text: colors.text.primary, }, panel, tooltip: { - background: palette.background.secondary, - text: palette.text.primary, + background: colors.background.secondary, + text: colors.text.primary, }, dashboard: { - background: palette.background.canvas, + background: colors.background.canvas, padding: 1, }, }; diff --git a/packages/grafana-data/src/themes/createShadows.ts b/packages/grafana-data/src/themes/createShadows.ts index 6a8646b45d5..33379a5238b 100644 --- a/packages/grafana-data/src/themes/createShadows.ts +++ b/packages/grafana-data/src/themes/createShadows.ts @@ -1,4 +1,4 @@ -import { ThemePalette } from './createPalette'; +import { ThemeColors } from './createColors'; /** @beta */ export interface ThemeShadows { @@ -34,8 +34,8 @@ function createLightShadow(...px: number[]) { } /** @alpha */ -export function createShadows(palette: ThemePalette): ThemeShadows { - if (palette.mode === 'dark') { +export function createShadows(colors: ThemeColors): ThemeShadows { + if (colors.mode === 'dark') { return { z0: createDarkShadow(0, 1, 1, -1, 0, 1, 1, 0, 0, 1, 3, 0), z1: createDarkShadow(0, 1, 1, -1, 0, 1, 2, 0, 0, 1, 3, 0), diff --git a/packages/grafana-data/src/themes/createTheme.test.ts b/packages/grafana-data/src/themes/createTheme.test.ts index 8ae76b15dbe..a27fc6286b0 100644 --- a/packages/grafana-data/src/themes/createTheme.test.ts +++ b/packages/grafana-data/src/themes/createTheme.test.ts @@ -3,7 +3,7 @@ import { createTheme } from './createTheme'; describe('createTheme', () => { it('create custom theme', () => { const custom = createTheme({ - palette: { + colors: { mode: 'dark', primary: { main: 'rgb(240,0,0)', @@ -14,13 +14,13 @@ describe('createTheme', () => { }, }); - expect(custom.palette.primary.main).toBe('rgb(240,0,0)'); - expect(custom.palette.primary.shade).toBe('rgb(242, 38, 38)'); - expect(custom.palette.background.canvas).toBe('#123'); + expect(custom.colors.primary.main).toBe('rgb(240,0,0)'); + expect(custom.colors.primary.shade).toBe('rgb(242, 38, 38)'); + expect(custom.colors.background.canvas).toBe('#123'); }); it('create default theme', () => { const theme = createTheme(); - expect(theme.palette.mode).toBe('dark'); + expect(theme.colors.mode).toBe('dark'); }); }); diff --git a/packages/grafana-data/src/themes/createTheme.ts b/packages/grafana-data/src/themes/createTheme.ts index 1602d8d9c0c..352c39e8332 100644 --- a/packages/grafana-data/src/themes/createTheme.ts +++ b/packages/grafana-data/src/themes/createTheme.ts @@ -1,6 +1,6 @@ import { createBreakpoints } from './breakpoints'; import { createComponents } from './createComponents'; -import { createPalette, ThemePaletteInput } from './createPalette'; +import { createColors, ThemeColorsInput } from './createColors'; import { createShadows } from './createShadows'; import { createShape, ThemeShapeInput } from './createShape'; import { createSpacing, ThemeSpacingOptions } from './createSpacing'; @@ -13,7 +13,7 @@ import { zIndex } from './zIndex'; /** @internal */ export interface NewThemeOptions { name?: string; - palette?: ThemePaletteInput; + colors?: ThemeColorsInput; spacing?: ThemeSpacingOptions; shape?: ThemeShapeInput; typography?: ThemeTypographyInput; @@ -23,26 +23,26 @@ export interface NewThemeOptions { export function createTheme(options: NewThemeOptions = {}): GrafanaThemeV2 { const { name = 'Dark', - palette: paletteInput = {}, + colors: colorsInput = {}, spacing: spacingInput = {}, shape: shapeInput = {}, typography: typographyInput = {}, } = options; - const palette = createPalette(paletteInput); + const colors = createColors(colorsInput); const breakpoints = createBreakpoints(); const spacing = createSpacing(spacingInput); const shape = createShape(shapeInput); - const typography = createTypography(palette, typographyInput); - const shadows = createShadows(palette); + const typography = createTypography(colors, typographyInput); + const shadows = createShadows(colors); const transitions = createTransitions(); - const components = createComponents(palette, shadows); + const components = createComponents(colors, shadows); const theme = { name, - isDark: palette.mode === 'dark', - isLight: palette.mode === 'light', - palette, + isDark: colors.mode === 'dark', + isLight: colors.mode === 'light', + colors, breakpoints, spacing, shape, diff --git a/packages/grafana-data/src/themes/createTypography.ts b/packages/grafana-data/src/themes/createTypography.ts index 3aa7b721fac..9d9776a456f 100644 --- a/packages/grafana-data/src/themes/createTypography.ts +++ b/packages/grafana-data/src/themes/createTypography.ts @@ -2,7 +2,7 @@ // The MIT License (MIT) // Copyright (c) 2014 Call-Em-All -import { ThemePalette } from './createPalette'; +import { ThemeColors } from './createColors'; /** @beta */ export interface ThemeTypography { @@ -66,7 +66,7 @@ export interface ThemeTypographyInput { const defaultFontFamily = '"Roboto", "Helvetica", "Arial", sans-serif'; const defaultFontFamilyMonospace = "'Roboto Mono', monospace"; -export function createTypography(palette: ThemePalette, typographyInput: ThemeTypographyInput = {}): ThemeTypography { +export function createTypography(colors: ThemeColors, typographyInput: ThemeTypographyInput = {}): ThemeTypography { const { fontFamily = defaultFontFamily, fontFamilyMonospace = defaultFontFamilyMonospace, diff --git a/packages/grafana-data/src/themes/createV1Theme.ts b/packages/grafana-data/src/themes/createV1Theme.ts index 1ca27cc1bcd..77389d2fdfc 100644 --- a/packages/grafana-data/src/themes/createV1Theme.ts +++ b/packages/grafana-data/src/themes/createV1Theme.ts @@ -143,34 +143,34 @@ export function createV1Theme(theme: Omit): GrafanaTheme { }; const backgrounds = { - bg1: theme.palette.background.primary, - bg2: theme.palette.background.secondary, - bg3: theme.palette.action.hover, - dashboardBg: theme.palette.background.canvas, - bgBlue1: theme.palette.primary.main, - bgBlue2: theme.palette.primary.shade, + bg1: theme.colors.background.primary, + bg2: theme.colors.background.secondary, + bg3: theme.colors.action.hover, + dashboardBg: theme.colors.background.canvas, + bgBlue1: theme.colors.primary.main, + bgBlue2: theme.colors.primary.shade, }; const borders = { - border1: theme.palette.border.weak, - border2: theme.palette.border.medium, - border3: theme.palette.border.strong, + border1: theme.colors.border.weak, + border2: theme.colors.border.medium, + border3: theme.colors.border.strong, }; const textColors = { - textStrong: theme.palette.text.maxContrast, - textHeading: theme.palette.text.primary, - text: theme.palette.text.primary, - textSemiWeak: theme.palette.text.secondary, - textWeak: theme.palette.text.secondary, - textFaint: theme.palette.text.disabled, - textBlue: theme.palette.primary.text, + textStrong: theme.colors.text.maxContrast, + textHeading: theme.colors.text.primary, + text: theme.colors.text.primary, + textSemiWeak: theme.colors.text.secondary, + textWeak: theme.colors.text.secondary, + textFaint: theme.colors.text.disabled, + textBlue: theme.colors.primary.text, }; const form = { // Next-gen forms functional colors - formLabel: theme.palette.text.primary, - formDescription: theme.palette.text.secondary, + formLabel: theme.colors.text.primary, + formDescription: theme.colors.text.secondary, formInputBg: basicColors.gray05, formInputBgDisabled: basicColors.gray10, formInputBorder: borders.border2, @@ -196,7 +196,7 @@ export function createV1Theme(theme: Omit): GrafanaTheme { return { ...oldCommon, - type: theme.palette.mode === 'dark' ? GrafanaThemeType.Dark : GrafanaThemeType.Light, + type: theme.colors.mode === 'dark' ? GrafanaThemeType.Dark : GrafanaThemeType.Light, isDark: theme.isDark, isLight: theme.isLight, name: theme.name, @@ -220,20 +220,20 @@ export function createV1Theme(theme: Omit): GrafanaTheme { ...form, ...textColors, - bodyBg: theme.palette.background.canvas, + bodyBg: theme.colors.background.canvas, panelBg: theme.components.panel.background, panelBorder: theme.components.panel.border, - pageHeaderBg: theme.palette.background.canvas, - pageHeaderBorder: theme.palette.background.canvas, + pageHeaderBg: theme.colors.background.canvas, + pageHeaderBorder: theme.colors.background.canvas, dropdownBg: form.formInputBg, dropdownShadow: basicColors.black, dropdownOptionHoverBg: backgrounds.bg2, - link: theme.palette.text.primary, - linkDisabled: theme.palette.text.disabled, - linkHover: theme.palette.text.maxContrast, - linkExternal: theme.palette.text.link, + link: theme.colors.text.primary, + linkDisabled: theme.colors.text.disabled, + linkHover: theme.colors.text.maxContrast, + linkExternal: theme.colors.text.link, }, shadows: { listItem: 'none', diff --git a/packages/grafana-data/src/themes/index.ts b/packages/grafana-data/src/themes/index.ts index 299787515b1..7fe1114eedd 100644 --- a/packages/grafana-data/src/themes/index.ts +++ b/packages/grafana-data/src/themes/index.ts @@ -1,6 +1,6 @@ export { createTheme } from './createTheme'; -export { ThemePaletteColor, GrafanaThemeV2 } from './types'; -export { ThemePalette } from './createPalette'; +export { ThemeRichColor, GrafanaThemeV2 } from './types'; +export { ThemeColors } from './createColors'; export { ThemeBreakpoints } from './breakpoints'; export { ThemeShadows } from './createShadows'; export { ThemeShape } from './createShape'; diff --git a/packages/grafana-data/src/themes/colors.ts b/packages/grafana-data/src/themes/palette.ts similarity index 84% rename from packages/grafana-data/src/themes/colors.ts rename to packages/grafana-data/src/themes/palette.ts index 8bc63b09dc1..6b760f03a91 100644 --- a/packages/grafana-data/src/themes/colors.ts +++ b/packages/grafana-data/src/themes/palette.ts @@ -1,16 +1,7 @@ -export const colors = { +export const palette = { white: '#fff', black: '#000', - // old - gray98: '#f7f8fa', - gray97: '#f1f5f9', - gray95: '#e9edf2', - //gray90: '#dce1e6', - gray85: '#c7d0d9', - gray70: '#9fa7b3', - gray60: '#7b8087', - gray33: '#464c54', gray25: '#2c3235', gray15: '#22252b', //'#202226', gray10: '#181b1f', // old '#141619', diff --git a/packages/grafana-data/src/themes/types.ts b/packages/grafana-data/src/themes/types.ts index 90a43d173cc..c53cb74fb00 100644 --- a/packages/grafana-data/src/themes/types.ts +++ b/packages/grafana-data/src/themes/types.ts @@ -1,7 +1,7 @@ import { GrafanaTheme } from '../types/theme'; import { ThemeBreakpoints } from './breakpoints'; import { ThemeComponents } from './createComponents'; -import { ThemePalette } from './createPalette'; +import { ThemeColors } from './createColors'; import { ThemeShadows } from './createShadows'; import { ThemeShape } from './createShape'; import { ThemeSpacing } from './createSpacing'; @@ -14,7 +14,7 @@ export interface GrafanaThemeV2 { name: string; isDark: boolean; isLight: boolean; - palette: ThemePalette; + colors: ThemeColors; breakpoints: ThemeBreakpoints; spacing: ThemeSpacing; shape: ThemeShape; @@ -27,7 +27,7 @@ export interface GrafanaThemeV2 { } /** @alpha */ -export interface ThemePaletteColor { +export interface ThemeRichColor { /** color intent (primary, secondary, info, error, etc) */ name: string; /** Main color */ diff --git a/packages/grafana-ui/.storybook/storybookTheme.ts b/packages/grafana-ui/.storybook/storybookTheme.ts index 457c90d79bd..3a95fb5df06 100644 --- a/packages/grafana-ui/.storybook/storybookTheme.ts +++ b/packages/grafana-ui/.storybook/storybookTheme.ts @@ -7,13 +7,13 @@ const createStorybookTheme = (theme: GrafanaThemeV2) => { return create({ base: theme.name.includes('Light') ? 'light' : 'dark', - colorPrimary: theme.palette.primary.main, - colorSecondary: theme.palette.error.main, + colorPrimary: theme.colors.primary.main, + colorSecondary: theme.colors.error.main, // UI - appBg: theme.palette.background.canvas, - appContentBg: theme.palette.background.primary, - appBorderColor: theme.palette.border.medium, + appBg: theme.colors.background.canvas, + appContentBg: theme.colors.background.primary, + appBorderColor: theme.colors.border.medium, appBorderRadius: theme.shape.borderRadius(1), // Typography @@ -21,13 +21,13 @@ const createStorybookTheme = (theme: GrafanaThemeV2) => { fontCode: theme.typography.fontFamilyMonospace, // Text colors - textColor: theme.palette.primary.text, - textInverseColor: theme.palette.primary.contrastText, + textColor: theme.colors.primary.text, + textInverseColor: theme.colors.primary.contrastText, // Toolbar default and active colors - barTextColor: theme.palette.text.primary, - barSelectedColor: theme.palette.emphasize(theme.palette.primary.text), - barBg: theme.palette.background.primary, + barTextColor: theme.colors.text.primary, + barSelectedColor: theme.colors.emphasize(theme.colors.primary.text), + barBg: theme.colors.background.primary, // Form colors inputBg: theme.components.input.background, @@ -41,7 +41,7 @@ const createStorybookTheme = (theme: GrafanaThemeV2) => { }); }; -const GrafanaLight = createStorybookTheme(createTheme({ palette: { mode: 'light' } })); -const GrafanaDark = createStorybookTheme(createTheme({ palette: { mode: 'dark' } })); +const GrafanaLight = createStorybookTheme(createTheme({ colors: { mode: 'light' } })); +const GrafanaDark = createStorybookTheme(createTheme({ colors: { mode: 'dark' } })); export { GrafanaLight, GrafanaDark }; diff --git a/packages/grafana-ui/src/components/Alert/Alert.tsx b/packages/grafana-ui/src/components/Alert/Alert.tsx index 71e146f4271..3b0e41b9722 100644 --- a/packages/grafana-ui/src/components/Alert/Alert.tsx +++ b/packages/grafana-ui/src/components/Alert/Alert.tsx @@ -69,7 +69,7 @@ export const Alert: FC = React.forwardRef( Alert.displayName = 'Alert'; const getStyles = (theme: GrafanaThemeV2, severity: AlertVariant, elevated?: boolean) => { - const color = theme.palette[severity]; + const color = theme.colors[severity]; return { alert: css` @@ -79,7 +79,7 @@ const getStyles = (theme: GrafanaThemeV2, severity: AlertVariant, elevated?: boo display: flex; flex-direction: row; align-items: stretch; - background: ${theme.palette.background.secondary}; + background: ${theme.colors.background.secondary}; box-shadow: ${elevated ? theme.shadows.z4 : theme.shadows.z1}; &:before { @@ -89,7 +89,7 @@ const getStyles = (theme: GrafanaThemeV2, severity: AlertVariant, elevated?: boo left: 0; bottom: 0; right: 0; - background: ${theme.palette.background.primary}; + background: ${theme.colors.background.primary}; z-index: -1; } `, @@ -103,10 +103,10 @@ const getStyles = (theme: GrafanaThemeV2, severity: AlertVariant, elevated?: boo `, title: css` font-weight: ${theme.typography.fontWeightMedium}; - color: ${theme.palette.text.primary}; + color: ${theme.colors.text.primary}; `, body: css` - color: ${theme.palette.text.secondary}; + color: ${theme.colors.text.secondary}; padding: ${theme.spacing(2)}; flex-grow: 1; display: flex; diff --git a/packages/grafana-ui/src/components/AlphaNotice/AlphaNotice.tsx b/packages/grafana-ui/src/components/AlphaNotice/AlphaNotice.tsx index 3fa72f93b2e..26379a94135 100644 --- a/packages/grafana-ui/src/components/AlphaNotice/AlphaNotice.tsx +++ b/packages/grafana-ui/src/components/AlphaNotice/AlphaNotice.tsx @@ -17,8 +17,8 @@ export const AlphaNotice: FC = ({ state, text, className }) => { const styles = cx( className, css` - background: ${theme.palette.primary.transparent}; - color: ${theme.palette.text.secondary}; + background: ${theme.colors.primary.transparent}; + color: ${theme.colors.text.secondary}; white-space: nowrap; border-radius: 3px; text-shadow: none; diff --git a/packages/grafana-ui/src/components/Button/Button.tsx b/packages/grafana-ui/src/components/Button/Button.tsx index 60910d39368..bb23d2cbe63 100644 --- a/packages/grafana-ui/src/components/Button/Button.tsx +++ b/packages/grafana-ui/src/components/Button/Button.tsx @@ -3,7 +3,7 @@ import { css, CSSObject, cx } from '@emotion/css'; import { useTheme2 } from '../../themes'; import { IconName } from '../../types/icon'; import { getPropertiesForButtonSize } from '../Forms/commonStyles'; -import { colorManipulator, GrafanaThemeV2, ThemePaletteColor } from '@grafana/data'; +import { colorManipulator, GrafanaThemeV2, ThemeRichColor } from '@grafana/data'; import { ComponentSize } from '../../types/size'; import { getFocusStyles, getMouseFocusStyles } from '../../themes/mixins'; import { Icon } from '../Icon/Icon'; @@ -101,14 +101,14 @@ export const getButtonStyles = (props: StyleProps) => { const disabledStyles: CSSObject = { cursor: 'not-allowed', boxShadow: 'none', - background: theme.palette.action.disabledBackground, + background: theme.colors.action.disabledBackground, border: `1px solid transparent`, - color: theme.palette.text.disabled, + color: theme.colors.text.disabled, pointerEvents: 'none', '&:hover': { - background: theme.palette.action.disabledBackground, - color: theme.palette.text.disabled, + background: theme.colors.action.disabledBackground, + color: theme.colors.text.disabled, boxShadow: 'none', }, }; @@ -160,7 +160,7 @@ export const getButtonStyles = (props: StyleProps) => { }; }; -function getButtonVariantStyles(theme: GrafanaThemeV2, color: ThemePaletteColor): CSSObject { +function getButtonVariantStyles(theme: GrafanaThemeV2, color: ThemeRichColor): CSSObject { return { background: color.main, color: color.contrastText, @@ -180,15 +180,15 @@ function getButtonVariantStyles(theme: GrafanaThemeV2, color: ThemePaletteColor) export function getPropertiesForVariant(theme: GrafanaThemeV2, variant: ButtonVariant) { switch (variant) { case 'secondary': - return getButtonVariantStyles(theme, theme.palette.secondary); + return getButtonVariantStyles(theme, theme.colors.secondary); case 'destructive': - return getButtonVariantStyles(theme, theme.palette.error); + return getButtonVariantStyles(theme, theme.colors.error); case 'link': return { background: 'transparent', - color: theme.palette.text.link, + color: theme.colors.text.link, border: '1px solid transparent', '&:focus': { outline: 'none', @@ -196,13 +196,13 @@ export function getPropertiesForVariant(theme: GrafanaThemeV2, variant: ButtonVa }, '&:hover': { - background: colorManipulator.alpha(theme.palette.text.link, theme.palette.action.hoverOpacity), + background: colorManipulator.alpha(theme.colors.text.link, theme.colors.action.hoverOpacity), textDecoration: 'underline', }, }; case 'primary': default: - return getButtonVariantStyles(theme, theme.palette.primary); + return getButtonVariantStyles(theme, theme.colors.primary); } } diff --git a/packages/grafana-ui/src/components/Button/ToolbarButton.tsx b/packages/grafana-ui/src/components/Button/ToolbarButton.tsx index fdc41d35751..b5a4790f606 100644 --- a/packages/grafana-ui/src/components/Button/ToolbarButton.tsx +++ b/packages/grafana-ui/src/components/Button/ToolbarButton.tsx @@ -118,7 +118,7 @@ const getStyles = (theme: GrafanaThemeV2) => { border-radius: ${theme.shape.borderRadius()}; line-height: ${theme.components.height.md * theme.spacing.gridSize - 2}px; font-weight: ${theme.typography.fontWeightMedium}; - border: 1px solid ${theme.palette.border.medium}; + border: 1px solid ${theme.colors.border.medium}; white-space: nowrap; transition: ${theme.transitions.create(['background', 'box-shadow', 'border-color', 'color'], { duration: theme.transitions.duration.short, @@ -141,24 +141,24 @@ const getStyles = (theme: GrafanaThemeV2) => { &[disabled], &:disabled { cursor: not-allowed; - opacity: ${theme.palette.action.disabledOpacity}; - background: ${theme.palette.action.disabledBackground}; + opacity: ${theme.colors.action.disabledOpacity}; + background: ${theme.colors.action.disabledBackground}; box-shadow: none; &:hover { - color: ${theme.palette.text.disabled}; - background: ${theme.palette.action.disabledBackground}; + color: ${theme.colors.text.disabled}; + background: ${theme.colors.action.disabledBackground}; box-shadow: none; } } `, default: css` - color: ${theme.palette.text.secondary}; - background-color: ${theme.palette.background.primary}; + color: ${theme.colors.text.secondary}; + background-color: ${theme.colors.background.primary}; &:hover { - color: ${theme.palette.text.primary}; - background: ${theme.palette.background.secondary}; + color: ${theme.colors.text.primary}; + background: ${theme.colors.background.secondary}; } `, active: css` @@ -167,8 +167,8 @@ const getStyles = (theme: GrafanaThemeV2) => { background-color: transparent; &:hover { - color: ${theme.palette.text.primary}; - background: ${theme.palette.emphasize(theme.palette.background.canvas, 0.03)}; + color: ${theme.colors.text.primary}; + background: ${theme.colors.emphasize(theme.colors.background.canvas, 0.03)}; } `, primary: css(primaryVariant), diff --git a/packages/grafana-ui/src/components/Card/Card.tsx b/packages/grafana-ui/src/components/Card/Card.tsx index 0448441dc90..e98ad113b3d 100644 --- a/packages/grafana-ui/src/components/Card/Card.tsx +++ b/packages/grafana-ui/src/components/Card/Card.tsx @@ -140,7 +140,7 @@ const getContainerStyles = stylesFactory((theme: GrafanaThemeV2, disabled = fals return css({ display: 'flex', width: '100%', - background: theme.palette.background.secondary, + background: theme.colors.background.secondary, borderRadius: theme.shape.borderRadius(), position: 'relative', pointerEvents: disabled ? 'none' : 'auto', @@ -151,7 +151,7 @@ const getContainerStyles = stylesFactory((theme: GrafanaThemeV2, disabled = fals ...(!disableHover && { '&:hover': { - background: theme.palette.emphasize(theme.palette.background.secondary, 0.03), + background: theme.colors.emphasize(theme.colors.background.secondary, 0.03), cursor: 'pointer', zIndex: 1, }, @@ -180,7 +180,7 @@ export const getCardStyles = stylesFactory((theme: GrafanaThemeV2) => { margin-bottom: 0; font-size: ${theme.typography.size.md}; line-height: ${theme.typography.body.lineHeight}; - color: ${theme.palette.text.primary}; + color: ${theme.colors.text.primary}; font-weight: ${theme.typography.fontWeightMedium}; `, info: css` @@ -195,14 +195,14 @@ export const getCardStyles = stylesFactory((theme: GrafanaThemeV2) => { align-items: center; width: 100%; font-size: ${theme.typography.size.sm}; - color: ${theme.palette.text.secondary}; + color: ${theme.colors.text.secondary}; margin: ${theme.spacing(0.5, 0, 0)}; line-height: ${theme.typography.bodySmall.lineHeight}; `, description: css` width: 100%; margin: ${theme.spacing(1, 0, 0)}; - color: ${theme.palette.text.secondary}; + color: ${theme.colors.text.secondary}; line-height: ${theme.typography.body.lineHeight}; `, media: css` @@ -234,7 +234,7 @@ export const getCardStyles = stylesFactory((theme: GrafanaThemeV2) => { secondaryActions: css` display: flex; align-items: center; - color: ${theme.palette.text.secondary}; + color: ${theme.colors.text.secondary}; // align to the right margin-left: auto; & > * { diff --git a/packages/grafana-ui/src/components/ConfirmModal/ConfirmModal.tsx b/packages/grafana-ui/src/components/ConfirmModal/ConfirmModal.tsx index 2e9e77a5738..aff2346b52f 100644 --- a/packages/grafana-ui/src/components/ConfirmModal/ConfirmModal.tsx +++ b/packages/grafana-ui/src/components/ConfirmModal/ConfirmModal.tsx @@ -101,7 +101,7 @@ const getStyles = (theme: GrafanaThemeV2) => ({ `, modalText: css({ fontSize: theme.typography.h4.fontSize, - color: theme.palette.text.primary, + color: theme.colors.text.primary, marginBottom: `calc(${theme.spacing(2)}*2)`, paddingTop: theme.spacing(2), }), diff --git a/packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.tsx b/packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.tsx index f4db372ac0a..76a40651543 100644 --- a/packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.tsx +++ b/packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.tsx @@ -155,12 +155,12 @@ const getStyles = (theme: GrafanaThemeV2) => { left: ${theme.spacing(0.25)}; } .thumb-vertical { - background: ${theme.palette.action.focus}; + background: ${theme.colors.action.focus}; border-radius: ${theme.shape.borderRadius(2)}; opacity: 0; } .thumb-horizontal { - background: ${theme.palette.action.focus}; + background: ${theme.colors.action.focus}; border-radius: ${theme.shape.borderRadius(2)}; opacity: 0; } diff --git a/packages/grafana-ui/src/components/DataLinks/DataLinkInput.tsx b/packages/grafana-ui/src/components/DataLinks/DataLinkInput.tsx index 7b6d71ac885..4a4b9ab277c 100644 --- a/packages/grafana-ui/src/components/DataLinks/DataLinkInput.tsx +++ b/packages/grafana-ui/src/components/DataLinks/DataLinkInput.tsx @@ -48,10 +48,10 @@ const getStyles = (theme: GrafanaThemeV2) => ({ input: getInputStyles({ theme, invalid: false }).input, editor: css` .token.builtInVariable { - color: ${theme.palette.success.text}; + color: ${theme.colors.success.text}; } .token.variable { - color: ${theme.palette.primary.text}; + color: ${theme.colors.primary.text}; } `, // Wrapper with child selector needed. diff --git a/packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButton.tsx b/packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButton.tsx index e9a402dca5f..ad09dbd182b 100644 --- a/packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButton.tsx +++ b/packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButton.tsx @@ -55,8 +55,8 @@ RadioButton.displayName = 'RadioButton'; const getRadioButtonStyles = stylesFactory((theme: GrafanaThemeV2, size: RadioButtonSize, fullWidth?: boolean) => { const { fontSize, height, padding } = getPropertiesForButtonSize(size, theme); - const textColor = theme.palette.text.secondary; - const textColorHover = theme.palette.text.primary; + const textColor = theme.colors.text.secondary; + const textColorHover = theme.colors.text.primary; const bg = theme.components.input.background; // remove the group inner padding (set on RadioButtonGroup) const labelHeight = height * theme.spacing.gridSize - 4 - 2; @@ -68,9 +68,9 @@ const getRadioButtonStyles = stylesFactory((theme: GrafanaThemeV2, size: RadioBu z-index: -1000; &:checked + label { - color: ${theme.palette.text.primary}; + color: ${theme.colors.text.primary}; font-weight: ${theme.typography.fontWeightMedium}; - background: ${theme.palette.action.selected}; + background: ${theme.colors.action.selected}; z-index: 3; } @@ -85,7 +85,7 @@ const getRadioButtonStyles = stylesFactory((theme: GrafanaThemeV2, size: RadioBu &:disabled + label { cursor: default; - color: ${theme.palette.text.disabled}; + color: ${theme.colors.text.disabled}; cursor: not-allowed; } `, diff --git a/packages/grafana-ui/src/components/Forms/commonStyles.ts b/packages/grafana-ui/src/components/Forms/commonStyles.ts index f9623ecd8fd..9dfadefbdd8 100644 --- a/packages/grafana-ui/src/components/Forms/commonStyles.ts +++ b/packages/grafana-ui/src/components/Forms/commonStyles.ts @@ -10,8 +10,8 @@ export const getFocusStyle = (theme: GrafanaTheme) => css` `; export const sharedInputStyle = (theme: GrafanaThemeV2, invalid = false) => { - const borderColor = invalid ? theme.palette.error.border : theme.components.input.border; - const borderColorHover = invalid ? theme.palette.error.shade : theme.components.input.borderHover; + const borderColor = invalid ? theme.colors.error.border : theme.components.input.border; + const borderColorHover = invalid ? theme.colors.error.shade : theme.components.input.borderHover; const background = theme.components.input.background; const textColor = theme.components.input.text; @@ -32,7 +32,7 @@ export const sharedInputStyle = (theme: GrafanaThemeV2, invalid = false) => { &:-webkit-autofill:focus { /* Welcome to 2005. This is a HACK to get rid od Chromes default autofill styling */ - box-shadow: 0 0 0 2px ${theme.palette.background.primary}, 0 0 0px 4px ${theme.palette.primary.main}, + box-shadow: 0 0 0 2px ${theme.colors.background.primary}, 0 0 0px 4px ${theme.colors.primary.main}, inset 0 0 0 1px rgba(255, 255, 255, 0), inset 0 0 0 100px ${background}!important; -webkit-text-fill-color: ${textColor} !important; } @@ -46,9 +46,9 @@ export const sharedInputStyle = (theme: GrafanaThemeV2, invalid = false) => { } &:disabled { - background-color: ${theme.palette.action.disabledBackground}; - color: ${theme.palette.action.disabledText}; - border: 1px solid ${theme.palette.action.disabledBackground}; + background-color: ${theme.colors.action.disabledBackground}; + color: ${theme.colors.action.disabledText}; + border: 1px solid ${theme.colors.action.disabledBackground}; &:hover { border-color: ${borderColor}; @@ -56,7 +56,7 @@ export const sharedInputStyle = (theme: GrafanaThemeV2, invalid = false) => { } &::placeholder { - color: ${theme.palette.text.disabled}; + color: ${theme.colors.text.disabled}; opacity: 1; } `; diff --git a/packages/grafana-ui/src/components/IconButton/IconButton.story.tsx b/packages/grafana-ui/src/components/IconButton/IconButton.story.tsx index 3928f78dd6c..5294fee2b45 100644 --- a/packages/grafana-ui/src/components/IconButton/IconButton.story.tsx +++ b/packages/grafana-ui/src/components/IconButton/IconButton.story.tsx @@ -40,7 +40,7 @@ const RenderScenario = ({ background }: ScenarioProps) => {
( IconButton.displayName = 'IconButton'; const getStyles = stylesFactory((theme: GrafanaThemeV2, size: IconSize) => { - const hoverColor = theme.palette.action.hover; + const hoverColor = theme.colors.action.hover; const pixelSize = getSvgSize(size); const hoverSize = pixelSize / 2; @@ -110,7 +110,7 @@ const getStyles = stylesFactory((theme: GrafanaThemeV2, size: IconSize) => { } &:hover { - color: ${theme.palette.text.primary}; + color: ${theme.colors.text.primary}; &:before { background-color: ${hoverColor}; diff --git a/packages/grafana-ui/src/components/InfoBox/InfoBox.tsx b/packages/grafana-ui/src/components/InfoBox/InfoBox.tsx index 729df11c144..4671904e803 100644 --- a/packages/grafana-ui/src/components/InfoBox/InfoBox.tsx +++ b/packages/grafana-ui/src/components/InfoBox/InfoBox.tsx @@ -57,7 +57,7 @@ export const InfoBox = React.memo( InfoBox.displayName = 'InfoBox'; const getInfoBoxStyles = stylesFactory((theme: GrafanaThemeV2, severity: AlertVariant) => { - const color = theme.palette[severity]; + const color = theme.colors[severity]; return { wrapper: css` diff --git a/packages/grafana-ui/src/components/Input/Input.tsx b/packages/grafana-ui/src/components/Input/Input.tsx index 84ca8811638..3055357f76f 100644 --- a/packages/grafana-ui/src/components/Input/Input.tsx +++ b/packages/grafana-ui/src/components/Input/Input.tsx @@ -44,7 +44,7 @@ export const getInputStyles = stylesFactory(({ theme, invalid = false, width }: height: 100%; /* Min width specified for prefix/suffix classes used outside React component*/ min-width: ${prefixSuffixStaticWidth}; - color: ${theme.palette.text.secondary}; + color: ${theme.colors.text.secondary}; `; return { @@ -60,7 +60,7 @@ export const getInputStyles = stylesFactory(({ theme, invalid = false, width }: > .prefix, .suffix, .input { - border-color: ${invalid ? theme.palette.error.border : theme.palette.primary.border}; + border-color: ${invalid ? theme.colors.error.border : theme.colors.primary.border}; } // only show number buttons on hover @@ -143,8 +143,8 @@ export const getInputStyles = stylesFactory(({ theme, invalid = false, width }: ` ), inputDisabled: css` - background-color: ${theme.palette.action.disabledBackground}; - color: ${theme.palette.action.disabledText}; + background-color: ${theme.colors.action.disabledBackground}; + color: ${theme.colors.action.disabledText}; `, addon: css` label: input-addon; diff --git a/packages/grafana-ui/src/components/Menu/Menu.tsx b/packages/grafana-ui/src/components/Menu/Menu.tsx index 1df1c4256f5..cc249d9773f 100644 --- a/packages/grafana-ui/src/components/Menu/Menu.tsx +++ b/packages/grafana-ui/src/components/Menu/Menu.tsx @@ -31,10 +31,10 @@ const getStyles = (theme: GrafanaThemeV2) => { return { header: css` padding: ${theme.spacing(0.5, 0.5, 1, 0.5)}; - border-bottom: 1px solid ${theme.palette.border.medium}; + border-bottom: 1px solid ${theme.colors.border.medium}; `, wrapper: css` - background: ${theme.palette.background.secondary}; + background: ${theme.colors.background.secondary}; box-shadow: ${theme.shadows.z2}; display: inline-block; border-radius: ${theme.shape.borderRadius()}; diff --git a/packages/grafana-ui/src/components/Menu/MenuGroup.tsx b/packages/grafana-ui/src/components/Menu/MenuGroup.tsx index 09fbe57672b..b76b36a5280 100644 --- a/packages/grafana-ui/src/components/Menu/MenuGroup.tsx +++ b/packages/grafana-ui/src/components/Menu/MenuGroup.tsx @@ -40,7 +40,7 @@ MenuGroup.displayName = 'MenuGroup'; const getStyles = (theme: GrafanaThemeV2) => { return { groupLabel: css` - color: ${theme.palette.text.secondary}; + color: ${theme.colors.text.secondary}; font-size: ${theme.typography.size.sm}; padding: ${theme.spacing(0.5, 1)}; `, diff --git a/packages/grafana-ui/src/components/Menu/MenuItem.tsx b/packages/grafana-ui/src/components/Menu/MenuItem.tsx index 7b0e652ab3d..0dd2596ac6a 100644 --- a/packages/grafana-ui/src/components/Menu/MenuItem.tsx +++ b/packages/grafana-ui/src/components/Menu/MenuItem.tsx @@ -58,13 +58,13 @@ MenuItem.displayName = 'MenuItem'; const getStyles = (theme: GrafanaThemeV2) => { return { link: css` - color: ${theme.palette.text.primary}; + color: ${theme.colors.text.primary}; display: flex; cursor: pointer; padding: 5px 12px 5px 10px; &:hover { - color: ${theme.palette.text.primary}; + color: ${theme.colors.text.primary}; text-decoration: none; } `, @@ -74,16 +74,16 @@ const getStyles = (theme: GrafanaThemeV2) => { white-space: nowrap; &:hover { - background: ${theme.palette.action.hover}; + background: ${theme.colors.action.hover}; } `, activeItem: css` - background: ${theme.palette.action.selected}; + background: ${theme.colors.action.selected}; `, icon: css` opacity: 0.7; margin-right: 10px; - color: ${theme.palette.text.secondary}; + color: ${theme.colors.text.secondary}; `, }; }; diff --git a/packages/grafana-ui/src/components/Modal/getModalStyles.ts b/packages/grafana-ui/src/components/Modal/getModalStyles.ts index 35371f299f1..ed545d11d1a 100644 --- a/packages/grafana-ui/src/components/Modal/getModalStyles.ts +++ b/packages/grafana-ui/src/components/Modal/getModalStyles.ts @@ -11,7 +11,7 @@ export const getModalStyles = stylesFactory((theme: GrafanaThemeV2) => { modal: css` position: fixed; z-index: ${theme.zIndex.modal}; - background: ${theme.palette.background.primary}; + background: ${theme.colors.background.primary}; box-shadow: ${theme.shadows.z4}; border-radius: ${borderRadius}; background-clip: padding-box; @@ -35,8 +35,8 @@ export const getModalStyles = stylesFactory((theme: GrafanaThemeV2) => { `, modalHeader: css` label: modalHeader; - background: ${theme.palette.background.secondary}; - border-bottom: 1px solid ${theme.palette.border.weak}; + background: ${theme.colors.background.secondary}; + border-bottom: 1px solid ${theme.colors.border.weak}; border-radius: ${borderRadius} ${borderRadius} 0 0; display: flex; height: 42px; diff --git a/packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx b/packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx index a5a3634639c..2b31c922206 100644 --- a/packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx +++ b/packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx @@ -132,7 +132,7 @@ const getStyles = (theme: GrafanaThemeV2) => { return { toolbar: css` display: flex; - background: ${theme.palette.background.canvas}; + background: ${theme.colors.background.canvas}; justify-content: flex-end; flex-wrap: wrap; padding: ${theme.spacing(0, 1, 1, 2)}; diff --git a/packages/grafana-ui/src/components/Select/SelectBase.tsx b/packages/grafana-ui/src/components/Select/SelectBase.tsx index 31a3dfa7115..432ddd58fe4 100644 --- a/packages/grafana-ui/src/components/Select/SelectBase.tsx +++ b/packages/grafana-ui/src/components/Select/SelectBase.tsx @@ -245,7 +245,7 @@ export function SelectBase({ css(props.getStyles('placeholder', props)), css` display: inline-block; - color: ${theme.palette.text.disabled}; + color: ${theme.colors.text.disabled}; position: absolute; top: 50%; transform: translateY(-50%); diff --git a/packages/grafana-ui/src/components/Select/getSelectStyles.ts b/packages/grafana-ui/src/components/Select/getSelectStyles.ts index 4dbe03dd929..453a51a7348 100644 --- a/packages/grafana-ui/src/components/Select/getSelectStyles.ts +++ b/packages/grafana-ui/src/components/Select/getSelectStyles.ts @@ -6,7 +6,7 @@ export const getSelectStyles = stylesFactory((theme: GrafanaThemeV2) => { return { menu: css` label: grafana-select-menu; - background: ${theme.palette.background.secondary}; + background: ${theme.colors.background.secondary}; box-shadow: ${theme.shadows.z3}; position: relative; min-width: 100%; @@ -24,7 +24,7 @@ export const getSelectStyles = stylesFactory((theme: GrafanaThemeV2) => { border-left: 2px solid transparent; &:hover { - background: ${theme.palette.action.hover}; + background: ${theme.colors.action.hover}; } `, optionImage: css` @@ -36,7 +36,7 @@ export const getSelectStyles = stylesFactory((theme: GrafanaThemeV2) => { label: grafana-select-option-description; font-weight: normal; font-size: ${theme.typography.size.sm}; - color: ${theme.palette.text.secondary}; + color: ${theme.colors.text.secondary}; white-space: normal; line-height: ${theme.typography.body.lineHeight}; `, @@ -49,10 +49,10 @@ export const getSelectStyles = stylesFactory((theme: GrafanaThemeV2) => { `, optionFocused: css` label: grafana-select-option-focused; - background: ${theme.palette.action.focus}; + background: ${theme.colors.action.focus}; `, optionSelected: css` - background: ${theme.palette.action.selected}; + background: ${theme.colors.action.selected}; `, singleValue: css` label: grafana-select-single-value; @@ -88,11 +88,11 @@ export const getSelectStyles = stylesFactory((theme: GrafanaThemeV2) => { display: flex; align-items: center; line-height: 1; - background: ${theme.palette.background.secondary}; + background: ${theme.colors.background.secondary}; border-radius: ${theme.shape.borderRadius()}; margin: ${theme.spacing(0, 1, 0, 0)}; padding: ${theme.spacing(0.25, 0, 0.25, 1)}; - color: ${theme.palette.text.primary}; + color: ${theme.colors.text.primary}; font-size: ${theme.typography.size.sm}; `, multiValueRemove: css` diff --git a/packages/grafana-ui/src/components/Slider/styles.ts b/packages/grafana-ui/src/components/Slider/styles.ts index 6fa544275da..38c8b9e43c2 100644 --- a/packages/grafana-ui/src/components/Slider/styles.ts +++ b/packages/grafana-ui/src/components/Slider/styles.ts @@ -5,10 +5,10 @@ import { css } from '@emotion/css'; export const getStyles = stylesFactory((theme: GrafanaThemeV2, isHorizontal: boolean) => { const { spacing } = theme; - const railColor = theme.palette.border.strong; - const trackColor = theme.palette.primary.main; - const handleColor = theme.palette.primary.main; - const blueOpacity = theme.palette.primary.transparent; + const railColor = theme.colors.border.strong; + const trackColor = theme.colors.primary.main; + const handleColor = theme.colors.primary.main; + const blueOpacity = theme.colors.primary.transparent; const hoverSyle = `box-shadow: 0px 0px 0px 6px ${blueOpacity}`; return { @@ -59,7 +59,7 @@ export const getStyles = stylesFactory((theme: GrafanaThemeV2, isHorizontal: boo } .rc-slider-tooltip-inner { - color: ${theme.palette.text.primary}; + color: ${theme.colors.text.primary}; background-color: transparent !important; border-radius: 0; box-shadow: none; diff --git a/packages/grafana-ui/src/components/Switch/Switch.tsx b/packages/grafana-ui/src/components/Switch/Switch.tsx index 8ffe5a7f7ae..4ffe6497562 100644 --- a/packages/grafana-ui/src/components/Switch/Switch.tsx +++ b/packages/grafana-ui/src/components/Switch/Switch.tsx @@ -69,21 +69,21 @@ const getSwitchStyles = stylesFactory((theme: GrafanaThemeV2, transparent?: bool position: absolute; &:disabled + label { - background: ${theme.palette.action.disabledBackground}; + background: ${theme.colors.action.disabledBackground}; cursor: not-allowed; } &:checked + label { - background: ${theme.palette.primary.main}; - border-color: ${theme.palette.primary.main}; + background: ${theme.colors.primary.main}; + border-color: ${theme.colors.primary.main}; &:hover { - background: ${theme.palette.primary.shade}; + background: ${theme.colors.primary.shade}; } &::after { transform: translate3d(18px, -50%, 0); - background: ${theme.palette.primary.contrastText}; + background: ${theme.colors.primary.contrastText}; } } @@ -118,7 +118,7 @@ const getSwitchStyles = stylesFactory((theme: GrafanaThemeV2, transparent?: bool width: 12px; height: 12px; border-radius: 6px; - background: ${theme.palette.text.secondary}; + background: ${theme.colors.text.secondary}; box-shadow: ${theme.shadows.z1}; top: 50%; transform: translate3d(2px, -50%, 0); diff --git a/packages/grafana-ui/src/components/Table/FilterList.tsx b/packages/grafana-ui/src/components/Table/FilterList.tsx index 9bef1a6b4e7..cff3411cf16 100644 --- a/packages/grafana-ui/src/components/Table/FilterList.tsx +++ b/packages/grafana-ui/src/components/Table/FilterList.tsx @@ -91,7 +91,7 @@ const getStyles = stylesFactory((theme: GrafanaThemeV2) => ({ padding: ${theme.spacing(0.5)}; :hover { - background-color: ${theme.palette.action.hover}; + background-color: ${theme.colors.action.hover}; } `, filterListInput: css` diff --git a/packages/grafana-ui/src/components/Tabs/Counter.tsx b/packages/grafana-ui/src/components/Tabs/Counter.tsx index 18f092d3d83..cbc861e8b40 100644 --- a/packages/grafana-ui/src/components/Tabs/Counter.tsx +++ b/packages/grafana-ui/src/components/Tabs/Counter.tsx @@ -9,9 +9,9 @@ const getStyles = stylesFactory((theme: GrafanaThemeV2) => { label: counter; margin-left: ${theme.spacing(1)}; border-radius: ${theme.spacing(3)}; - background-color: ${theme.palette.action.hover}; + background-color: ${theme.colors.action.hover}; padding: ${theme.spacing(0.25, 1)}; - color: ${theme.palette.text.secondary}; + color: ${theme.colors.text.secondary}; font-weight: ${theme.typography.fontWeightMedium}; font-size: ${theme.typography.size.sm}; `, diff --git a/packages/grafana-ui/src/components/Tabs/Tab.tsx b/packages/grafana-ui/src/components/Tabs/Tab.tsx index 068a5893d1d..ae0e74eb4c2 100644 --- a/packages/grafana-ui/src/components/Tabs/Tab.tsx +++ b/packages/grafana-ui/src/components/Tabs/Tab.tsx @@ -60,7 +60,7 @@ const getTabStyles = stylesFactory((theme: GrafanaThemeV2) => { display: flex; `, link: css` - color: ${theme.palette.text.secondary}; + color: ${theme.colors.text.secondary}; padding: ${theme.spacing(1.5, 2, 1)}; svg { @@ -70,14 +70,14 @@ const getTabStyles = stylesFactory((theme: GrafanaThemeV2) => { a { display: block; height: 100%; - color: ${theme.palette.text.secondary}; + color: ${theme.colors.text.secondary}; } `, notActive: css` a:hover, &:hover, &:focus { - color: ${theme.palette.text.primary}; + color: ${theme.colors.text.primary}; &::before { display: block; @@ -88,18 +88,18 @@ const getTabStyles = stylesFactory((theme: GrafanaThemeV2) => { height: 4px; border-radius: 2px; bottom: 0px; - background: ${theme.palette.action.hover}; + background: ${theme.colors.action.hover}; } } `, activeStyle: css` label: activeTabStyle; - color: ${theme.palette.text.primary}; + color: ${theme.colors.text.primary}; overflow: hidden; font-weight: ${theme.typography.fontWeightMedium}; a { - color: ${theme.palette.text.primary}; + color: ${theme.colors.text.primary}; } &::before { @@ -111,7 +111,7 @@ const getTabStyles = stylesFactory((theme: GrafanaThemeV2) => { height: 4px; border-radius: 2px; bottom: 0px; - background-image: ${theme.palette.gradients.brandHorizontal} !important; + background-image: ${theme.colors.gradients.brandHorizontal} !important; } `, }; diff --git a/packages/grafana-ui/src/components/Tabs/TabContent.tsx b/packages/grafana-ui/src/components/Tabs/TabContent.tsx index c4f2121932e..cef016f0b1c 100644 --- a/packages/grafana-ui/src/components/Tabs/TabContent.tsx +++ b/packages/grafana-ui/src/components/Tabs/TabContent.tsx @@ -11,7 +11,7 @@ const getTabContentStyle = stylesFactory((theme: GrafanaThemeV2) => { return { tabContent: css` padding: ${theme.spacing(1)}; - background: ${theme.palette.background.primary}; + background: ${theme.colors.background.primary}; `, }; }); diff --git a/packages/grafana-ui/src/components/Tabs/TabsBar.tsx b/packages/grafana-ui/src/components/Tabs/TabsBar.tsx index ae4637d0aab..0792c98ad73 100644 --- a/packages/grafana-ui/src/components/Tabs/TabsBar.tsx +++ b/packages/grafana-ui/src/components/Tabs/TabsBar.tsx @@ -16,7 +16,7 @@ const getTabsBarStyles = stylesFactory((theme: GrafanaThemeV2, hideBorder = fals tabsWrapper: !hideBorder && css` - border-bottom: 1px solid ${theme.palette.border.weak}; + border-bottom: 1px solid ${theme.colors.border.weak}; `, tabs: css` position: relative; diff --git a/packages/grafana-ui/src/components/TextArea/TextArea.tsx b/packages/grafana-ui/src/components/TextArea/TextArea.tsx index 40117391426..1c44368e6c2 100644 --- a/packages/grafana-ui/src/components/TextArea/TextArea.tsx +++ b/packages/grafana-ui/src/components/TextArea/TextArea.tsx @@ -25,7 +25,7 @@ const getTextAreaStyle = stylesFactory((theme: GrafanaThemeV2, invalid = false) border-radius: ${theme.shape.borderRadius()}; padding: ${theme.spacing.gridSize / 4}px ${theme.spacing.gridSize}px; width: 100%; - border-color: ${invalid ? theme.palette.error.border : theme.components.input.border}; + border-color: ${invalid ? theme.colors.error.border : theme.components.input.border}; ` ), }; diff --git a/packages/grafana-ui/src/components/ThemeDemos/EmotionPerfTest.tsx b/packages/grafana-ui/src/components/ThemeDemos/EmotionPerfTest.tsx index f0ebf6a9cdb..8a5745fec67 100644 --- a/packages/grafana-ui/src/components/ThemeDemos/EmotionPerfTest.tsx +++ b/packages/grafana-ui/src/components/ThemeDemos/EmotionPerfTest.tsx @@ -179,7 +179,7 @@ function getStylesObjectMain(theme: GrafanaThemeV2): any { padding: theme.spacing(1), shadow: theme.shadows.z1, ':hover': { - background: theme.palette.background.primary, + background: theme.colors.background.primary, }, }; } diff --git a/packages/grafana-ui/src/components/ThemeDemos/ThemeDemo.tsx b/packages/grafana-ui/src/components/ThemeDemos/ThemeDemo.tsx index 857143fbad4..ee35ea31540 100644 --- a/packages/grafana-ui/src/components/ThemeDemos/ThemeDemo.tsx +++ b/packages/grafana-ui/src/components/ThemeDemos/ThemeDemo.tsx @@ -3,7 +3,7 @@ import { css, cx } from '@emotion/css'; import { useTheme2 } from '../../themes/ThemeContext'; import { Icon } from '../Icon/Icon'; import { HorizontalGroup, VerticalGroup } from '../Layout/Layout'; -import { GrafanaThemeV2, ThemePaletteColor } from '@grafana/data'; +import { GrafanaThemeV2, ThemeRichColor } from '@grafana/data'; import { CollapsableSection } from '../Collapse/CollapsableSection'; import { Field } from '../Forms/Field'; import { Input } from '../Input/Input'; @@ -56,12 +56,12 @@ export const ThemeDemo = () => { const t = useTheme2(); const richColors = [ - t.palette.primary, - t.palette.secondary, - t.palette.success, - t.palette.error, - t.palette.warning, - t.palette.info, + t.colors.primary, + t.colors.secondary, + t.colors.success, + t.colors.error, + t.colors.warning, + t.colors.info, ]; const selectOptions = [ @@ -80,16 +80,16 @@ export const ThemeDemo = () => {
- + - t.palette.background.canvas - - t.palette.background.primary is the main & preferred content - - t.palette.background.secondary and t.palette.border.layer1 + t.colors.background.canvas + + t.colors.background.primary is the main & preferred content + + t.colors.background.secondary and t.colors.border.layer1 @@ -98,16 +98,16 @@ export const ThemeDemo = () => { - + - + - + @@ -126,7 +126,7 @@ export const ThemeDemo = () => { - + @@ -164,7 +164,7 @@ export const ThemeDemo = () => { - + {Object.keys(t.shadows).map((key) => ( @@ -173,7 +173,7 @@ export const ThemeDemo = () => { - + {allButtonVariants.map((variant) => ( @@ -212,7 +212,7 @@ export const ThemeDemo = () => { interface RichColorDemoProps { theme: GrafanaThemeV2; - color: ThemePaletteColor; + color: ThemeRichColor; } export function RichColorDemo({ theme, color }: RichColorDemoProps) { @@ -272,16 +272,16 @@ const colorsTableStyle = css` export function TextColors({ t }: { t: GrafanaThemeV2 }) { return ( <> - + text.primary - + text.secondary - + text.disabled - + primary.text @@ -302,22 +302,22 @@ export function ActionsDemo() { const item = css({ padding: '8px', ':hover': { - background: t.palette.action.hover, + background: t.colors.action.hover, }, }); const hover = css({ - background: t.palette.action.hover, + background: t.colors.action.hover, }); const selected = css({ - background: t.palette.action.selected, + background: t.colors.action.selected, }); const focused = css({ - background: t.palette.action.focus, + background: t.colors.action.focus, }); return ( - +
item
item
@@ -326,7 +326,7 @@ export function ActionsDemo() {
item focused
- +
item
item
@@ -335,7 +335,7 @@ export function ActionsDemo() {
item focused
- +
item
item
diff --git a/packages/grafana-ui/src/components/TimePicker/TimeRangePicker/TimePickerContent.tsx b/packages/grafana-ui/src/components/TimePicker/TimeRangePicker/TimePickerContent.tsx index 123b2fb7118..1b23ef334a2 100644 --- a/packages/grafana-ui/src/components/TimePicker/TimeRangePicker/TimePickerContent.tsx +++ b/packages/grafana-ui/src/components/TimePicker/TimeRangePicker/TimePickerContent.tsx @@ -14,14 +14,14 @@ import { TimePickerFooter } from './TimePickerFooter'; const getStyles = stylesFactory((theme: GrafanaThemeV2, isReversed, hideQuickRanges, isContainerTall) => { return { container: css` - background: ${theme.palette.background.secondary}; + background: ${theme.colors.background.secondary}; box-shadow: ${theme.shadows.z4}; position: absolute; z-index: ${theme.zIndex.dropdown}; width: 546px; top: 116%; border-radius: 2px; - border: 1px solid ${theme.palette.border.weak}; + border: 1px solid ${theme.colors.border.weak}; ${isReversed ? 'left' : 'right'}: 0; @media only screen and (max-width: ${theme.breakpoints.values.lg}px) { @@ -35,14 +35,14 @@ const getStyles = stylesFactory((theme: GrafanaThemeV2, isReversed, hideQuickRan leftSide: css` display: flex; flex-direction: column; - border-right: ${isReversed ? 'none' : `1px solid ${theme.palette.border.weak}`}; + border-right: ${isReversed ? 'none' : `1px solid ${theme.colors.border.weak}`}; width: ${!hideQuickRanges ? '60%' : '100%'}; overflow: hidden; order: ${isReversed ? 1 : 0}; `, rightSide: css` width: 40% !important; - border-right: ${isReversed ? `1px solid ${theme.palette.border.weak}` : 'none'}; + border-right: ${isReversed ? `1px solid ${theme.colors.border.weak}` : 'none'}; @media only screen and (max-width: ${theme.breakpoints.values.lg}px) { width: 100% !important; @@ -61,11 +61,11 @@ const getNarrowScreenStyles = stylesFactory((theme: GrafanaThemeV2) => { flex-direction: row; justify-content: space-between; align-items: center; - border-bottom: 1px solid ${theme.palette.border.weak}; + border-bottom: 1px solid ${theme.colors.border.weak}; padding: 7px 9px 7px 9px; `, body: css` - border-bottom: 1px solid ${theme.palette.border.weak}; + border-bottom: 1px solid ${theme.colors.border.weak}; `, form: css` padding: 7px 9px 7px 9px; @@ -105,7 +105,7 @@ const getEmptyListStyles = stylesFactory((theme: GrafanaThemeV2) => { } `, link: css` - color: ${theme.palette.text.link}; + color: ${theme.colors.text.link}; `, }; }); diff --git a/packages/grafana-ui/src/components/TimePicker/TimeRangePicker/TimePickerFooter.tsx b/packages/grafana-ui/src/components/TimePicker/TimeRangePicker/TimePickerFooter.tsx index 2342ed4c8d1..a2e99dc6ccd 100644 --- a/packages/grafana-ui/src/components/TimePicker/TimeRangePicker/TimePickerFooter.tsx +++ b/packages/grafana-ui/src/components/TimePicker/TimeRangePicker/TimePickerFooter.tsx @@ -85,7 +85,7 @@ export const TimePickerFooter: FC = (props) => { const getStyle = stylesFactory((theme: GrafanaThemeV2) => { return { container: css` - border-top: 1px solid ${theme.palette.border.weak}; + border-top: 1px solid ${theme.colors.border.weak}; padding: 11px; display: flex; flex-direction: row; diff --git a/packages/grafana-ui/src/components/TimePicker/TimeRangePicker/TimeRangeOption.tsx b/packages/grafana-ui/src/components/TimePicker/TimeRangePicker/TimeRangeOption.tsx index a3ccc34fc78..f57c091dff9 100644 --- a/packages/grafana-ui/src/components/TimePicker/TimeRangePicker/TimeRangeOption.tsx +++ b/packages/grafana-ui/src/components/TimePicker/TimeRangePicker/TimeRangeOption.tsx @@ -12,12 +12,12 @@ const getStyles = (theme: GrafanaThemeV2) => { padding: 7px 9px 7px 9px; &:hover { - background: ${theme.palette.action.hover}; + background: ${theme.colors.action.hover}; cursor: pointer; } `, selected: css` - background: ${theme.palette.action.selected}; + background: ${theme.colors.action.selected}; } `, }; diff --git a/packages/grafana-ui/src/themes/GlobalStyles/elements.ts b/packages/grafana-ui/src/themes/GlobalStyles/elements.ts index f47d8067e4d..ea4edf0cd2d 100644 --- a/packages/grafana-ui/src/themes/GlobalStyles/elements.ts +++ b/packages/grafana-ui/src/themes/GlobalStyles/elements.ts @@ -17,8 +17,8 @@ export function getElementStyles(theme: GrafanaThemeV2) { height: 100%; width: 100%; position: absolute; - color: ${theme.palette.text.primary}; - background-color: ${theme.palette.background.canvas}; + color: ${theme.colors.text.primary}; + background-color: ${theme.colors.background.canvas}; ${getVariantStyles(theme.typography.body)} } @@ -67,7 +67,7 @@ export function getElementStyles(theme: GrafanaThemeV2) { em { font-style: italic; - color: ${theme.palette.text.primary}; + color: ${theme.colors.text.primary}; } cite { @@ -76,29 +76,29 @@ export function getElementStyles(theme: GrafanaThemeV2) { // Utility classes .muted { - color: ${theme.palette.text.secondary}; + color: ${theme.colors.text.secondary}; } a.muted:hover, a.muted:focus { - color: ${theme.palette.text.primary}; + color: ${theme.colors.text.primary}; } .text-warning { - color: ${theme.palette.warning.text}; + color: ${theme.colors.warning.text}; &:hover, &:focus { - color: ${theme.palette.emphasize(theme.palette.warning.text, 0.15)}; + color: ${theme.colors.emphasize(theme.colors.warning.text, 0.15)}; } } .text-error { - color: ${theme.palette.error.text}; + color: ${theme.colors.error.text}; &:hover, &:focus { - color: ${theme.palette.emphasize(theme.palette.error.text, 0.15)}; + color: ${theme.colors.emphasize(theme.colors.error.text, 0.15)}; } } @@ -107,13 +107,13 @@ export function getElementStyles(theme: GrafanaThemeV2) { &:hover, &:focus { - color: ${theme.palette.emphasize(theme.palette.success.text, 0.15)}; + color: ${theme.colors.emphasize(theme.colors.success.text, 0.15)}; } } a { cursor: pointer; - color: ${theme.palette.text.primary}; + color: ${theme.colors.text.primary}; text-decoration: none; &:focus { diff --git a/packages/grafana-ui/src/themes/_variables.dark.scss.tmpl.ts b/packages/grafana-ui/src/themes/_variables.dark.scss.tmpl.ts index 56887b926ea..4face888745 100644 --- a/packages/grafana-ui/src/themes/_variables.dark.scss.tmpl.ts +++ b/packages/grafana-ui/src/themes/_variables.dark.scss.tmpl.ts @@ -12,13 +12,13 @@ $theme-name: dark; // New Colors // ------------------------- -$blue-light: ${theme.palette.primary.text}; -$blue-base: ${theme.palette.primary.main}; -$blue-shade: ${theme.palette.primary.shade}; -$red-base: ${theme.palette.error.main}; -$red-shade: ${theme.palette.error.shade}; -$green-base: ${theme.palette.success.main}; -$green-shade: ${theme.palette.success.shade}; +$blue-light: ${theme.colors.primary.text}; +$blue-base: ${theme.colors.primary.main}; +$blue-shade: ${theme.colors.primary.shade}; +$red-base: ${theme.colors.error.main}; +$red-shade: ${theme.colors.error.shade}; +$green-base: ${theme.colors.success.main}; +$green-shade: ${theme.colors.success.shade}; $orange-dark: ${theme.v1.palette.orangeDark}; $gray98: ${theme.v1.palette.gray98}; @@ -55,14 +55,14 @@ $gray-6: ${theme.v1.palette.gray6}; $input-black: ${theme.v1.colors.formInputBg}; $white: ${theme.v1.palette.white}; -$layer0: ${theme.palette.background.canvas}; -$layer1: ${theme.palette.background.primary}; -$layer2: ${theme.palette.background.secondary}; +$layer0: ${theme.colors.background.canvas}; +$layer1: ${theme.colors.background.primary}; +$layer2: ${theme.colors.background.secondary}; -$divider: ${theme.palette.border.weak}; +$divider: ${theme.colors.border.weak}; -$border0: ${theme.palette.border.weak}; -$border1: ${theme.palette.border.medium}; +$border0: ${theme.colors.border.weak}; +$border1: ${theme.colors.border.medium}; // Accent colors // ------------------------- @@ -129,7 +129,7 @@ $hr-border-color: $dark-9; // ------------------------- $panel-bg: ${theme.components.panel.background}; $panel-border: ${theme.components.panel.border}; -$panel-header-hover-bg: ${theme.palette.action.hover}; +$panel-header-hover-bg: ${theme.colors.action.hover}; $panel-box-shadow: ${theme.components.panel.boxShadow}; $panel-corner: $panel-bg; @@ -141,16 +141,16 @@ $page-header-border-color: ${theme.v1.colors.pageHeaderBorder}; $divider-border-color: $gray-1; // Graphite Target Editor -$tight-form-func-bg: ${theme.palette.background.secondary}; -$tight-form-func-highlight-bg: ${theme.palette.emphasize(theme.palette.background.secondary, 0.03)}; +$tight-form-func-bg: ${theme.colors.background.secondary}; +$tight-form-func-highlight-bg: ${theme.colors.emphasize(theme.colors.background.secondary, 0.03)}; $modal-backdrop-bg: ${theme.v1.colors.bg3}; $code-tag-bg: $dark-1; $code-tag-border: $dark-9; // cards -$card-background: ${theme.palette.background.secondary}; -$card-background-hover: ${theme.palette.emphasize(theme.palette.background.secondary, 0.03)}; +$card-background: ${theme.colors.background.secondary}; +$card-background-hover: ${theme.colors.emphasize(theme.colors.background.secondary, 0.03)}; $card-shadow: none; // Lists @@ -167,10 +167,10 @@ $scrollbarBorder: black; // Tables // ------------------------- -$table-bg-accent: ${theme.palette.background.secondary}; -$table-border: ${theme.palette.border.medium}; -$table-bg-odd: ${theme.palette.emphasize(theme.palette.background.primary, 0.02)}; -$table-bg-hover: ${theme.palette.emphasize(theme.palette.background.primary, 0.05)}; +$table-bg-accent: ${theme.colors.background.secondary}; +$table-border: ${theme.colors.border.medium}; +$table-bg-odd: ${theme.colors.emphasize(theme.colors.background.primary, 0.02)}; +$table-bg-hover: ${theme.colors.emphasize(theme.colors.background.primary, 0.05)}; // Buttons // ------------------------- @@ -228,10 +228,10 @@ $typeahead-selected-color: $yellow; // Dropdowns // ------------------------- -$dropdownBackground: ${theme.palette.background.secondary}; -$dropdownBorder: ${theme.palette.border.weak}; -$dropdownDividerTop: ${theme.palette.border.weak}; -$dropdownDividerBottom: ${theme.palette.border.weak}; +$dropdownBackground: ${theme.colors.background.secondary}; +$dropdownBorder: ${theme.colors.border.weak}; +$dropdownDividerTop: ${theme.colors.border.weak}; +$dropdownDividerBottom: ${theme.colors.border.weak}; $dropdownLinkColor: $link-color; $dropdownLinkColorHover: $white; @@ -259,8 +259,8 @@ $side-menu-header-color: ${theme.v1.colors.text}; // Menu dropdowns // ------------------------- -$menu-dropdown-bg: ${theme.palette.background.secondary}; -$menu-dropdown-hover-bg: ${theme.palette.action.hover}; +$menu-dropdown-bg: ${theme.colors.background.secondary}; +$menu-dropdown-hover-bg: ${theme.colors.action.hover}; $menu-dropdown-shadow: ${theme.shadows.z3}; // Tabs @@ -284,16 +284,16 @@ $tooltipArrowWidth: 5px; $tooltipLinkColor: $link-color; $graph-tooltip-bg: $dark-1; -$tooltipBackground: ${theme.palette.background.secondary}; -$tooltipColor: ${theme.palette.text.primary}; -$tooltipArrowColor: ${theme.palette.background.secondary}; -$tooltipBackgroundError: ${theme.palette.error.main}; +$tooltipBackground: ${theme.colors.background.secondary}; +$tooltipColor: ${theme.colors.text.primary}; +$tooltipArrowColor: ${theme.colors.background.secondary}; +$tooltipBackgroundError: ${theme.colors.error.main}; $tooltipShadow: ${theme.shadows.z2}; -$popover-bg: ${theme.palette.background.secondary}; -$popover-color: ${theme.palette.text.primary}; -$popover-border-color: ${theme.palette.border.medium}; -$popover-header-bg: ${theme.palette.background.secondary}; +$popover-bg: ${theme.colors.background.secondary}; +$popover-color: ${theme.colors.text.primary}; +$popover-border-color: ${theme.colors.border.medium}; +$popover-header-bg: ${theme.colors.background.secondary}; $popover-shadow: ${theme.shadows.z4}; $popover-help-bg: $tooltipBackground; diff --git a/packages/grafana-ui/src/themes/_variables.light.scss.tmpl.ts b/packages/grafana-ui/src/themes/_variables.light.scss.tmpl.ts index 05a7d1a439d..953b393d1d1 100644 --- a/packages/grafana-ui/src/themes/_variables.light.scss.tmpl.ts +++ b/packages/grafana-ui/src/themes/_variables.light.scss.tmpl.ts @@ -13,13 +13,13 @@ $theme-name: light; // New Colors // ------------------------- -$blue-light: ${theme.palette.primary.text}; -$blue-base: ${theme.palette.primary.main}; -$blue-shade: ${theme.palette.primary.shade}; -$red-base: ${theme.palette.error.main}; -$red-shade: ${theme.palette.error.shade}; -$green-base: ${theme.palette.success.main}; -$green-shade: ${theme.palette.success.shade}; +$blue-light: ${theme.colors.primary.text}; +$blue-base: ${theme.colors.primary.main}; +$blue-shade: ${theme.colors.primary.shade}; +$red-base: ${theme.colors.error.main}; +$red-shade: ${theme.colors.error.shade}; +$green-base: ${theme.colors.success.main}; +$green-shade: ${theme.colors.success.shade}; $orange-dark: ${theme.v1.palette.orangeDark}; $gray98: ${theme.v1.palette.gray98}; @@ -51,14 +51,14 @@ $gray-7: ${theme.v1.palette.gray7}; $white: ${theme.v1.palette.white}; -$layer0: ${theme.palette.background.canvas}; -$layer1: ${theme.palette.background.primary}; -$layer2: ${theme.palette.background.secondary}; +$layer0: ${theme.colors.background.canvas}; +$layer1: ${theme.colors.background.primary}; +$layer2: ${theme.colors.background.secondary}; -$divider: ${theme.palette.border.weak}; +$divider: ${theme.colors.border.weak}; -$border0: ${theme.palette.border.weak}; -$border1: ${theme.palette.border.medium}; +$border0: ${theme.colors.border.weak}; +$border1: ${theme.colors.border.medium}; // Accent colors // ------------------------- @@ -124,7 +124,7 @@ $hr-border-color: $gray-4 !default; // ------------------------- $panel-bg: ${theme.components.panel.background}; $panel-border: ${theme.components.panel.border}; -$panel-header-hover-bg: ${theme.palette.action.hover}; +$panel-header-hover-bg: ${theme.colors.action.hover}; $panel-box-shadow: ${theme.components.panel.boxShadow}; $panel-corner: $panel-bg; @@ -144,8 +144,8 @@ $code-tag-bg: $gray-6; $code-tag-border: $gray-4; // cards -$card-background: ${theme.palette.background.secondary}; -$card-background-hover: ${theme.palette.background.secondary}; +$card-background: ${theme.colors.background.secondary}; +$card-background-hover: ${theme.colors.background.secondary}; $card-shadow: none; // Lists @@ -162,10 +162,10 @@ $scrollbarBorder: $gray-7; // Tables // ------------------------- -$table-bg-accent: ${theme.palette.background.secondary}; -$table-border: ${theme.palette.border.medium}; -$table-bg-odd: ${theme.palette.emphasize(theme.palette.background.primary, 0.02)}; -$table-bg-hover: ${theme.palette.emphasize(theme.palette.background.primary, 0.05)}; +$table-bg-accent: ${theme.colors.background.secondary}; +$table-border: ${theme.colors.border.medium}; +$table-bg-odd: ${theme.colors.emphasize(theme.colors.background.primary, 0.02)}; +$table-bg-hover: ${theme.colors.emphasize(theme.colors.background.primary, 0.05)}; // Buttons // ------------------------- @@ -223,10 +223,10 @@ $typeahead-selected-color: $yellow; // Dropdowns // ------------------------- -$dropdownBackground: ${theme.palette.background.secondary}; -$dropdownBorder: ${theme.palette.border.weak}; -$dropdownDividerTop: ${theme.palette.border.weak}; -$dropdownDividerBottom: ${theme.palette.border.weak}; +$dropdownBackground: ${theme.colors.background.secondary}; +$dropdownBorder: ${theme.colors.border.weak}; +$dropdownDividerTop: ${theme.colors.border.weak}; +$dropdownDividerBottom: ${theme.colors.border.weak}; $dropdownLinkColor: $dark-2; $dropdownLinkColorHover: $link-color; @@ -256,8 +256,8 @@ $side-menu-header-color: ${theme.v1.palette.gray95}; // Menu dropdowns // ------------------------- -$menu-dropdown-bg: ${theme.palette.background.secondary}; -$menu-dropdown-hover-bg: ${theme.palette.action.hover}; +$menu-dropdown-bg: ${theme.colors.background.secondary}; +$menu-dropdown-hover-bg: ${theme.colors.action.hover}; $menu-dropdown-shadow: ${theme.shadows.z3}; // Tabs @@ -276,16 +276,16 @@ $alert-warning-bg: linear-gradient(90deg, $red-base, $red-shade); $alert-info-bg: linear-gradient(100deg, $blue-base, $blue-shade); // Tooltips and popovers -$tooltipBackground: ${theme.palette.background.secondary}; -$tooltipColor: ${theme.palette.text.primary}; -$tooltipArrowColor: ${theme.palette.background.secondary}; -$tooltipBackgroundError: ${theme.palette.error.main}; +$tooltipBackground: ${theme.colors.background.secondary}; +$tooltipColor: ${theme.colors.text.primary}; +$tooltipArrowColor: ${theme.colors.background.secondary}; +$tooltipBackgroundError: ${theme.colors.error.main}; $tooltipShadow: ${theme.shadows.z2}; -$popover-bg: ${theme.palette.background.secondary}; -$popover-color: ${theme.palette.text.primary}; -$popover-border-color: ${theme.palette.border.medium}; -$popover-header-bg: ${theme.palette.background.secondary}; +$popover-bg: ${theme.colors.background.secondary}; +$popover-color: ${theme.colors.text.primary}; +$popover-border-color: ${theme.colors.border.medium}; +$popover-header-bg: ${theme.colors.background.secondary}; $popover-shadow: ${theme.shadows.z4}; $graph-tooltip-bg: $gray-5; diff --git a/packages/grafana-ui/src/themes/getTheme.ts b/packages/grafana-ui/src/themes/getTheme.ts index d01723d38b5..66d4f708da3 100644 --- a/packages/grafana-ui/src/themes/getTheme.ts +++ b/packages/grafana-ui/src/themes/getTheme.ts @@ -7,7 +7,7 @@ export const getTheme = (mode: 'dark' | 'light' = 'dark') => { return themeMock(mode); } - return createTheme({ palette: { mode } }).v1; + return createTheme({ colors: { mode } }).v1; }; export const mockTheme = (mock: (name?: string) => GrafanaTheme) => { diff --git a/packages/grafana-ui/src/themes/mixins.ts b/packages/grafana-ui/src/themes/mixins.ts index 205268238bf..ab43a9c48eb 100644 --- a/packages/grafana-ui/src/themes/mixins.ts +++ b/packages/grafana-ui/src/themes/mixins.ts @@ -57,7 +57,7 @@ export function getFocusStyles(theme: GrafanaThemeV2): CSSObject { return { outline: '2px dotted transparent', outlineOffset: '2px', - boxShadow: `0 0 0 2px ${theme.palette.background.canvas}, 0 0 0px 4px ${theme.palette.primary.main}`, + boxShadow: `0 0 0 2px ${theme.colors.background.canvas}, 0 0 0px 4px ${theme.colors.primary.main}`, transition: `all 0.2s cubic-bezier(0.19, 1, 0.22, 1)`, }; } diff --git a/packages/grafana-ui/src/utils/storybook/withPaddedStory.tsx b/packages/grafana-ui/src/utils/storybook/withPaddedStory.tsx index c53dd6f90dd..735c8162ab3 100644 --- a/packages/grafana-ui/src/utils/storybook/withPaddedStory.tsx +++ b/packages/grafana-ui/src/utils/storybook/withPaddedStory.tsx @@ -12,7 +12,7 @@ const PaddedStory: React.FunctionComponent<{}> = ({ children }) => { padding: '20px', display: 'flex', minHeight: '80vh', - background: `${theme.palette.background.primary}`, + background: `${theme.colors.background.primary}`, }} > diff --git a/packages/grafana-ui/src/utils/storybook/withTheme.tsx b/packages/grafana-ui/src/utils/storybook/withTheme.tsx index 55fa6a8c36a..7f96740c218 100644 --- a/packages/grafana-ui/src/utils/storybook/withTheme.tsx +++ b/packages/grafana-ui/src/utils/storybook/withTheme.tsx @@ -10,7 +10,7 @@ const ThemeableStory: React.FunctionComponent<{ handleSassThemeChange: SassTheme children, handleSassThemeChange, }) => { - const theme = createTheme({ palette: { mode: useDarkMode() ? 'dark' : 'light' } }); + const theme = createTheme({ colors: { mode: useDarkMode() ? 'dark' : 'light' } }); handleSassThemeChange(theme); @@ -22,7 +22,7 @@ const ThemeableStory: React.FunctionComponent<{ handleSassThemeChange: SassTheme padding: '20px', display: 'flex', minHeight: '80vh', - background: `${theme.palette.background.primary}`, + background: `${theme.colors.background.primary}`, }} > diff --git a/public/app/core/components/PageHeader/PageHeader.tsx b/public/app/core/components/PageHeader/PageHeader.tsx index 505be848b2f..b98a03d996c 100644 --- a/public/app/core/components/PageHeader/PageHeader.tsx +++ b/public/app/core/components/PageHeader/PageHeader.tsx @@ -139,8 +139,8 @@ function renderTitle(title: string, breadcrumbs: NavModelBreadcrumb[]) { const getStyles = (theme: GrafanaThemeV2) => ({ headerCanvas: css` - background: ${theme.palette.background.canvas}; - border-bottom: 1px solid ${theme.palette.border.weak}; + background: ${theme.colors.background.canvas}; + border-bottom: 1px solid ${theme.colors.border.weak}; `, }); diff --git a/public/app/core/services/toggleTheme.ts b/public/app/core/services/toggleTheme.ts index bfbbf5c2730..7a2b5220fbc 100644 --- a/public/app/core/services/toggleTheme.ts +++ b/public/app/core/services/toggleTheme.ts @@ -8,7 +8,7 @@ import { createTheme } from '@grafana/data'; export async function toggleTheme(runtimeOnly: boolean) { const currentTheme = config.theme; const newTheme = createTheme({ - palette: { + colors: { mode: currentTheme.isDark ? 'light' : 'dark', }, }); @@ -22,7 +22,7 @@ export async function toggleTheme(runtimeOnly: boolean) { // Add css file for new theme const newCssLink = document.createElement('link'); newCssLink.rel = 'stylesheet'; - newCssLink.href = config.bootData.themePaths[newTheme.palette.mode]; + newCssLink.href = config.bootData.themePaths[newTheme.colors.mode]; document.body.appendChild(newCssLink); // Remove old css file @@ -48,6 +48,6 @@ export async function toggleTheme(runtimeOnly: boolean) { await service.update({ ...currentPref, - theme: newTheme.palette.mode, + theme: newTheme.colors.mode, }); } diff --git a/public/app/core/utils/ConfigProvider.tsx b/public/app/core/utils/ConfigProvider.tsx index 245bd898daf..fe35ba0adba 100644 --- a/public/app/core/utils/ConfigProvider.tsx +++ b/public/app/core/utils/ConfigProvider.tsx @@ -32,7 +32,7 @@ export const ThemeProvider = ({ children }: { children: React.ReactNode }) => { function getCurrentUserTheme() { return createTheme({ - palette: { + colors: { mode: config.bootData.user.lightTheme ? 'light' : 'dark', }, }); diff --git a/public/app/features/dashboard/components/PanelEditor/OptionsPaneCategory.tsx b/public/app/features/dashboard/components/PanelEditor/OptionsPaneCategory.tsx index d89df72fc4c..18920d95b62 100644 --- a/public/app/features/dashboard/components/PanelEditor/OptionsPaneCategory.tsx +++ b/public/app/features/dashboard/components/PanelEditor/OptionsPaneCategory.tsx @@ -89,7 +89,7 @@ export const OptionsPaneCategory: FC = React.memo( const getStyles = (theme: GrafanaThemeV2) => { return { box: css` - border-bottom: 1px solid ${theme.palette.border.weak}; + border-bottom: 1px solid ${theme.colors.border.weak}; &:last-child { border-bottom: none; } @@ -101,7 +101,7 @@ const getStyles = (theme: GrafanaThemeV2) => { margin-bottom: ${theme.spacing(2)}; `, toggle: css` - color: ${theme.palette.text.secondary}; + color: ${theme.colors.text.secondary}; margin-right: ${theme.spacing(1)}; `, title: css` @@ -113,15 +113,15 @@ const getStyles = (theme: GrafanaThemeV2) => { cursor: pointer; align-items: baseline; padding: ${theme.spacing(1)}; - color: ${theme.palette.text.primary}; + color: ${theme.colors.text.primary}; font-weight: ${theme.typography.fontWeightMedium}; &:hover { - background: ${theme.palette.emphasize(theme.palette.background.primary, 0.03)}; + background: ${theme.colors.emphasize(theme.colors.background.primary, 0.03)}; } `, headerExpanded: css` - color: ${theme.palette.text.primary}; + color: ${theme.colors.text.primary}; `, headerNested: css` padding: ${theme.spacing(0.5, 0, 0.5, 0)}; @@ -139,7 +139,7 @@ const getStyles = (theme: GrafanaThemeV2) => { left: 8px; width: 1px; height: 100%; - background: ${theme.palette.border.weak}; + background: ${theme.colors.border.weak}; } `, }; diff --git a/public/app/features/dashboard/components/PanelEditor/OptionsPaneOptions.tsx b/public/app/features/dashboard/components/PanelEditor/OptionsPaneOptions.tsx index 05ae26b2860..aae7da48d89 100644 --- a/public/app/features/dashboard/components/PanelEditor/OptionsPaneOptions.tsx +++ b/public/app/features/dashboard/components/PanelEditor/OptionsPaneOptions.tsx @@ -160,7 +160,7 @@ const getStyles = (theme: GrafanaThemeV2) => ({ `, formBox: css` padding: ${theme.spacing(1)}; - background: ${theme.palette.background.primary}; + background: ${theme.colors.background.primary}; border: 1px solid ${theme.components.panel.border}; border-bottom: none; `, @@ -176,12 +176,12 @@ const getStyles = (theme: GrafanaThemeV2) => ({ `, searchNotice: css` font-size: ${theme.typography.size.sm}; - color: ${theme.palette.text.secondary}; + color: ${theme.colors.text.secondary}; padding: ${theme.spacing(1)}; text-align: center; `, mainBox: css` - background: ${theme.palette.background.primary}; + background: ${theme.colors.background.primary}; border: 1px solid ${theme.components.panel.border}; border-top: none; flex-grow: 1; diff --git a/public/app/features/dashboard/components/PanelEditor/PanelEditorTabs.tsx b/public/app/features/dashboard/components/PanelEditor/PanelEditorTabs.tsx index 3ef2d0482df..e0871916dda 100644 --- a/public/app/features/dashboard/components/PanelEditor/PanelEditorTabs.tsx +++ b/public/app/features/dashboard/components/PanelEditor/PanelEditorTabs.tsx @@ -91,7 +91,7 @@ const getStyles = (theme: GrafanaThemeV2) => { flex-direction: column; flex-grow: 1; min-height: 0; - background: ${theme.palette.background.primary}; + background: ${theme.colors.background.primary}; border-right: 1px solid ${theme.components.panel.border}; `, }; diff --git a/public/app/features/dashboard/components/TransformationsEditor/TransformationsEditor.tsx b/public/app/features/dashboard/components/TransformationsEditor/TransformationsEditor.tsx index 9744dd768c4..6ea826c6de4 100644 --- a/public/app/features/dashboard/components/TransformationsEditor/TransformationsEditor.tsx +++ b/public/app/features/dashboard/components/TransformationsEditor/TransformationsEditor.tsx @@ -368,7 +368,7 @@ const TransformationCard: React.FC = (props) => { const getStyles = (theme: GrafanaThemeV2) => { return { card: css` - background: ${theme.palette.background.secondary}; + background: ${theme.colors.background.secondary}; width: 100%; border: none; padding: ${theme.spacing(1)}; @@ -379,7 +379,7 @@ const getStyles = (theme: GrafanaThemeV2) => { } &:hover { - background: ${theme.palette.action.hover}; + background: ${theme.colors.action.hover}; box-shadow: none; border: none; } diff --git a/public/app/features/dashboard/components/VersionHistory/DiffValues.tsx b/public/app/features/dashboard/components/VersionHistory/DiffValues.tsx index ad49c47061c..a3ca7cace20 100644 --- a/public/app/features/dashboard/components/VersionHistory/DiffValues.tsx +++ b/public/app/features/dashboard/components/VersionHistory/DiffValues.tsx @@ -25,9 +25,9 @@ export const DiffValues: React.FC = ({ diff }) => { }; const getStyles = (theme: GrafanaThemeV2) => css` - background-color: ${theme.palette.action.hover}; + background-color: ${theme.colors.action.hover}; border-radius: ${theme.shape.borderRadius()}; - color: ${theme.palette.text.primary}; + color: ${theme.colors.text.primary}; font-size: ${theme.typography.body.fontSize}; margin: 0 ${theme.spacing(0.5)}; padding: ${theme.spacing(0.5, 1)}; diff --git a/public/app/features/dashboard/components/VizTypePicker/PanelTypeCard.tsx b/public/app/features/dashboard/components/VizTypePicker/PanelTypeCard.tsx index 6b3388c295d..48f04cfe1e6 100644 --- a/public/app/features/dashboard/components/VizTypePicker/PanelTypeCard.tsx +++ b/public/app/features/dashboard/components/VizTypePicker/PanelTypeCard.tsx @@ -69,7 +69,7 @@ const getStyles = (theme: GrafanaThemeV2) => { display: flex; flex-shrink: 0; cursor: pointer; - background: ${theme.palette.background.secondary}; + background: ${theme.colors.background.secondary}; border-radius: ${theme.shape.borderRadius()}; box-shadow: ${theme.shadows.z0}; align-items: center; @@ -83,7 +83,7 @@ const getStyles = (theme: GrafanaThemeV2) => { })}; &:hover { - background: ${theme.palette.emphasize(theme.palette.background.secondary, 0.03)}; + background: ${theme.colors.emphasize(theme.colors.background.secondary, 0.03)}; } `, itemContent: css` @@ -92,7 +92,7 @@ const getStyles = (theme: GrafanaThemeV2) => { `, current: css` label: currentVisualizationItem; - border-color: ${theme.palette.primary.border}; + border-color: ${theme.colors.primary.border}; `, disabled: css` opacity: 0.2; @@ -116,7 +116,7 @@ const getStyles = (theme: GrafanaThemeV2) => { align-items: center; `, badge: css` - background: ${theme.palette.background.primary}; + background: ${theme.colors.background.primary}; `, }; }; diff --git a/public/app/features/users/TokenRevokedModal.tsx b/public/app/features/users/TokenRevokedModal.tsx index 0d8d88626be..1156cdf0d82 100644 --- a/public/app/features/users/TokenRevokedModal.tsx +++ b/public/app/features/users/TokenRevokedModal.tsx @@ -59,7 +59,7 @@ const getStyles = stylesFactory((theme: GrafanaThemeV2) => { margin: ${theme.spacing(1, 0, 2)}; `, backdrop: css` - background-color: ${theme.palette.background.canvas}; + background-color: ${theme.colors.background.canvas}; opacity: 0.8; `, }; diff --git a/scripts/cli/generateSassVariableFiles.ts b/scripts/cli/generateSassVariableFiles.ts index 69268b013b9..dad9c610e05 100644 --- a/scripts/cli/generateSassVariableFiles.ts +++ b/scripts/cli/generateSassVariableFiles.ts @@ -22,7 +22,7 @@ const writeVariablesFile = async (path: string, data: string) => { const generateSassVariableFiles = async () => { const darkTheme = createTheme(); - const lightTheme = createTheme({ palette: { mode: 'light' } }); + const lightTheme = createTheme({ colors: { mode: 'light' } }); try { await Promise.all([