Set( varHeaderColor, If( IsBlank(Param("HeaderColor")), // Check if Param is blank (i.e. running in editor) "#808080", // Default gray color for editor Param("HeaderColor") ) // For Production: // EnvironmentVariable.HeaderColor );
Yes! You can dynamically change the header color in Power Apps based on the environment (Dev, Test, Prod). Here’s how you can do it:
Environment()
The Environment() function retrieves the current environment name, which you can use to set a different color for each environment.
Go to App > OnStart and define a variable:
Set(varEnv, Environment().Name);
Set the Fill property of the header (or app background) to:
Fill
Switch( varEnv, "Dev", RGBA(255, 165, 0, 1), // Orange for Dev "Test", RGBA(0, 123, 255, 1), // Blue for Test "Prod", RGBA(220, 20, 60, 1), // Red for Prod RGBA(128, 0, 128, 1) // Default Purple )
If Environment().Name doesn’t match your expectations, you can create a Settings Table in Dataverse with:
Environment().Name
EnvironmentName
HeaderColor
#FFA500
Then, onappstart, use LookUp() to fetch the right color:
LookUp()
Set(varHeaderColor, LookUp(Settings, EnvironmentName = Environment().Name, HeaderColor));
Then set the header’s Fill property:
ColorValue(varHeaderColor)
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Chiara Carbone as our Community Spotlight for November…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
WarrenBelz 629 Most Valuable Professional
Michael E. Gernaey 397 Super User 2025 Season 2
wolenberg_ 232 Moderator