web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to Set Different B...
Power Apps
Answered

How to Set Different Background Colors for Forms Based on Entity in Model Driven Apps?

(0) ShareShare
ReportReport
Posted on by

Hello everyone,

 

I'm looking to enhance the user experience on our Model Driven apps by implementing visual distinctions between different forms. Specifically, I want to apply unique background colors depending on the form or entity type—such as a blue background for the Account form and a green background for the Contact form.

 

Has anyone implemented something similar, or could you guide me on how to achieve this? I'm curious whether it's possible to set these colors dynamically based on the entity displayed.

Any advice on how to approach this within the Model Driven framework would be greatly appreciated!

 

Thank you in advance for your insights!

Categories:
  • cchannon Profile Picture
    4,702 Moderator on at

    As far as I know, there is no supported way to achieve this.

  • charlesdgcharle Profile Picture
    on at

    Even with an included JavaScript ?

  • Verified answer
    charlesdgcharle Profile Picture
    on at

    I found a solution and it works !

     

    1) Create a JS file resource with the following script:

     

    // Created by Charles De Guchteneere CDG 2024
    function changeColor(executionContext) {
    var int0 = setInterval(function() {
    var container = window.parent.document.querySelectorAll("div[id^='mainContentContainer_']")[0];
    if (container) {
    container.style.backgroundColor = 'rgb(245, 230, 255)'; // Change to desired color
    clearInterval(int0);
    }
    else {
    console.log('no container');
    }
    }, 100);
    }

     

    2) Add and call the "changeColor" function in the Events "On Load" section of the appropriate form

     

    Here is the result  🙂

    Give me your feedback please

    Capture.PNG

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.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 312

#3
Mohsin Ali Profile Picture

Mohsin Ali 252

Last 30 days Overall leaderboard