Fix type safety and environment compatibility in color resolution functions#2743
Open
Copilot wants to merge 16 commits intodevelopmentfrom
Open
Fix type safety and environment compatibility in color resolution functions#2743Copilot wants to merge 16 commits intodevelopmentfrom
Copilot wants to merge 16 commits intodevelopmentfrom
Conversation
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>
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. |
…-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>
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 ef3f897 is ready 🛎️!
|
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>
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
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
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
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
Copilot
AI
changed the title
Remove leftover color-slug-resolution.md documentation file
Fix JSDoc alignment error in color helper function
Feb 19, 2026
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
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
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.
Color slug resolution functions failed in test environments and crashed on non-string inputs. Tests were failing due to missing type guards and environment checks.
Changes
Type safety in
getColorCSSVariable: Added string type check before calling.startsWith()to handlefalse,null, and other non-string values passed from conditional expressionsEnvironment detection in
lightnessFromColor: GuardgetComputedStyleaccess withtypeof document !== 'undefined'check for Node.js test environmentsNull safety in color parsing: Validate
value.match(/\d+/g)result before destructuring to prevent crashes on malformed color stringsThe fixes enable
useDarkBackgroundto safely receive boolean expressions like'color' === backgroundType && backgroundColorwithout crashes.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.