#64762 Use sass to generate admin toolbar colours
This extracts the admin toolbar styles into a mixin so a standalone admin-bar.css file can be generated for each colour scheme. Facilitates custom colour schemes registering their own admin toolbar CSS file too.
Trac ticket: https://core.trac.wordpress.org/ticket/64762
Use of AI Tools
Claude Code was used to initialise the separate admin bar color Sass files for each colour scheme. Worked ok-ish, I subsequently manually adjusted a lot of it.
Screenshots
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.
Core Committers: Use this line as a base for the props when committing in SVN:
Props johnbillion, mukesh27, huzaifaalmesbah, sabernhardt, westonruter, wildworks, fushar, audrasjb, softglaze.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.
Test using WordPress Playground
The changes in this pull request can previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.
Some things to be aware of
- All changes will be lost when closing a tab with a Playground instance.
- All changes will be lost when refreshing the page.
- A fresh instance is created each time the link below is clicked.
- Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance, it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.
Thanks for putting together this PR @johnbillion! It looks fairly better than the current implementation. I tested the PR on my side, and admin bar styles are correctly implemented on front end when we switch admin color schemes.
I was having trouble with the registered schemes for bbPress and Grey Admin Color Schemes mainly because both plugins use wp_admin_css_color() within the admin_init hook.
- Switching the hook to
initworks for me on the front and back with Grey Admin Color Schemes and adding the fifth and sixth arguments.wp_admin_css_color( 'postmodern', __('Post Modern Grey', 'grey-admin-color-schemes'), plugins_url("postmodern/colors$rtl.css", __FILE__ ), array( '#464646', '#6D6D6D', '#D6D6D6', '#F1F1F1' ), array(), plugins_url("postmodern/admin-bar.css", __FILE__ ) ); - bbPress would need more editing, and I have not solved that on the front.
Now that 7.0 has been released, I believe we can resume this PR towards 7.1.
I tested this branch locally at commit "8a7542d6aa". Default, Sunrise and Ectoplasm each enqueue their own admin-bar.css on the front end and the toolbar matches the selected admin scheme. Fresh enqueues no stylesheet. Note the branch can't currently be previewed via Playground (the CI artifact has expired).
@softglazee @fushar Appreciate your testing but I think #11354 supersedes this now. Are you able to take a look?
@johnbillion yes, i'm going to test #11354, and thank you
Just a heads-up that I have fully tested PR 11354 as requested. You can find the complete test report, including how it handles plugin-registered schemes and the minified production path, over on Trac #64762.