ColourCue Admin Bar
A very simple WordPress plugin to set the colour of the admin bar based on the environment.
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/d-meagher/admin-header-colour/archive/refs/heads/main.zip
A simple WordPress plugin that changes the admin bar background colour based on the active environment.
Features
- Uses WordPress environment detection (
wp_get_environment_type()). - Includes a simple settings page to pick custom colours per environment.
- Automatically switches admin bar text for readable contrast (minimum 4.5:1 target).
- Optional all-environment override.
Environment Setup
Set your environment in wp-config.php:
define( 'WP_ENVIRONMENT_TYPE', 'staging' );
Valid values are:
localdevelopmentstagingproduction
If not set, WordPress defaults to production.
Settings Page
Go to Settings -> ColourCue Admin Bar and set:
- Local colour
- Development colour
- Staging colour
- Production colour
Each field has a colour picker and a hex input.
Optional Constant Override
You can force one colour for all environments:
define( 'CAB_FORCE_ADMIN_BAR_COLOR', '#222222' );
Filters
Filter default map:
add_filter( 'cab_environment_colour_map', function( $map ) {
$map['staging'] = '#ff9900';
return $map;
} );
Filter final resolved colour:
add_filter( 'cab_admin_bar_colour', function( $colour, $environment ) {
if ( 'production' === $environment ) {
return '#267f00';
}
return $colour;
}, 10, 2 );
Filter text colour after contrast check:
add_filter( 'cab_admin_bar_text_colour', function( $text_colour, $background_colour ) {
return $text_colour;
}, 10, 2 );