2

In WordPress, the user is able to set the default Admin Colour Scheme by going to their profile and selecting a color scheme, how can I access those color schemes?

For example, when Midnight is selected, the sidebar color changes, and etc. I want to access those colors. Any idea?

4

The current active/selected admin color scheme is a user setting, you can get its value with get_user_option( 'admin_color' ).

$admin_color = get_user_option( 'admin_color' );

if you want to access the color scheme for the specific user then pass the user id as second parameter in the get_user_option() function

$user1_id = 2;
$user1_color = get_user_option( 'admin_color', $user1_id );

the above both examples will return the name of the active color scheme e.g; blue, fresh, Midnight etc..

if you want to access the whole list of colors used in the admin section then use the following..

global $_wp_admin_css_colors; 
$admin_colors = $_wp_admin_css_colors;
print_r($admin_colors);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.