-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[theme] Make theme.palette.augmentColor() pure #13899
Conversation
It looks like there are a couple places in the docs that use augmentColor relying on the mutation. I'll fix this shortly. |
@ryancogswell Sure, I'm adding some new warnings in the meantime. |
I guess I slightly prefer |
@ryancogswell Thanks for the feedback. |
I would define:
But the spec clearly says the Honestly I think this is just not worth it. Palette is simply a synonym for a "collection of colors" (see https://en.oxforddictionaries.com/definition/palette 1.3 (in computer graphics)) so all this change does is add migration workload. I suspect this is motivated by DX since it's easier to type (palette vs. pallete vs. pallette) but this has a workaround: just™ use a statically typed language 😛 Color might have the same drawback (color vs colour). |
@eps1lon Thank you for the feedback too. My concern is primarily with matching what people are already used to. Looking at a wide range of UI libraries, I rarely see the term "palette" being used. Most of the time, they are using "colors" (US). From this observation, I conclude that we can ease the adoption of the library by using the colors wording. colors is 1 letter shorter too but I doubt it will make any difference. It's kind of the same tradeoff we are facing at work with SEO, we have millions of pages indexed under a nonideal pathname. Does it worth it to change the URL introducing redirects and losing ranking during the transition? |
@oliviertassinari What bug does this change address? Or do you consider the mutation a bug? |
@eps1lon I'm removing the bug label. |
I suspect the bug label was related to my comment on the issue this closed: #12390 (comment) |
Sorry, missed this first time around. I don't have a strong opinion on it, but as breaking changes go, it would be a relatively minor one for existing users to have accommodate. Is it enough benefit to be worth it? I don't know. |
Hi all, |
@nthgol It's planned for v4. |
@oliviertassinari using |
Let's merge this for now, and we can consider the palette / color question separately for v4. |
This change avoids mutating the
color
argument to augmentColor. Includes the corresponding typescript change to indicate return type for augmentColor and test coverage of the typescript and code changes.Closes #12390
Breaking change
The
theme.palette.augmentColor()
method do no longer perform a side effect on its input color.In order to use it correctly, you have to use the output of this function.