How to change colors in admin menus without plugins

Instead of installing additional plugins for changing colors in admin menus, in this article we will teach you how to change color schemes simply by putting the following code in your functions.php and actually make your simple plugin.

With this code, you can choose any colors you want, but instead of choosing one from color picker, you’ll have to write color’s hexadecimal triplets. You can get those by using any color picker you want – from Paint to Photoshop or any online color picker.

  1. Go to your functions.php file
  2. Paste the following code at the end:
  3. function additional_admin_color_schemes() {  
        //Get the theme directory  
        $theme_dir = get_template_directory_uri();  
      
        //Ocean  
        wp_admin_css_color( 'isitwpcolor', __( 'Is It WP' ),  
            $theme_dir . '/admin-colors/isitwp/colors.min.css',  
            array( ' #ed2a0c', '#000000', '#738e96', '#f2fcff' )  
        );  
    }  
    add_action('admin_init', 'additional_admin_color_schemes');
  4. With the next piece of code, make your new color scheme active:
  5. function set_default_admin_color($user_id) {  
        $args = array(  
            'ID' => $user_id,  
            'admin_color' => 'isitwpcolor'  
        );  
        wp_update_user( $args ); 

    }
    add_action(‘user_register’, ‘set_default_admin_color’);

    Unfortunately, we’re not done yet. After this step, you need to paste another function to change the label of your newly created color schemes in order to make it work

  6. Paste the following code:
function rename_fresh_color_scheme() {  
    global $_wp_admin_css_colors;  
    $color_name = $_wp_admin_css_colors['fresh']->name;  
  
    if( $color_name == 'Default' ) {  
        $_wp_admin_css_colors['fresh']->name = 'Fresh';  
    }  
    return $_wp_admin_css_colors;  
}  
add_filter('admin_init', 'rename_fresh_color_scheme'); 

That was the last step in creating your custom color scheme without installing any extra plugins. While it was maybe a bit more time consuming, you won’t have to care about that one extra plugin installed on your WordPress.

START YOUR OWN BLOG

This guide is an introduction to mastering the art of blogging. It provides easy to follow steps to start, maintain, and grow your blog.

Read the guide

Leave a Reply

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