Studio Code: prefer the theme color palette over hardcoded colors - #3871
Merged
Conversation
Guide the agent to color sections from the active theme's color palette (palette slugs or var(--wp--preset--color--*)) instead of inventing custom hex values, and add an eval that guards the behavior. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
youknowriad
commented
Jun 17, 2026
youknowriad
commented
Jun 17, 2026
youknowriad
commented
Jun 17, 2026
youknowriad
commented
Jun 17, 2026
…rules - block-content: "prefer palette over hex" instead of "never hardcode hex"; custom hex stays available for deliberate one-offs - system-prompt: remove the local palette additions now that the loaded block-content/visual-design skills carry the guidance; keep the remote content bullet since the remote path loads neither skill Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
lezama
approved these changes
Jun 17, 2026
Collaborator
📊 Performance Test ResultsComparing 72c33ef vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
sejas
reviewed
Jun 17, 2026
sejas
left a comment
Member
There was a problem hiding this comment.
Thanks for improving the generation of color vars and adding a promptfoo 🙏!
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.
Related issues
This is based on user feedback.
How AI was used in this PR
Authored with Claude Code. The agent investigated how Studio Code is instructed around color, wrote a failing eval, made the prompt/skill changes, and verified the before/after by running the eval end-to-end against the real agent (WordPress.com AI proxy). All changes were reviewed by the author.
Proposed Changes
When asked to add sections or build sites, Studio Code often invented custom hex colors instead of using the site theme's existing color palette. That detaches the result from Global Styles, theme switching, and light/dark variations, and tends to look off-brand.
This change makes palette-first the default behavior:
{"backgroundColor":"accent-1","textColor":"base"}orvar(--wp--preset--color--*)in CSS — rather than hardcoding hex.theme.jsonand reference it everywhere; when editing a site that already has a theme, inherit its palette.It also fixes a skeleton-CSS example in the
block-contentskill that previously taught hardcoded#ffffff/#111111custom properties, and adds an eval (section-uses-theme-palette) that guards the behavior.User impact: sections the agent adds stay consistent with the theme, respond to Global Styles edits, and adapt to theme/color-scheme changes — without constraining genuinely needed custom colors.
Testing Instructions
Requires Node ≥22 with npm 11 (e.g.
nvm use 24).Run the new eval case (from the eval config dir, since the provider path is relative):
Verified before/after against real agent runs:
#2d3a8c,#ffffff,#c7d0f8, …) and zero palette references.{"backgroundColor":"accent-3","textColor":"base"},{"backgroundColor":"accent-1","textColor":"contrast"}) with no hardcoded hex.To compare manually,
git stashthe three prompt/skill files, rebuild, and re-run the case to see it fail, then restore and re-run to see it pass.Pre-merge Checklist
npm run typecheckpass)