-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Styles: Allow using “refs” in the UI for colors #49279
Comments
I'm marking this as needs development but could be off base here :) Feel free to correct. |
It'd be interesting if the site's Then when you apply that color to a block, it's the ref value that is assigned. |
@scruffian Do you know of an effort to have ref values within block attributes, similar to how |
No. The problem would be, how would you determine whether the intention is to use a shared variable or a ref? Thinking about this another way, ref's can replace variables, if we think that's a better approach... |
Yes, I was thinking you would choose the background color and it is added as a ref. For example, patterns could use the ref value of the background/text colors — instead of vars. Are we on the same page, or are you thinking something else? |
Yeah that makes sense, but that would be a big change to the system - would we always use refs going forward? What if two blocks use the same color, which one would we take as the ref? |
I think it'd work in addition to what we have today. The And when you select one of those colors, say
And if I change the site's background color in Global Styles, I'd expect anywhere the ref background color is used to change as well. This would eliminate the need for declaring a "base" and "contrast" color (or any other variation of those two) and allow themes (and patterns in the directory) to be more consistent on that front. |
To Illustrate the concept, something like this perhaps:
or |
How would this overlap with the idea of colour sets? Seems they are solving similar issues, except colour sets enforce contrast by packaging colours (e.g. background and text). |
I don't think these relate entirely to color sets, but those could be comprised of ref color values. I.e. one color set would be the |
This would be a powerful tool to reduce the misuse of named color palettes as semantic tokens and builds on the work previously done to implement the use of refs in theme.json #41696
Pulled from #48443
The text was updated successfully, but these errors were encountered: