-
Notifications
You must be signed in to change notification settings - Fork 979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Vis Colors] Update legacy seed colors to use ouiPaletteColorBlind()
#4348
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -32,8 +32,8 @@ import _ from 'lodash'; | |||||||
|
||||||||
import { CoreSetup } from 'opensearch-dashboards/public'; | ||||||||
|
||||||||
import { euiPaletteColorBlind } from '@elastic/eui'; | ||||||||
import { MappedColors } from './mapped_colors'; | ||||||||
import { seedColors } from './seed_colors'; | ||||||||
|
||||||||
/** | ||||||||
* Accepts an array of strings or numbers that are used to create a | ||||||||
|
@@ -44,7 +44,7 @@ import { seedColors } from './seed_colors'; | |||||||
export class ColorsService { | ||||||||
private _mappedColors?: MappedColors; | ||||||||
|
||||||||
public readonly seedColors = seedColors; | ||||||||
public readonly seedColors = euiPaletteColorBlind(); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we even need to provide this in the color service? Because consumers could also just get them directly from OUI. I suppose we can tackle that question once we do some of the other color refactoring and consolidation... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @manasvinibs Can we make a follow-up issue to deprecate this public API and refactor the only known usage of it:
and OpenSearch-Dashboards/src/plugins/vis_type_tagcloud/public/components/tag_cloud_visualization.js Line 61 in fc4e696
as documented in:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||
|
||||||||
public get mappedColors() { | ||||||||
if (!this._mappedColors) { | ||||||||
|
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -277,14 +277,14 @@ export default function ({ getService, getPageObjects }) { | |
|
||
await retry.try(async () => { | ||
const pieSliceStyle = await pieChart.getPieSliceStyle('80,000'); | ||
// The default green color that was stored with the visualization before any dashboard overrides. | ||
expect(pieSliceStyle.indexOf('rgb(87, 193, 123)')).to.be.greaterThan(0); | ||
// The default color that was stored with the visualization before any dashboard overrides. | ||
expect(pieSliceStyle.indexOf('rgb(84, 179, 153)')).to.be.greaterThan(0); | ||
}); | ||
}); | ||
|
||
it('resets the legend color as well', async function () { | ||
await retry.try(async () => { | ||
const colorExists = await PageObjects.visChart.doesSelectedLegendColorExist('#57c17b'); | ||
const colorExists = await PageObjects.visChart.doesSelectedLegendColorExist('#54B399'); | ||
Comment on lines
+280
to
+287
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @manasvinibs Can you open a follow-up issue to refactor/improve these tests to be less brittle? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh yes I already have the issue for that #4424 |
||
expect(colorExists).to.be(true); | ||
}); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole function (
createColorPalette
) may be able to be removed in favor of directly callingeuiPaletteColorBlind()
. The difference is that this function currently takes the desired number of colors as a param, whileeuiPaletteColorBlind
takes a number of rotations instead.So we can either:
createColorPalette
but have it return the firstnum
values ofeuiPaletteColorBlind()
with a sufficient number of rotations orcreateColorPalette
calleuiPaletteColorBlind()
with rotations instead of a total number of colorsI have a hunch it will be fairly quick to do 2, but am also fine with doing 1 in this PR, and 2 as a subsequent follow-up.
Don't take my word for it, but I think it's only called from
OpenSearch-Dashboards/src/plugins/charts/public/services/colors/mapped_colors.ts
Line 103 in 84ec854
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, let's just do the easy way for now, and do the larger refactoring as part of #4320
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree!
createColorPalette
method will be removed/refactored as part of #4320.