diff --git a/projects/js-packages/charts/changelog/charts-285-charts-storybook-does-not-use-the-modern-wp-color-scheme b/projects/js-packages/charts/changelog/charts-285-charts-storybook-does-not-use-the-modern-wp-color-scheme new file mode 100644 index 000000000000..d6eb9cb527d2 --- /dev/null +++ b/projects/js-packages/charts/changelog/charts-285-charts-storybook-does-not-use-the-modern-wp-color-scheme @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Correct Storybook comments about the default admin color scheme. + + diff --git a/projects/js-packages/charts/src/stories/chart-decorator.tsx b/projects/js-packages/charts/src/stories/chart-decorator.tsx index e69f486a5010..d5732baf6a25 100644 --- a/projects/js-packages/charts/src/stories/chart-decorator.tsx +++ b/projects/js-packages/charts/src/stories/chart-decorator.tsx @@ -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-`. 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. diff --git a/projects/js-packages/charts/src/stories/theme-config.tsx b/projects/js-packages/charts/src/stories/theme-config.tsx index 75a97650363a..d2b98d3fcdb3 100644 --- a/projects/js-packages/charts/src/stories/theme-config.tsx +++ b/projects/js-packages/charts/src/stories/theme-config.tsx @@ -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', diff --git a/projects/js-packages/storybook/changelog/charts-285-charts-storybook-does-not-use-the-modern-wp-color-scheme b/projects/js-packages/storybook/changelog/charts-285-charts-storybook-does-not-use-the-modern-wp-color-scheme new file mode 100644 index 000000000000..e27be0b381d8 --- /dev/null +++ b/projects/js-packages/storybook/changelog/charts-285-charts-storybook-does-not-use-the-modern-wp-color-scheme @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Use the modern WordPress admin color scheme (blueberry) as the default admin theme color in stories. diff --git a/projects/js-packages/storybook/storybook/style.scss b/projects/js-packages/storybook/storybook/style.scss index 90e3457d1db8..094ae7a31f2d 100644 --- a/projects/js-packages/storybook/storybook/style.scss +++ b/projects/js-packages/storybook/storybook/style.scss @@ -1,5 +1,6 @@ // 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"; @@ -7,3 +8,12 @@ @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); +}