-
Notifications
You must be signed in to change notification settings - Fork 734
Colors - generate palette - pass options object #2734
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
Conversation
…a/Colors_generate_palette
…a/Colors_generate_palette
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.
Wrote mostly naming comments and ideas on how to improve the API and make it more generic
src/style/colors.ts
Outdated
@@ -15,7 +15,11 @@ export type DesignToken = {semantic?: [string]; resource_paths?: [string]; toStr | |||
export type TokensOptions = {primaryColor: string}; | |||
export type GetColorTintOptions = {avoidReverseOnDark?: boolean}; | |||
export type GetColorByHexOptions = {validColors?: string[]}; | |||
|
|||
export type PaletteOptions = { | |||
lightnessFix?: boolean; |
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.
Maybe make this option more generic and instead of passing lightnessFix
as boolean you can have a lightnessThreshold
option where you can pass the actual threshold value you want.
This way you easily control it from the outside without changing the source code each time
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.
It's not going to be as easy as passing a lightnessThreshold since the fix only applies if it meets a set range. The user will have to adjust the range and pass the value to adjust to. The boolean is about whethere I apply this range check or not. Maybe rename it adjustLightness?
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.
ok, let's go with adjustLightness
src/style/colors.ts
Outdated
export type PaletteOptions = { | ||
lightnessFix?: boolean; | ||
saturationFix?: boolean; | ||
darkModeColors?: boolean; |
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.
The options is not very clear and doesn't sound like a boolean option.
Maybe rename to something like forDarkModeColors
I would also consider adding a short comment description about each option, so it will appear in the typings info
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.
Added comments. How about renaming to 'addDarkestColors'?
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.
Much better, maybe addDarkestTints
Description
Colors - generate palette - pass options object
Changelog
Colors - generate palette - pass options object
Additional info