Theming in Canvas Apps for Developers
Image Source: Shutterstock.com
Power Apps
Sep 25, 2023 9:03 PM

Theming in Canvas Apps for Developers

by HubSite 365 about Lewis Baybutt [MVP]

Power Platform Consultant 💬 at HybrIT Services | Low Code Lewis 👨🏻‍💻 | Microsoft 365 | Power Platform | SharePoint | Dynamics 365 | #CommunityRocks 🚀

External Blog Post
Citizen Developer

Power AppsLearning Selection

Effortlessly brand your app controls with custom theming! Easily change themes in one place to save time and boost functionality.

In his recent blog post, Microsoft Most Valuable Professional (MVP) Lewis Baybutt offers useful advice on how to facilitate branding controls using a custom theming process in your applications. His piece focuses on creating ease while branding all of your controls which can be easily done by altering the code in one place. He also offers insights on creating multiple themes, enhancing user preferences, and more.

To begin with, Baybutt recommends creating a theme in the App OnStart property, or during the timer's OnTimerStart property to give your application time to load your themes. This ensures that there are no unusual glitches in your control loading and rendering processes. He also suggests storing your users' preferences in a data table to further customize their experience.

For creating a theme, Baybutt demonstrates the use of global variables and records in lieu of collections for ease of access. He sets a global variable with a record containing all the colours he planned to use in his theme. This data is stored under a global variable, with each color assinged to its corresponding hexadecimal code.

Learn more about Power Apps here

Further Context on Custom Themes in Applications

The implementation of custom theming in applications extends beyond the aesthetics. It constitutes a part of the unique user experience, catering to the preferences of the user while also emphasizing on the brand value. Theming impacts the readability, accessibility, and overall navigation of any application. This feature makes the controls used in application effortlessly adaptable to change, allowing them to be consistent across similar platforms. The capability to include multiple themes caters to the varied preferences of different users, ensuring a user-friendly experience for all.

The next step involves using a similar strategy to build out his theme. Baybutt creates a global variable with nested records assigned to each control intended to be used in his application. He then uses this variable to style the controls, referring to the records within his variable. This method allows him to alter the theme by changing the code in one place, without having to edit each control individually.

For users looking to employ multiple themes in their applications, Baybutt recommends including a setting option in the application that allows users to select their preferred theme.

Finally, Baybutt emphasizes the significance of user preferences and outlines a method to store these in a table. This table would consist of a record of the person's email and their chosen theme value. With this setup, users can have their preferred theme stored and automatically activated each time they access the application

.

Read the full article Theming in Canvas Apps

Power Apps - Effective Theming Techniques in Canvas Apps for Developers

Learn about Theming in Canvas Apps

In today's digital age, customizing user interfaces to reflect your organization's branding is critical for brand consistency and user recognition. Whether you're designing a web application or a mobile app, one essential feature that can help you achieve this is theming. In Microsoft's Power Platform, specifically the Power Apps, theming is a seamless experience.

Let's delve into the topic of theming in Canvas Apps. At its core, it’s about creating a flexible scheme that allows you to adjust the visual appearance of your app easily, from colors and fonts to more complex aspects like styling rules for specific controls. The advantage? Change the code in one location and the entire branding of your app reacts accordingly.

We kick off the process by defining our themes. Most developers opt for the App OnStart property to do this. An alternative approach involves a timer’s OnTimerStart property, where we create time for loading themes. This method ensures a smoother transition between controls' default look and the desired final rendering. It’s a useful tip for anyone interested in storing user preferences to enhance the UX.

With that, we move on to theme creation. Here, some developers may choose to use collections, but for this guide, we’ll use global variables and records. Set(gblColours, {...}); is the Power Apps code snippet to set a global variable holding all the colours for the app.

In every Power Apps theme setup, you typically create records for each color you intend to use, assigning them their hex color values using the ColorValue() function. Next, we build out our theme using a similar approach, assigning global variables with records for each control we'll theme in our app.

The idea is to replace hard-coded values with references to the corresponding values in the variable. From labels, texts, to form fields; apply this technique to all your controls. Want to change your theme? Adjust the code in one place, and everything else aligns. It's that simple!

What if we want more than one theme? No problem! All you need is a settings screen with a dropdown to change your theme. Using the dropdown’s OnChange property, use If() or Switch() statements to determine your controls' thematic styling. Set a global variable with the choice made in the dropdown, and use that to direct the styling for different themes, i.e., light or dark mode.

Remember, user preferences are key. To achieve a more personalized user experience, store their theme preferences, something as simple as an email and the chosen theme. Use the Patch() function to create a new record for the user, ensuring that their preferences remain even when they log off and return later.

Overall, theming in Power Apps is not just about making UI visually appealing but also user-centric and personalized. More importantly, it simplifies the management and adjustment of the app's visual elements. Despite the technical execution, it’s without a doubt a worthy inclusion in enhancing your app’s UX.

Whether you’re a seasoned Power Apps developer or a beginner, read up on this blog post "Theming in Canvas Apps". It’s a detailed guide to understanding and utilizing themes in your Power Apps projects for an improved user experience.

More links on about Theming in Canvas Apps

Theming components - Power Platform
Aug 2, 2023 — In this article ... You use theming components to create and manage themes for canvas apps. A theme contains a collection of styles that define ...
Set up theming components - Power Platform
Dec 9, 2022 — You use theming components to create, manage, and share themes for canvas apps. A theme contains a collection of styles that define multiple ...

Keywords

Canvas Apps Theming, Custom Themes, App Design, Canvas Interface, Mobile App Themes, User Interface Design, App Aesthetics, Improve App Appearance, App Usability, Color Schemes in Apps.