Skip to content
Draft
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
8 changes: 6 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ module.exports = function(grunt) {
cwd: WORKING_DIR,
dest: WORKING_DIR,
src: [
'wp-admin/css/colors/*/colors.css'
'wp-admin/css/colors/*/colors.css',
'wp-admin/css/colors/*/admin-bar.css'
]
}
},
Expand Down Expand Up @@ -828,7 +829,10 @@ module.exports = function(grunt) {
cwd: SOURCE_DIR,
dest: WORKING_DIR,
ext: '.css',
src: ['wp-admin/css/colors/*/colors.scss'],
src: [
'wp-admin/css/colors/*/colors.scss',
'wp-admin/css/colors/*/admin-bar.scss'
],
options: {
implementation: sass
}
Expand Down
25 changes: 25 additions & 0 deletions src/wp-admin/css/colors/_admin-bar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@use "variables";

// Admin bar color scheme tokens.
//
// The admin bar stylesheet (wp-includes/css/admin-bar.css) reads its colors
// from these custom properties, falling back to the default colors.
//
// Included in each color scheme's colors.css for the admin, and compiled
// separately into each color scheme's admin-bar.css for the front end.
@mixin tokens() {
#wpadminbar {
--wp-admin--admin-bar--text: #{variables.$menu-text};
--wp-admin--admin-bar--background: #{variables.$menu-background};
--wp-admin--admin-bar--icon: #{variables.$menu-icon};
--wp-admin--admin-bar--focus-text: #{variables.$menu-submenu-focus-text};
--wp-admin--admin-bar--submenu-text: #{variables.$menu-submenu-text};
--wp-admin--admin-bar--submenu-background: #{variables.$menu-submenu-background};
--wp-admin--admin-bar--submenu-background-alt: #{variables.$menu-submenu-background-alt};
--wp-admin--admin-bar--input-background: #{variables.$adminbar-input-background};
--wp-admin--admin-bar--recovery-text: #{variables.$adminbar-recovery-exit-text};
--wp-admin--admin-bar--recovery-background: #{variables.$adminbar-recovery-exit-background};
--wp-admin--admin-bar--recovery-background-hover: #{variables.$adminbar-recovery-exit-background-alt};
--wp-admin--admin-bar--avatar-frame: #{variables.$adminbar-avatar-frame};

@t-hamano t-hamano Oct 6, 2026 •

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.

My main concern is whether these CSS custom properties would be treated as a public API. To avoid that, we could instead inline a per-scheme admin-bar.css with hardcoded color rules, at the cost of adding about 4 KB (about 1 KB compressed) to every page. I'm not sure which approach we should take 😅

cc @westonruter @aduth

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

My main concern is whether these CSS custom properties would be treated as a public API.

Yep, exactly. I wrote this in the PR description as well.

To avoid that, we could instead inline a per-scheme admin-bar.css with hardcoded color rules, at the cost of adding about 4 KB (about 1 KB compressed) to every page

This is basically using the previous PR and apply your suggestion here, abandoning this PR, correct?

I'm not sure which approach we should take

Same 🙂 this turns out to be nontrivial at all haha.

}
}
152 changes: 2 additions & 150 deletions src/wp-admin/css/colors/_admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@use "variables";
@use "mixins";
@use "tokens";
@use "admin-bar";

/**
* This function name uses British English to maintain backward compatibility, as developers
Expand Down Expand Up @@ -382,156 +383,7 @@ ul#adminmenu > li.current > a.current::after {
background: variables.$menu-highlight-background;
}

/* Admin Bar */

#wpadminbar {
color: variables.$menu-text;
background: variables.$menu-background;
}

#wpadminbar .ab-item,
#wpadminbar a.ab-item,
#wpadminbar > #wp-toolbar span.ab-label,
#wpadminbar > #wp-toolbar span.noticon {
color: variables.$menu-text;
}

#wpadminbar .ab-icon,
#wpadminbar .ab-icon::before,
#wpadminbar .ab-item::before,
#wpadminbar .ab-item::after {
color: variables.$menu-icon;
}

#wpadminbar:not(.mobile) .ab-top-menu > li:hover > .ab-item,
#wpadminbar:not(.mobile) .ab-top-menu > li > .ab-item:focus,
#wpadminbar.nojq .quicklinks .ab-top-menu > li > .ab-item:focus,
#wpadminbar.nojs .ab-top-menu > li.menupop:hover > .ab-item,
#wpadminbar .ab-top-menu > li.menupop.hover > .ab-item {
color: variables.$menu-submenu-focus-text;
background: variables.$menu-submenu-background;
}

#wpadminbar:not(.mobile) > #wp-toolbar li:hover span.ab-label,
#wpadminbar:not(.mobile) > #wp-toolbar li.hover span.ab-label,
#wpadminbar:not(.mobile) > #wp-toolbar a:focus span.ab-label {
color: variables.$menu-submenu-focus-text;
}

#wpadminbar:not(.mobile) li:hover .ab-icon::before,
#wpadminbar:not(.mobile) li:hover .ab-item::before,
#wpadminbar:not(.mobile) li:hover .ab-item::after,
#wpadminbar:not(.mobile) li:hover #adminbarsearch::before {
color: variables.$menu-submenu-focus-text;
}

