Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Correct Storybook comments about the default admin color scheme.


5 changes: 2 additions & 3 deletions projects/js-packages/charts/src/stories/chart-decorator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ const isValidHexColor = ( color: string ): boolean => {
*
* One declaration, and it is the same one WordPress makes: `admin-schemes.css` sets
* `--wp-admin-theme-color` on `body.admin-color-<scheme>`. The palette's slot 1 names that
* variable first, so this is enough to exercise the whole path Storybook otherwise cannot —
* every story renders a `ThemeProvider`, and without a scheme set the admin color it publishes
* is whatever the provider's accent is.
* variable first, so this is enough to exercise the whole path. Without a scheme, the value is
* the custom theme's accent (which `ThemeProvider` publishes) or else Storybook's `:root` default.
*
* @param scheme - A key of `WP_ADMIN_COLOR_SCHEMES`, or `NO_ADMIN_COLOR_SCHEME`.
* @return The wrapper's inline custom property, or undefined to leave the page as it is.
Expand Down
4 changes: 2 additions & 2 deletions projects/js-packages/charts/src/stories/theme-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ export const mixedColorFormatRoles: Record< string, string > = {
* The `--wp-admin-theme-color` each WordPress admin color scheme publishes, copied from
* `@wordpress/base-styles`' `admin-schemes.css`.
*
* `fresh` and `default` have no `admin-color-*` block of their own and take the `:root` value,
* so they are absent here rather than duplicated.
* `fresh` has no `admin-color-*` block of its own and takes the host's `:root` value, so it is
* absent here. `modern` is the WordPress default since 7.0.
*/
export const WP_ADMIN_COLOR_SCHEMES: Record< string, string > = {
light: '#007cba',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Use the modern WordPress admin color scheme (blueberry) as the default admin theme color in stories.
10 changes: 10 additions & 0 deletions projects/js-packages/storybook/storybook/style.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
// Root variables from js-packages base styles
@use "../../base-styles/root-variables";
@use "@wordpress/base-styles/mixins";

// @wordpress package styles
@import "@wordpress/components/build-style/style.css";
@import "@wordpress/block-editor/build-style/style.css";
@import "@wordpress/block-library/build-style/style.css";
@import "@wordpress/block-library/build-style/theme.css";
@import "@wordpress/block-library/build-style/editor.css";

// block-editor and block-library reset the admin color to the legacy #007cba.
// Keep this after the imports: equal specificity, so source order decides.
// Remove once @wordpress/base-styles ships the modern default:
// https://github.com/WordPress/gutenberg/pull/83749
:root {

@include mixins.admin-scheme(#3858e9);
}
Comment on lines +12 to +19

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Loading