Different color admin bars for dev, staging and production

You can use a filter to set the admin color scheme, which includes colors for the admin bar:

<?php // add a filter
add_filter('get_user_option_admin_color', 'wpse_313419_conditional_admin_color');
// 
function wpse_313419_conditional_admin_color($result) {
    // Dev: use 'light' color scheme
    if(get_site_url() == 'http://dev.example.com') {
        return 'light';
    // Staging: use 'blue' color scheme
    } elseif(get_site_url() == 'http://staging.example.com') {
        return 'blue';
    // Production (all other cases): use 'sunrise' color scheme
    } else {
        return 'sunrise';
    }
} ?>

You can see the 8 built-in color schemes by editing a user’s profile and viewing the “Admin Color Scheme” options at the top. You just use them as all-lowercase. The filter overrides any individual users’ preferences and enforces the color scheme of your choice. If you like, you can also create your own custom color schemes.

If your Site URLs change often, you could take an additional step – when the theme is activated, save the environment as an Option, and then you can pull it using get_option instead of get_site_url.

Finally, if you want to just use a plugin to handle all this for you, there is at least one ready-made solution in the WP plugin repository.