diff --git a/packages/eui/changelogs/upcoming/8844.md b/packages/eui/changelogs/upcoming/8844.md new file mode 100644 index 00000000000..72063c92367 --- /dev/null +++ b/packages/eui/changelogs/upcoming/8844.md @@ -0,0 +1,4 @@ +**Bug fixes** + +- Fixed wrong initialization options on `EUI_VIS_COLOR_STORE` which resulted in partially wrong initial color values for static `euiPalette{name}` functions (e.g. `euiPaletteForTemperature`) + diff --git a/packages/eui/src/services/color/eui_palettes.test.ts b/packages/eui/src/services/color/eui_palettes.test.ts index f87214e1a3e..6e91475deab 100644 --- a/packages/eui/src/services/color/eui_palettes.test.ts +++ b/packages/eui/src/services/color/eui_palettes.test.ts @@ -93,6 +93,13 @@ describe('euiPaletteForDarkBackground', () => { }); describe('euiPaletteForStatus', () => { + it('should return correct colors', () => { + const colors = colorVis; + const resultLong = euiPaletteForStatus(6, { colors }); + + expect(resultLong[2]).toEqual('#c8e3b8'); + }); + it('should return custom colors', () => { const customColor = '#00ff00'; const colors = { @@ -107,6 +114,13 @@ describe('euiPaletteForStatus', () => { }); describe('euiPaletteForTemperature', () => { + it('should return correct colors', () => { + const colors = colorVis; + const resultLong = euiPaletteForTemperature(6, { colors }); + + expect(resultLong[2]).toEqual('#e8f1ff'); + }); + it('should return custom colors', () => { const customColor = '#00ff00'; const colors = { @@ -121,6 +135,13 @@ describe('euiPaletteForTemperature', () => { }); describe('euiPaletteComplementary', () => { + it('should return correct colors', () => { + const colors = colorVis; + const resultLong = euiPaletteComplementary(6, { colors }); + + expect(resultLong[2]).toEqual('#c4dcfd'); + }); + it('should return custom colors', () => { const customColor = '#00ff00'; const colors = { @@ -135,6 +156,13 @@ describe('euiPaletteComplementary', () => { }); describe('euiPaletteRed', () => { + it('should return correct colors', () => { + const colors = colorVis; + const resultLong = euiPaletteRed(6, { colors }); + + expect(resultLong[2]).toEqual('#feb7b0'); + }); + it('should return custom colors', () => { const customColor = '#00ff00'; const colors = { @@ -149,6 +177,13 @@ describe('euiPaletteRed', () => { }); describe('euiPaletteGreen', () => { + it('should return correct colors', () => { + const colors = colorVis; + const resultLong = euiPaletteGreen(6, { colors }); + + expect(resultLong[2]).toEqual('#9fdfc6'); + }); + it('should return custom colors', () => { const customColor = '#00ff00'; const colors = { @@ -163,6 +198,13 @@ describe('euiPaletteGreen', () => { }); describe('euiPaletteSkyBlue', () => { + it('should return correct colors', () => { + const colors = colorVis; + const resultLong = euiPaletteSkyBlue(6, { colors }); + + expect(resultLong[2]).toEqual('#a6d8ec'); + }); + it('should return custom colors', () => { const customColor = '#00ff00'; const colors = { @@ -177,6 +219,13 @@ describe('euiPaletteSkyBlue', () => { }); describe('euiPaletteYellow', () => { + it('should return correct colors', () => { + const colors = colorVis; + const resultLong = euiPaletteYellow(6, { colors }); + + expect(resultLong[2]).toEqual('#f9d290'); + }); + it('should return custom colors', () => { const customColor = '#00ff00'; const colors = { @@ -191,6 +240,13 @@ describe('euiPaletteYellow', () => { }); describe('euiPaletteOrange', () => { + it('should return correct colors', () => { + const colors = colorVis; + const resultLong = euiPaletteOrange(6, { colors }); + + expect(resultLong[2]).toEqual('#ffc1a1'); + }); + it('should return custom colors', () => { const customColor = '#00ff00'; const colors = { @@ -205,6 +261,13 @@ describe('euiPaletteOrange', () => { }); describe('euiPaletteCool', () => { + it('should return correct colors', () => { + const colors = colorVis; + const resultLong = euiPaletteCool(6, { colors }); + + expect(resultLong[2]).toEqual('#a8caff'); + }); + it('should return custom colors', () => { const customColor = '#00ff00'; const colors = { @@ -219,6 +282,13 @@ describe('euiPaletteCool', () => { }); describe('euiPaletteWarm', () => { + it('should return correct colors', () => { + const colors = colorVis; + const resultLong = euiPaletteWarm(6, { colors }); + + expect(resultLong[2]).toEqual('#ffafa6'); + }); + it('should return custom colors', () => { const customColor = '#00ff00'; const colors = { @@ -233,6 +303,13 @@ describe('euiPaletteWarm', () => { }); describe('euiPaletteGray', () => { + it('should return correct colors', () => { + const colors = colorVis; + const resultLong = euiPaletteGray(6, { colors }); + + expect(resultLong[2]).toEqual('#7b8aa4'); + }); + it('should return custom colors', () => { const customColor = '#00ff00'; const colors = { diff --git a/packages/eui/src/services/color/vis_color_store.ts b/packages/eui/src/services/color/vis_color_store.ts index f5dfb1ebb31..732022d8c9d 100644 --- a/packages/eui/src/services/color/vis_color_store.ts +++ b/packages/eui/src/services/color/vis_color_store.ts @@ -11,4 +11,4 @@ import { colorVis } from '@elastic/eui-theme-borealis'; // initialsetup of Vis color storage with default colors export const EUI_VIS_COLOR_STORE: _EuiVisColorStore = - EuiVisColorStore.getInstance(colorVis, true); + EuiVisColorStore.getInstance(colorVis, false);