Skip to content

Instantly share code, notes, and snippets.

@hrach
Last active April 5, 2017 17:06
Show Gist options
  • Save hrach/7f8488b457fdc05058534730c866ac6c to your computer and use it in GitHub Desktop.
Save hrach/7f8488b457fdc05058534730c866ac6c to your computer and use it in GitHub Desktop.
Adminer coloring for easy prod/dev recognition
<?php
class AdminerColors
{
function head()
{
static $colors = [
'alpha-adminer.example.com' => '#3C8DBC',
'prod-adminer.example.com' => '#DD4B39',
];
// detection by host, you may also detect by any other paramaters,
// such as $_GET parameters
$color = $colors[$_SERVER['HTTP_HOST']] ?? '#00A65A';
echo '<style>
#stage-color { background: ' . $color . '; position: fixed; left: 0; top: 0; bottom: 0; width: 2em; }
#menu { left: 2em; }
#menu h1 a { color: ' . $color . ' }
body { padding-left: 2em; }
#lang { margin-left: 2em; }
#breadcrumb { left: 23em; }
</style>';
}
function navigation()
{
echo '<div id="stage-color"></div>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment