# Admin Color Scheme per User Role

> Gives each role its own admin color scheme, for example blue for editors and coffee for shop managers, so people instantly see which kind of account they are using.

- Type: PHP
- Runs: Run everywhere
- Category: [Admin](https://wpide.com/library/category/admin/)
- Tags: admin-colors, roles, branding
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/admin-color-scheme-per-role/

## Code

```php
// Role => admin color scheme.
$wpide_role_colors = array(
    'administrator' => 'midnight',
    'editor'        => 'blue',
    'author'        => 'ocean',
    'shop_manager'  => 'coffee',
);

add_filter( 'get_user_option_admin_color', function ( $color, $option, $user ) use ( $wpide_role_colors ) {
    if ( ! $user instanceof WP_User ) {
        return $color;
    }
    foreach ( (array) $user->roles as $role ) {
        if ( isset( $wpide_role_colors[ $role ] ) ) {
            return $wpide_role_colors[ $role ];
        }
    }
    return $color;
}, 10, 3 );
```

## Notes

Roles not listed keep each user's own choice; scheme names: fresh, light, modern, blue, coffee, ectoplasm, midnight, ocean, sunrise.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Admin Color Scheme per User Role" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
