Skip to content

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

Merged
merged 9 commits into from
Sep 19, 2023

Conversation

Inbal-Tish
Copy link
Collaborator

Description

Colors - generate palette - pass options object

Changelog

Colors - generate palette - pass options object

Additional info

@Inbal-Tish Inbal-Tish marked this pull request as draft September 6, 2023 12:19
@Inbal-Tish Inbal-Tish marked this pull request as ready for review September 18, 2023 10:15
Copy link
Collaborator

@ethanshar ethanshar left a 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

@@ -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;
Copy link
Collaborator

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

Copy link
Collaborator Author

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?

Copy link
Collaborator

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

export type PaletteOptions = {
lightnessFix?: boolean;
saturationFix?: boolean;
darkModeColors?: boolean;
Copy link
Collaborator

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

Copy link
Collaborator Author

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'?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better, maybe addDarkestTints

@Inbal-Tish Inbal-Tish merged commit 3ef9772 into master Sep 19, 2023
@Inbal-Tish Inbal-Tish deleted the infra/Colors_generate_palette branch September 20, 2023 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants