For the live site I used a setting then just a macro in the CSS: {%Settings["EnvBGcolor"]|(identity)GlobalAdministrator%}
This doesn't work for the dashboard/admin. The way I used to do it for the dashboard was just having different branches for each environment, and i would change the CSS per branch and never merge those changes together. Like you said it became a hassle and I just removed it during the last upgrade.
Reading that article it mentions using grunt.js to compile less. This article looks like you can configure grunt to do string replacements per environment.