microsoft / powercat-creator-kit

This toolkit helps create well-designed Power App experiences on the web & mobile. It contains a component library; PCF controls and other utilities that increase developer productivity.
MIT License
322 stars 55 forks source link

[BUG]: Theme / Colors Different Between Canvas Studio and PowerApp Client. #490

Closed sperry1625 closed 2 months ago

sperry1625 commented 2 months ago

I am building an app that uses several controls from the creator kit. I am seeing big differences between how the controls are rendered between the Power App studio and when actually running the app either in a browser of the Power App client. I have images below to show examples. I have no idea why they are so drastically different.

Rendered in Studio

image

Rendered in Power App Client

image

Expected behavior They should render exactly the same.

Any thoughts or questions?

Regards,

SP

denise-msft commented 2 months ago

@sperry1625 sorry you're having trouble in the player.

Just to confirm, this is in a canvas app and not a custom page, right?

Can you please share the Power Apps studio version you're using (under app settings)?

Where are you storing the AppThemeJson, in a global variable on App.OnStart (like described in docs), named formulas, or some other way?

Behind the title "List of events go here", is that a Creator Kit component too? Or are these native components in a layout container and you are referencing one of the AppTheme palette properties to render the color behind that title, or is that just using a hardcoded/native color value?

sperry1625 commented 2 months ago

I believe I have figured this out. I store / create my theme as a formula. Apparently, the formula is not set by the time the first screen loads. I disabled App.OnStart() as it was no longer best practice but considering turning it back on.

denise-msft commented 2 months ago

Thanks for following up @sperry1625. If you're still having trouble with it, please let me know, otherwise please feel free to close the issue if you figured it out.

It is best practice to remove App.Onstart logic to help speed up app load time. One alternative you can try is to use named formulas (in App.Formulas) to store the AppTheme logic that is normally on app start and use a spinner that watches whether that formula is blank (Spinner.Visible = IsBlank(AppTheme)).

sperry1625 commented 2 months ago

I have removed all App.Start() code. I am using named formulas for all of my themes. My theme definitions are stored in a SQL table and loaded via stored procedure. All is working as expected now.

Thank you.