/* Admin Bar: submenu */

#wpadminbar .menupop .ab-sub-wrapper {
background: variables.$menu-submenu-background;
}

#wpadminbar .quicklinks .menupop ul.ab-sub-secondary,
#wpadminbar .quicklinks .menupop ul.ab-sub-secondary .ab-submenu {
background: variables.$menu-submenu-background-alt;
}

#wpadminbar .ab-submenu .ab-item,
#wpadminbar .quicklinks .menupop ul li a,
#wpadminbar .quicklinks .menupop.hover ul li a,
#wpadminbar.nojs .quicklinks .menupop:hover ul li a {
color: variables.$menu-submenu-text;
}

#wpadminbar .quicklinks li .blavatar,
#wpadminbar .menupop .menupop > .ab-item::before {
color: variables.$menu-icon;
}

#wpadminbar .quicklinks .menupop ul li a:hover,
#wpadminbar .quicklinks .menupop ul li a:focus,
#wpadminbar .quicklinks .menupop ul li a:hover strong,
#wpadminbar .quicklinks .menupop ul li a:focus strong,
#wpadminbar .quicklinks .ab-sub-wrapper .menupop.hover > a,
#wpadminbar .quicklinks .menupop.hover ul li a:hover,
#wpadminbar .quicklinks .menupop.hover ul li a:focus,
#wpadminbar.nojs .quicklinks .menupop:hover ul li a:hover,
#wpadminbar.nojs .quicklinks .menupop:hover ul li a:focus,
#wpadminbar li:hover .ab-icon::before,
#wpadminbar li:hover .ab-item::before,
#wpadminbar li a:focus .ab-icon::before,
#wpadminbar li .ab-item:focus::before,
#wpadminbar li .ab-item:focus .ab-icon::before,
#wpadminbar li.hover .ab-icon::before,
#wpadminbar li.hover .ab-item::before,
#wpadminbar li:hover #adminbarsearch::before,
#wpadminbar li #adminbarsearch.adminbar-focused::before {
color: variables.$menu-submenu-focus-text;
}

#wpadminbar .quicklinks li a:hover .blavatar,
#wpadminbar .quicklinks li a:focus .blavatar,
#wpadminbar .quicklinks .ab-sub-wrapper .menupop.hover > a .blavatar,
#wpadminbar .menupop .menupop > .ab-item:hover::before,
#wpadminbar.mobile .quicklinks .hover .ab-icon::before,
#wpadminbar.mobile .quicklinks .hover .ab-item::before {
color: variables.$menu-submenu-focus-text;
}

#wpadminbar.mobile .quicklinks .ab-icon::before,
#wpadminbar.mobile .quicklinks .ab-item::before {
color: variables.$menu-icon;
}

/* Admin Bar: search */

#wpadminbar #adminbarsearch::before {
color: variables.$menu-icon;
}

#wpadminbar > #wp-toolbar > #wp-admin-bar-top-secondary > #wp-admin-bar-search #adminbarsearch input.adminbar-input:focus {
color: variables.$menu-text;
background: variables.$adminbar-input-background;
}

/* Admin Bar: recovery mode */

#wpadminbar #wp-admin-bar-recovery-mode {
color: variables.$adminbar-recovery-exit-text;
background-color: variables.$adminbar-recovery-exit-background;
}

#wpadminbar #wp-admin-bar-recovery-mode .ab-item,
#wpadminbar #wp-admin-bar-recovery-mode a.ab-item {
color: variables.$adminbar-recovery-exit-text;
}

#wpadminbar .ab-top-menu > #wp-admin-bar-recovery-mode.hover > .ab-item,
#wpadminbar.nojq .quicklinks .ab-top-menu > #wp-admin-bar-recovery-mode > .ab-item:focus,
#wpadminbar:not(.mobile) .ab-top-menu > #wp-admin-bar-recovery-mode:hover > .ab-item,
#wpadminbar:not(.mobile) .ab-top-menu > #wp-admin-bar-recovery-mode > .ab-item:focus {
color: variables.$adminbar-recovery-exit-text;
background-color: variables.$adminbar-recovery-exit-background-alt;
}

/* Admin Bar: my account */

#wpadminbar .quicklinks li#wp-admin-bar-my-account.with-avatar > a img {
border-color: variables.$adminbar-avatar-frame;
background-color: variables.$adminbar-avatar-frame;
}

#wpadminbar #wp-admin-bar-user-info .display-name {
color: variables.$menu-text;
}

#wpadminbar #wp-admin-bar-user-info a:hover .display-name {
color: variables.$menu-submenu-focus-text;
}

#wpadminbar #wp-admin-bar-user-info .username {
color: variables.$menu-submenu-text;
}
@include admin-bar.tokens();

/* Pointers */

Expand Down
16 changes: 16 additions & 0 deletions src/wp-admin/css/colors/blue/_scheme.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
$highlight-color: #437aa8;

