How to change admin bar color scheme in MP6 / WP 3.8 front end?

I need to change default color scheme for all users.
The admin bar on my site is vidibile for all users including guests.
The default black color scheme isn’t beauty with my design and I would like to change it with cofee scheme. Is there any way to do this?

I already found

add_filter('get_user_option_admin_color','change_admin_color');
function change_admin_color($result) {
   return 'coffee';
}

But it disable feature to choose another color scheme for users.
And first of all it work only for logged in users.

3 s
3

At the moment (3.8) color schemes do not apply to admin bar at front end at all, even if user is logged in and has non-default scheme selected.

The shortest way would probably be to force enqueue color scheme at front end:

add_action(
    'wp_enqueue_scripts',
    function () {
        wp_enqueue_style(
            'color-admin-bar',
            admin_url( '/css/colors/coffee/colors.min.css' ),
            array( 'admin-bar' )
        );
    } );

Note that core chose not to do it, so it is untested and there is risk of style incompatibilities and such.

Leave a Comment