Simple Environment Indicator
This module provides a minimal way to color your Drupal toolbar based on your environment. It allows you to configure background and foreground colors or use predefined colors for different environments, and can optionally display an indicator for anonymous users.
The module works very much like Environment Indicator module with a minimal approach. It requires Drupal core's Toolbar (Drupal 8+) or Admin menu (Drupal 7) modules and changes the color of the Toolbar as you like.
Version 2.x now supports Gin theme and Drupal 10.
It is a simple module that does one thing, to color the Toolbar. It has no configurable user interface. All you need to do is place a line in settings.php such as,
// Drupal 7
$conf['simple_environment_indicator'] = 'DarkRed PRD';
// Drupal 8+
$settings['simple_environment_indicator'] = 'DarkRed PRD';
// or
$settings['simple_environment_indicator'] = '#fff/#666 PRD';
// or
$settings['simple_environment_indicator'] = '@PRD';
// accessible colors with #access
$settings['simple_environment_indicator'] = '@PRD#access';
The web color name(s) or hex value(s) are followed by the environment name. You can specify background color only (foreground is white) or foreground/background colors. If you use @ sign with the environment name, the predetermined color will be used.
Drupal 8+ version supports anonymous users who don't normally have access to Toolbar.
$settings['simple_environment_anonymous'] = TRUE;
If you do not like the default rendering of the environment indicator, you can
set to a string instead of a boolean value, such as,
$settings['simple_environment_anonymous'] = "body:after {
content: \"STAGE\" ;
position: fixed;
top: 0;
left: 0;
padding: 0.1em 0.5em;
font-family: monospace;
font-weight: bold;
color: #fff;
background: brown;
border: 1px solid white; }";
You would not want to display the indicator for anonymous users in production
environment, but nothing will stop you if you have a reason to do so.