I followed this guide, but idk if it doesnt work for WP 5.0+ or if im doing something wrong.

I added this to my functions.php and the css file is a copy of the Light Scheme.

 function additional_admin_color_schemes() {
 $theme_dir = get_template_directory_uri(); 

wp_admin_css_color( 'pro', __( 'Pro' ),
$theme_dir . '/wp-content/themes/astra-child/pro/colors.min.css',
array( '#E5E5E5', '#E5E5E5', '#3498DB', '#3498DB' )
  );
}
add_action('admin_init', 'additional_admin_color_schemes');

1 Answer
1

This code works with WordPress 5.2 and is correct.

You now need to go to your Profile and select it by going to
Users > Your Profile > Admin Color Scheme
select the scheme and save.

enter image description here

Edit: Adding updated code for your colors CSS file since you’re using a child theme:

function additional_admin_color_schemes() {
    wp_admin_css_color( 'pro', __( 'Pro' ),
        get_stylesheet_directory_uri().'/wp-content/themes/astra-child/pro/colors.css',
        [ '#E5E5E5', '#E5E5E5', '#3498DB', '#3498DB' ]
    );
}
add_action( 'admin_init', 'additional_admin_color_schemes' );

Note here I removed the .min from the CSS file. I recommend you copy the non-minified CSS file over, so you can easily edit and customize the styles.

Leave a Reply

Your email address will not be published. Required fields are marked *