VizColors: Use more named colors in the classic palette (#107714)

* use more named colors in the classic palette

* update unit tests
This commit is contained in:
Ashley Harrison
2025-07-14 12:22:24 +01:00
committed by GitHub
parent 84a4ed612b
commit 9f76564f51
3 changed files with 23 additions and 15 deletions
@@ -47,7 +47,7 @@ describe('fieldColorModeRegistry', () => {
it('Palette classic with series index 1', () => {
const calcFn = getCalculator({ mode: FieldColorModeId.PaletteClassic, seriesIndex: 1, name: 'series2' });
expect(calcFn(70, 0, undefined)).toEqual('#F2CC0C');
expect(calcFn(70, 0, undefined)).toEqual('#FADE2A');
});
it('Palette uses name', () => {
@@ -113,8 +113,8 @@ describe('fieldColorModeRegistry', () => {
const calcFn1 = mode.getCalculator(frames[0].fields[1], createTheme());
const calcFn2 = mode.getCalculator(frames[1].fields[1], createTheme());
expect(calcFn1(0, 0)).toEqual('#82B5D8');
expect(calcFn2(0, 0)).toEqual('#FCE2DE');
expect(calcFn1(0, 0)).toEqual('#5195CE');
expect(calcFn2(0, 0)).toEqual('#37872D');
});
it('When color.seriesBy is set to last use that instead of v', () => {
@@ -388,7 +388,7 @@ describe('FieldDisplay', () => {
const result = getFieldDisplayValues(options);
expect(result[0].display.color).toEqual('#73BF69');
expect(result[1].display.color).toEqual('#F2CC0C');
expect(result[1].display.color).toEqual('#FADE2A');
});
it('When showing all values lookup color via an override', () => {
@@ -435,7 +435,7 @@ describe('FieldDisplay', () => {
const result = getFieldDisplayValues(options);
expect(result[0].display.color).toEqual('#AAA');
expect(result[1].display.color).toEqual('#F2CC0C');
expect(result[1].display.color).toEqual('#FADE2A');
});
it('Multiple other string fields', () => {
@@ -260,16 +260,24 @@ function getClassicPalette() {
// Todo replace these with named colors (as many as possible)
return [
'green', // '#7EB26D', // 0: pale green
'semi-dark-yellow', // '#EAB839', // 1: mustard
'light-blue', // #6ED0E0', // 2: light blue
'semi-dark-orange', // '#EF843C', // 3: orange
'red', // '#E24D42', // 4: red
'blue', // #1F78C1', // 5: ocean
'purple', // '#BA43A9', // 6: purple
'#705DA0', // 7: violet
'dark-green', // '#508642', // 8: dark green
'yellow', //'#CCA300', // 9: dark sand
'green',
'yellow',
'blue',
'orange',
'red',
'purple',
'dark-green',
'dark-yellow',
'dark-blue',
'dark-orange',
'dark-red',
'dark-purple',
'super-light-green',
'super-light-yellow',
'super-light-blue',
'super-light-orange',
'super-light-red',
'super-light-purple',
'#447EBC',
'#C15C17',
'#890F02',