Is there a way to return the current active color scheme?
This is how to register a new admin color scheme
<?php register_admin_color_schemes(); ?>
is there something like get_admin_color_scheme();
that will return which is active?
Is there a way to return the current active color scheme?
This is how to register a new admin color scheme
<?php register_admin_color_schemes(); ?>
is there something like get_admin_color_scheme();
that will return which is active?
Comments are closed.
The current admin color scheme is a user setting, you can get its value with:
See the function
admin_color_scheme_picker()
inwp-admin/includes/misc.php
for an usage example.If you want to access the colors in PHP, you have to do a little trick. In the file from toschos answer they use the global variable
$_wp_admin_css_colors
. This gets destroyed at any point of the runtime.I actually found the right hook to copy it:
So now I can access the colors at any point in the script I want like this:
Here is an excerpt of
$admin_colors
to demonstrate the structure:Every user can set his own admin color scheme, so you can also get the color scheme according to an user ID:
Further reading: WP 3.8 Default Admin Colour For All Users
I think this is the simple way to get the current admin color scheme or set it also, see the code:
Set the default admin color scheme:
Get the current admin color scheme:
Get all available admin colors schemes:
@see gist here also: https://gist.github.com/mohamdio/bb9a1a18446aca257935846d217060e9