-
Notifications
You must be signed in to change notification settings - Fork 88
Themes and styles
Themes and styles allow you to customize the look and feel of your application without the need to alter the library code.
Themes contain all the colors of all the views of the app. They are reprensented by the Theme
class. The two default themes brls::HorizonLightTheme
and brls::HorizonDarkTheme
have color schemes that match HOS as closely as possible.
The app contains an instance of brls::LibraryViewsThemeVariantsWrapper
, that contains itself two themes: one for the light variant and one for the dark variant. The active variant is selected automatically on HOS, and defaults to light on PC. You can use the dark theme on PC by running your code with the BOREALIS_THEME
environment variable set to DARK
.
To customize the theme of your app, create one class by variant, extending brls::HorizonLightTheme
and brls::HorizonDarkTheme
. In their constructor, change the values inside the instance according to your needs. Don't forget to call the super constructor!
Then, make an instance of brls::LibraryViewsThemeVariantsWrapper
with your two themes. Give that wrapper to brls::Application::init()
and you're all set!
Additionally, views support overriding their theme variant by calling overrideThemeVariant
. This way you can, for example, create a dark button in a light app. To be used with brls::Application::getThemeVariantsWrapper()->getDarkTheme()
(or getLightTheme()
).
Styles contain all the metrics of all the views of the app. They are represented by the Style
class. Here as well, the default style class brls::HorizonStyle
is made to match HOS as closely as possible.
You can change the style of your app the same way as changing the theme - create a custom Style
class and give it to brls::Application::init()
.