-
Notifications
You must be signed in to change notification settings - Fork 116
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
frontend: add and use charts colors #2926
Conversation
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.
I think this will need to be handled slightly differently but good initial work overall!
@@ -173,6 +173,23 @@ export const DARK_COLORS: ClutchColors = { | |||
}, | |||
}; | |||
|
|||
export const clutchChartColors: string[] = [ |
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.
Hmm, I wonder if we should be a little more descriptive with how we approach this. If we're to support multiple themes then this will likely not work well as it is very static. Also it should probably be a child of colors
so it will inherit the variant that is passed down. Then also, what would we do if we wanted to hold different colors based on the chart/type etc?
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.
Adjusted the charts colors prop to be under colors
, so it'll look like
interface ChartColors {
common: string[];
}
export interface ClutchColors {
neutral: Color;
blue: Color;
green: Color;
amber: Color;
red: Color;
charts: ChartColors;
}
commons
felt right since the colors collection could be used by multiple charts. Having charts, with a different structure, within ClutchColors seems a bit odd though, wdyt?
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.
So one structure we could utilize is:
charts: {
data: [],
pie: {},
graph: {},
}
This way we have the common data
colors that all charts will likely use and then in the future we have the capability of subbing the type of charts with further data.
common
feels like it could work but the word intones that these are all common colors shared across and therefore would likely have children of its own, such as common.data
.
So I think we can utilize what I mentioned above as:
charts: {
common: {
data: []
},
pie: {},
graph: {},
}
This way it allows us to add further common
variables in the future if we need to.
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.
Sadly I don't know 'what' we'll need in the future, so this is just preparation to make sure we can support it :)
This PR has been marked as stale after 7 or more days of inactivity. Please have a maintainer add the |
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.
Looks good
This PR adds the color palette to be used in charts and updates current usages with references to the theme. A new property was added to the theme object:
chartColors
, to hold an static array of colors.Added default colors to the
theme.colors
object for thePie
andLinearTimeline
components,TimeseriesChart
does not use default colors, but their stories now use colors fromtheme
.Changed components:
Linear Timeline
before
after
Custom styled
before
after
Pie Chart
Chart now uses colors from theme
Changed labels to get colors from palette
before
after
TimeseriesChart
before
after
before
after
Testing Performed
manual, unit tests