[wp-hackers] Admin Color Schemes: generic classes for colors?

Nikola Nikolov nikolov.tmw at gmail.com
Fri Dec 20 15:49:40 UTC 2013

Hi Dino,

Why don't you try something like this:

function add_color_scheme_class( $class ) {
    $color = get_user_option( 'admin_color' );
    $class .= $color ? " admin-color-{$color} " : ' admin-color-fresh '/*
"fresh" is the default */;

    return $class;
add_filter( 'admin_body_class', 'add_color_scheme_class', 10 );

That should add the classes automatically for you - I know that you wanted
a core solution, but I assume for that it would be best to open a
ticket(you can do that here - http://core.trac.wordpress.org/ ).


PS: I haven't tested the code, but it should work just fine.

On Fri, Dec 20, 2013 at 5:26 PM, Dino Termini <dino at duechiacchiere.it>wrote:

> Hi folks,
> we are trying to adapt our plugin to the new admin color schemes, and it
> would be great if we could have generic CSS class declarations that allow
> us to apply the current scheme's background/text colors to our elements.
> Something like
> .admin-color-flat .sidebar-background-color{ background-color: #.... }
> .admin-color-vineyard .sidebar-background-color{ background-color: #.... }
> This would allow plugin developers to leverage those schemes without
> having to reinvent the wheel every time, and would make their plugins adapt
> to any third-party color scheme people may be using on their site.
> Thank you,
> Dino.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list