Convert theme color slugs to CSS variables instead of resolving to hex#2743
Merged
vytisbulkevicius merged 25 commits intodevelopmentfrom Apr 1, 2026
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix color slugs not working in Otter Blocks
Resolve color slugs from theme.json in Otter blocks
Feb 16, 2026
Contributor
|
@copilot apply the fix to all blocks that uses attributes for colors. |
Contributor
Author
Applied the color slug resolution fix to all 15 blocks with color attributes: Commits:
Pattern applied:
All blocks now properly resolve theme color slugs from theme.json while remaining backward compatible with hex/rgb/hsl values. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Copilot
AI
changed the title
Resolve color slugs from theme.json in Otter blocks
Resolve color slugs from theme.json in all Otter blocks
Feb 16, 2026
Contributor
Bundle Size Diff
|
Contributor
|
Plugin build for dda1c64 is ready 🛎️!
|
Copilot
AI
changed the title
Resolve color slugs from theme.json in all Otter blocks
Convert color slugs to CSS variables to preserve theme.json connection
Feb 19, 2026
Copilot
AI
changed the title
Convert color slugs to CSS variables to preserve theme.json connection
Remove leftover color-slug-resolution.md documentation file
Feb 19, 2026
Copilot
AI
changed the title
Remove leftover color-slug-resolution.md documentation file
Fix JSDoc alignment error in color helper function
Feb 19, 2026
Copilot
AI
changed the title
Fix JSDoc alignment error in color helper function
Fix useDarkBackground hook to resolve color slugs before lightness check
Feb 19, 2026
Copilot
AI
changed the title
Fix useDarkBackground hook to resolve color slugs before lightness check
Fix type safety and environment compatibility in color resolution functions
Feb 19, 2026
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
…-icons, popup, and flip blocks - circle-counter: Added useColorResolver hook and wrapped color attributes in edit.js and CircularProgressBar component; added color resolution in CSS for backgroundColor, progressColor, and titleColor - countdown: Added color resolution in CSS for backgroundColor, borderColor, valueColor, labelColor, and separatorColor - sharing-icons: Added color resolution in CSS for icon backgroundColor and textColor - popup: Added useColorResolver hook and wrapped color attributes in edit.js; added color resolution in CSS for backgroundColor, closeColor, overlayColor, and borderColor - flip: Added color resolution in CSS for borderColor, frontBackgroundColor, backBackgroundColor, titleColor, and descriptionColor All changes follow the pattern of using useColorResolver() in edit.js and Base_CSS::resolve_color_value() in PHP CSS files to properly handle theme color slugs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… icons, posts, review, progress-bar) Co-authored-by: selul <3330746+selul@users.noreply.github.com>
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
…functions Co-authored-by: selul <3330746+selul@users.noreply.github.com>
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
4ec805b to
dda1c64
Compare
Contributor
E2E TestsPlaywright Test Status: Performance ResultsserverResponse: {"q25":427.1,"q50":429.05,"q75":462.5,"cnt":10}, firstPaint: {"q25":363.9,"q50":420.75,"q75":450.7,"cnt":10}, domContentLoaded: {"q25":1582.7,"q50":1605.7,"q75":1645.7,"cnt":10}, loaded: {"q25":1583,"q50":1606.05,"q75":1646,"cnt":10}, firstContentfulPaint: {"q25":3347.5,"q50":3367.2,"q75":3450.1,"cnt":10}, firstBlock: {"q25":6860.9,"q50":7029.65,"q75":7180.2,"cnt":10}, type: {"q25":12.83,"q50":13.61,"q75":14,"cnt":10}, typeWithoutInspector: {"q25":11.9,"q50":12.29,"q75":12.83,"cnt":10}, typeWithTopToolbar: {"q25":15.79,"q50":16.82,"q75":18.64,"cnt":10}, typeContainer: {"q25":6.94,"q50":8.85,"q75":10.27,"cnt":10}, focus: {"q25":52.02,"q50":56.27,"q75":61.17,"cnt":10}, inserterOpen: {"q25":16.67,"q50":17.72,"q75":18.26,"cnt":10}, inserterSearch: {"q25":5.73,"q50":5.91,"q75":6.01,"cnt":10}, inserterHover: {"q25":2.41,"q50":2.51,"q75":2.85,"cnt":20}, loadPatterns: {"q25":1098.08,"q50":1116.54,"q75":1154.28,"cnt":10}, listViewOpen: {"q25":86.23,"q50":90.72,"q75":100.76,"cnt":10} |
Contributor
|
🎉 This PR is included in version 3.1.8 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Otter blocks were not handling theme.json color slugs, causing them to revert to defaults. Core WordPress blocks convert slugs to CSS variable references that remain connected to theme settings.
Changes
Utility functions
getColorCSSVariable(slug)- converts"primary"→"var(--wp--preset--color--primary)"useColorResolver()hook returning the converterBase_CSS::get_color_css_variable()andresolve_color_value()Block updates
Applied color resolution to 15 blocks: accordion, tabs, advanced-heading, button, section, posts, review, progress-bar, circle-counter, countdown, sharing-icons, popup, flip, font-awesome-icons, lottie
Unit tests
Added 13 tests covering slug conversion, passthrough of hex/rgb/hsl values, and edge cases
Technical approach
WordPress generates CSS variables from theme.json. By referencing these variables instead of storing resolved color values, blocks automatically reflect theme color changes without re-saving.
Hex/RGB/HSL values and existing CSS variables pass through unchanged (backward compatible).
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.