Repository navigation
Storybook: Use the modern admin color scheme (blueberry) by default - #52849
adamwoodnz merged 5 commits into
Conversation
The block-editor and block-library stylesheets load after @wordpress/components and set --wp-admin-theme-color to the legacy #007cba on :root, overriding the #3858e9 that components sets. Stories then render in a scheme few wp-admin users see. Charts are affected most: their first series color reads this variable, so every chart story showed the wrong palette. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P6pdsb2opCsCz4AxKEoRfC
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P6pdsb2opCsCz4AxKEoRfC
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
…ports The :root rule ties on specificity with the imported block styles, so moving it above them silently brings back #007cba. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P6pdsb2opCsCz4AxKEoRfC
This comment was marked as resolved.
This comment was marked as resolved.
|
Review cycle summary
Status: clean. Ready for human review. |
The decorator comment said that, with no scheme set, the admin color is the ThemeProvider's accent. That held only for the custom theme. Every other story read Storybook's :root value, which is why they rendered in #007cba. The scheme list comment named a `default` scheme that WordPress 7.0 replaced with `modern`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P6pdsb2opCsCz4AxKEoRfC
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
Nikschavan
left a comment
There was a problem hiding this comment.
Thank you, the changes look good.
What I checked: I ran Storybook from this branch and opened Bar Chart › Default. The first bar paints #3858e9. All six --wp-admin-theme-color* variables on :root match the body.admin-color-modern values in admin-schemes.css. Setting adminColorScheme to ocean gives #567958. The custom theme with a #1b0940 accent paints the accent, and with ocean set as well the scheme wins.
tbradsha
left a comment
There was a problem hiding this comment.
From a code standpoint this looks fine. That said, has this change been proposed upstream as well so this override isn't stuck forever?
| // block-editor and block-library reset the admin color to the legacy #007cba. | ||
| // Keep this after the imports: equal specificity, so source order decides. | ||
| :root { | ||
|
|
||
| @include mixins.admin-scheme(#3858e9); | ||
| } |
There was a problem hiding this comment.
If we're adding an override, we should probably add to the comment that this can be removed when the libraries are updated to the modern default (and bonus if it includes a link to the upstream PR).
There was a problem hiding this comment.
Good call, done in 476e991. The comment now says to remove the override once @wordpress/base-styles ships the modern default, and links the upstream PR.
No upstream ticket existed, so I opened WordPress/gutenberg#83748 and a draft fix, WordPress/gutenberg#83749. The legacy blue comes from base-styles/_default-custom-properties.scss, which still sets admin-scheme(#007cba) on :root. block-library, block-editor and most other packages include it. Only @wordpress/components moved to #3858e9 (WordPress/gutenberg#50193), and WordPress 7.0 then made Modern the core default (Trac #64546) without anyone updating the shared default.
The override only exists because @wordpress/base-styles still defaults to #007cba. Naming the Gutenberg PR tells a future reader when it is safe to delete. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P6pdsb2opCsCz4AxKEoRfC
476e991

Fixes https://linear.app/a8c/issue/CHARTS-285
Why
Stories render with the old
#007cbablue as the admin accent. Since WordPress 7.0, wp-admin's default is the modern scheme's blueberry (#3858e9), and existing users were moved to it on upgrade (Trac #64546). Jetpack requires 7.0 or later, so every supported site defaults to blueberry, and stories do not look like the product. Charts show this most, because their first series color comes from the admin accent. Every chart story showed a palette that most users never see.Proposed changes
--wp-admin-theme-color*variables on:rootto the modern scheme with@wordpress/base-styles'admin-scheme()mixin, after the WordPress package imports.@wordpress/componentssets#3858e9, but@wordpress/block-editorand@wordpress/block-libraryload later and reset it to#007cbaon:root.:root. Examples: the chartsadminColorSchemecontrol, and aThemeProviderwith a color seed, such as the chartscustomtheme.ThemeProvideraccent (true only for thecustomtheme). The other named adefaultscheme that WordPress 7.0 replaced withmodern. No code in charts compensated for#007cba, so there is nothing to remove.Screenshots
Charts › Bar Chart › Default.
#007cba)#3858e9)Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
pnpm --dir projects/js-packages/storybook storybook:devand open Charts › Bar Chart › Default.#3858e9), not#007cba. In DevTools,getComputedStyle(document.documentElement).getPropertyValue('--wp-admin-theme-color')must return#3858e9.adminColorSchemecontrol toocean. The series must change to#567958.adminColorSchemeback tonone, then setthemeNametocustom. The series must follow theaccentColorcontrol. When a scheme is set, it wins over the accent. This is intended: the scheme is set on a closer wrapper.Verified locally:
:rootand.a8c-charts-scoperesolve#3858e9, and the pie's first slice paints#3858e9.adminColorScheme: ocean: the scope resolves#567958.themeName: customwithaccentColor: #1b0940: the first bar paints#1b0940withadminColorScheme: none, and#567958withadminColorScheme: ocean.pnpm run lint-stylepasses on the changed file.🤖 Generated with Claude Code
https://claude.ai/code/session_01P6pdsb2opCsCz4AxKEoRfC