Francesca Shiekh

Quick Tip: Color Code your Environments

Discussion created by Francesca Shiekh on Oct 9, 2018
Latest reply on Oct 11, 2018 by Yury Voloshin

We are an On Site customer and I work in four environments:

My sandbox (env2)

The Development sandbox (dev)

The Test environment (tst)

and Production.

 

Sometimes I'm testing things in one, developing in another and checking production issues and the tabs and windows I have open can all get easily confused in my browser/s.

The same could be said of my QA/Sugar User Support colleagues.

 

So I color-code my Navigation bar to easily and immediately tell them apart.

 

But I don't want to have to maintain separate themes in each environment, as copy-overs easily override things and I'll suddenly think I'm in production when I'm in TST or worse, vice versa.

 

So I use the $sugar_config global to see what environment I'm in and set the color.

 

In all my environments I have the same theme file:

custom/themes/clients/base/default/variables.php

<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

//color code the environment I am in
global $sugar_config;
if (strpos($sugar_config['site_url'], 'env2')!== false){
  $lessdefs['colors']['BorderColor'] = '#00cc00'; //green
}elseif(strpos($sugar_config['site_url'], 'devel')!== false){
  $lessdefs['colors']['BorderColor'] = '#bb99ff'; //purple
}elseif(strpos($sugar_config['site_url'], 'test')!== false){
  $lessdefs['colors']['BorderColor'] = '#99bbff'; //teal
}
?>

 

So my Production navbar is left to the default out of the box coloring.

 

And, for example, my sandbox has a subtle green line

 

And my development is purple

 

Too subtle?

Go bold! Change the whole Navigation Bar color:

<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

global $sugar_config;
if (strpos($sugar_config['site_url'], 'env2')!== false){
  $lessdefs['colors']['NavigationBar'] = '#00cc00';
}elseif(strpos($sugar_config['site_url'], 'devel')!== false){
  $lessdefs['colors']['NavigationBar'] = '#bb99ff';
}elseif(strpos($sugar_config['site_url'], 'test')!== false){
  $lessdefs['colors']['NavigationBar'] = '#99bbff';
}
?>

 

Now no one can miss the "green sandbox"

 

 

or the "purple development"

 

Ok, those are a little TOO bold even for me... but you get the idea.

 

Hope this helps!
FrancescaS

Outcomes