All Backpack components have full theming support through through the theme provider component. In the render tree, all themeable components will have access to the provided theme, even when they are multiple levels deep.


Theming for supported components is done using the default Android theming mechanism.

Each supported component can be themed individually using the style property, or globally by setting {componentName}Style in your theme.


Define a theme in themes.xml

                                                 <style name="MyCustomTheme" parent="AppTheme">
                                                    <item name="bpkSwitchStyle">@style/BpkSwitch.Red</item>
                                                  <style name="BpkSwitch.Red" parent="">
                                                    <item name="switchPrimaryColor">@color/bpkPanjin</item>

You can theme all instances of BpkSwitch in your app/activity by setting the theme to MyCustomTheme, or change it to a single view by either setting the style to @style/BpkSwitch.Red or to your custom theme.

For supported attributes check each component's documentation.

Themeable colours

Backpack supports theming the following colours:

  • bpkPrimaryColor

Those can be accessed programmatically using the BpkTheme class.