-
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
Components: Expand theming support in COLORS #58097
Conversation
}; | ||
|
||
export const COLORS = Object.freeze( { | ||
/** | ||
* The main gray color object. | ||
* | ||
* @deprecated Use semantic aliases in `COLORS.ui` or theme-ready variables in `COLORS.theme.gray`. |
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.
This deprecation marking should encourage devs to stop using this while we migrate the existing usages.
Size Change: +127 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
Flaky tests detected in 1076842. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7618600938
|
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 exciting to see some CSS-in-JS-based components starting to follow theme variables!
borderHover: THEME.gray[ 700 ], | ||
borderFocus: THEME.accent, | ||
borderDisabled: THEME.gray[ 400 ], | ||
textDisabled: THEME.gray[ 600 ], |
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.
Should we add a text
alias under UI ? Currently components would be forced to use theme.foreground
instead.
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'm actually kind of reluctant to add a ton of semantic aliases for the pretty obvious ones like foreground
, background
, and accent
because it adds more overhead when reworking and renaming stuff. I do think the aliases for the grayscales are useful because nobody memorizes them and it's easy to introduce inconsistencies. Does that resonate?
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.
My original reasoning behind proposing text
was mostly so that folks can continue to use "semantic" color aliases to style their components, instead of mixing them with "raw" theme values. But if we're ok with folks using both COLORS.ui.*
and COLORS.theme.*
, then we can keep things as-is and only adjust later / if needed, especially if the long term plan is to move theming functionality to a separate package.
I'll leave this here with a deprecation marking, just to inform people that they should be using `foreground` when they try and reach for gray-900.
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.
🚀
*/ | ||
gray: GRAY, | ||
gray: GRAY, // TODO: Stop exporting this when everything is migrated to `theme` or `ui` |
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.
Do we have a tracking issue for all the planned work that we intend to do around theming in the short term?
Edit: yes, we do! It's #44116. We could probably tidy that issue up, knowing that in the long term the Theme
component in @wordpress/components
will be removed and replaced by functionality from @wordpress/theme
.
…zy-hydration * origin/trunk: (47 commits) Interactivity API: Break up long hydration task in interactivity init (#58227) Add supports.interactivity to Query block (#58316) Font Library: Make notices more consistent (#58180) Fix Global styles text settings bleeding into placeholder component (#58303) Fix the position and size of the Options menu, (#57515) DataViews: Fix safari grid row height issue (#58302) Try a fix (#58282) Navigation Submenu Block: Make block name affect list view (#58296) Apply custom scroll style to fixed header block toolbar (#57444) Add support for transform and letter spacing controls in Global Styles > Typography > Elements (#58142) DataViews: Fix table view cell wrapper and BlockPreviews (#58062) Workflows: Add 'Technical Prototype' to the type-related labels list (#58163) Block Editor: Optimize the 'useBlockDisplayTitle' hook (#58250) Remove noahtallen from .wp-env codeowners (#58283) Global styles revisions: fix is-selected rules from affecting other areas of the editor (#58228) Try: Disable text selection for post content placeholder block. (#58169) Remove `template-only` mode from editor and edit-post packages (#57700) Refactored download/upload logic to support font faces with multiple src assets (#58216) Components: Expand theming support in COLORS (#58097) Implementing new UX for invoking rich text Link UI (#57986) ...
Part of #44116
What?
Improves support for component theming in the
COLORS
object.Why?
To move toward wider support for component theming via the
Theme
component.Testing Instructions
This shouldn't cause any visual changes, except when using
<Theme>
with any components that use variables fromCOLORS.ui
.