@forward "../variables" with (
$scheme-name: "blue",
$base-color: #245278,
$icon-color: #e5f8ff,
$highlight-color: $highlight-color,
$notification-color: #e1a948,
$menu-highlight-text: #fff,
$menu-highlight-icon: #fff,
$menu-bubble-text: #1e1e1e,
$menu-submenu-text: #e2ecf1,
$menu-submenu-focus-text: #fff,

$dashboard-icon-background: $highlight-color
);
4 changes: 4 additions & 0 deletions src/wp-admin/css/colors/blue/admin-bar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@use "scheme";
@use "../admin-bar";

@include admin-bar.tokens();
18 changes: 2 additions & 16 deletions src/wp-admin/css/colors/blue/colors.scss
Original file line number Diff line number Diff line change
@@ -1,16 +1,2 @@
$highlight-color: #437aa8;

@use "../_admin.scss" with (
$scheme-name: "blue",
$base-color: #245278,
$icon-color: #e5f8ff,
$highlight-color: $highlight-color,
$notification-color: #e1a948,
$menu-highlight-text: #fff,
$menu-highlight-icon: #fff,
$menu-bubble-text: #1e1e1e,
$menu-submenu-text: #e2ecf1,
$menu-submenu-focus-text: #fff,

$dashboard-icon-background: $highlight-color
);
@use "scheme";
@use "../admin";
13 changes: 13 additions & 0 deletions src/wp-admin/css/colors/coffee/_scheme.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$base-color: #5c4c40;

@forward "../variables" with (
$scheme-name: "coffee",
$base-color: $base-color,
$highlight-color: #916745,
$notification-color: #9ea476,
$menu-highlight-text: #fff,
$menu-highlight-icon: #fff,
$menu-bubble-text: #1e1e1e,
$menu-submenu-focus-text: #fff,
$form-checked: $base-color,
);
4 changes: 4 additions & 0 deletions src/wp-admin/css/colors/coffee/admin-bar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@use "scheme";
@use "../admin-bar";

@include admin-bar.tokens();
15 changes: 2 additions & 13 deletions src/wp-admin/css/colors/coffee/colors.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,2 @@
$base-color: #5c4c40;

@use "../_admin.scss" with (
$scheme-name: "coffee",
$base-color: $base-color,
$highlight-color: #916745,
$notification-color: #9ea476,
$menu-highlight-text: #fff,
$menu-highlight-icon: #fff,
$menu-bubble-text: #1e1e1e,
$menu-submenu-focus-text: #fff,
$form-checked: $base-color,
);
@use "scheme";
@use "../admin";
15 changes: 15 additions & 0 deletions src/wp-admin/css/colors/ectoplasm/_scheme.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
$base-color: #4a3369;

@forward "../variables" with (
$scheme-name: "ectoplasm",
$base-color: $base-color,
$icon-color: #ece6f6,
$highlight-color: #646c3e,
$notification-color: #d46f15,
$menu-highlight-text: #fff,
$menu-highlight-icon: #fff,
$menu-bubble-text: #1e1e1e,
$menu-submenu-focus-text: #fff,

$form-checked: $base-color,
);
4 changes: 4 additions & 0 deletions src/wp-admin/css/colors/ectoplasm/admin-bar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@use "scheme";
@use "../admin-bar";

@include admin-bar.tokens();
17 changes: 2 additions & 15 deletions src/wp-admin/css/colors/ectoplasm/colors.scss
Original file line number Diff line number Diff line change
@@ -1,15 +1,2 @@
$base-color: #4a3369;

@use "../_admin.scss" with (
$scheme-name: "ectoplasm",
$base-color: $base-color,
$icon-color: #ece6f6,
$highlight-color: #646c3e,
$notification-color: #d46f15,
$menu-highlight-text: #fff,
$menu-highlight-icon: #fff,
$menu-bubble-text: #1e1e1e,
$menu-submenu-focus-text: #fff,

$form-checked: $base-color,
);
@use "scheme";
@use "../admin";
30 changes: 30 additions & 0 deletions src/wp-admin/css/colors/light/_scheme.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@use "sass:color";

$highlight-color: #007cba;
$text-color: #333;
$menu-avatar-frame: #aaa;

@forward "../variables" with (
$scheme-name: "light",
$base-color: #e5e5e5,
$icon-color: #6a6a6a,
$text-color: $text-color,
$highlight-color: $highlight-color,
$notification-color: #c64606,

$body-background: #f5f5f5,

$menu-highlight-text: #fff,
$menu-highlight-icon: #fff,
$menu-highlight-background: #6e6e6e,

$menu-bubble-text: #fff,
$menu-submenu-background: #fff,

$menu-collapse-text: #777,
$menu-collapse-focus-icon: #555,

$dashboard-accent-1: $highlight-color,
$dashboard-accent-2: color.adjust(color.adjust($highlight-color, $lightness: 7%), $saturation: -15%),
$dashboard-icon-background: $text-color
);
4 changes: 4 additions & 0 deletions src/wp-admin/css/colors/light/admin-bar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@use "scheme";
@use "../admin-bar";

@include admin-bar.tokens();
Loading
Loading