This is for D365 F&O or whatever MS is calling it this year.
It's a pretty traditional request to set the background color of D365 depending on what company (ie legal entity) the user is in. In D365, the "theme" is a good way to do that. Normally the theme is set by user in the Settings, User options. The theme controls the color of the top bar (image below) as well as the color of the accent color throughout D365.
In order to set the users's theme a) when they log on initially and b) whenever they change companies, you need to subscribe to the Info onPostStartup delegate.
To do this, create a new class (naming doesn't matter) and include the code below (just change XYZ to your company). This is a simplified example, showing the minimum to make this work. You may not want to hard-code company codes. And, in case it's not clear, this kind of code would make the theme selection by user, in Settings, User options completely ineffective. Have fun!
[SubscribesTo(classStr(Info), delegateStr(Info, onPostStartup))]
public static void Info_onPostStartup(str startUpCommand)
if (curExt() == 'XYZ')