Make WordPress Core


Ignore:
Timestamp:
03/14/2026 07:53:29 AM (5 months ago)
Author:
audrasjb
Message:

Toolbar: add CSS from admin color scheme on front-end.

This changeset introduces the wp_admin_bar_add_color_scheme_to_front_end() which is hooked on admin_bar_init in order to use the CSS from admin color schemes on the admin bar on front-end, as inline styles.

Props sabernhardt, huzaifaalmesbah, audrasjb, johnbillion, noruzzaman, JeffPaul, joedolson, huzaifaalmesbah, amesplant, r1k0, shailu25.
Fixes #64762.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/dependencies/wpStyleLoaderSrc.php

    r61388 r62025  
    1313        /**
    1414         * Tests that PHP warnings are not thrown when wp_style_loader_src() is called
    15          * before the `$_wp_admin_css_colors` global is set.
     15         * before the `$_wp_admin_css_colors` global is set within the admin.
    1616         *
    1717         * The warnings that we should not see:
     
    2020         *
    2121         * @ticket 61302
     22         * @ticket 64762
    2223         */
    2324        public function test_without_wp_admin_css_colors_global() {
    24                 $this->assertFalse( wp_style_loader_src( '', 'colors' ) );
     25                if ( is_admin() ) {
     26                        $this->assertFalse( wp_style_loader_src( '', 'colors' ) );
     27                } else {
     28                        $this->assertStringContainsString( '/colors.css', wp_style_loader_src( '', 'colors' ) );
     29                }
    2530        }
    2631}
Note: See TracChangeset for help on using the changeset viewer.