Customize the theme & UI
Our mobile SDKs allow changing the theme color that is used for borders and buttons, the links color and the background color. We try to match the native platform UIs.
Further customization of the consent notice can be done by displaying your own custom consent notice instead of the standard SDK notice.
The Android TV / tvOS themes are not customizable at the moment. TV devices will ignore these parameters.
Colors
You can modify the theme colors in your didomi_config.json
file.
The theme color
attribute is used for borders of notices and popups and for highlighted buttons.
The theme linkColor
attribute controls the color of all the links in the banner/popup.
The theme backgroundColor
attribute controls the color of all the screens from the SDK.
The text and some graphical elements colors will be computed from the background color in order to ensure sufficient color contrast. The default background color is white (#FFFFFF).
Buttons
We use two different types of buttons:
Regular buttons (
regularButtons
): our basic button used throughout the consent workflow (Learn More, Disagree, etc.). Those buttons are grey by default.Highlighted buttons (
highlightButtons
): used when we want to emphasize an action. Those buttons use the theme color by default.
Only integer values are currently supported for the width and radius.
Older Android SDK versions had an issue where border and corner radius sizes were used as raw pixels instead of density-independent pixels (dp). In order to stay backward-compatible with existing configurations, the fix is under a feature flag: set sizesInDp
to true
to use it.
Notice text
You can customize the text colors, sizes and alignments for the notice title and description.
The default text alignment is start
.
The default text color is computed from the background color (black
or white
).
The default text size for Notice's title is 24px
.
The default text size for Notice's description is 16px
.
You can customize the notice globally, apply the same changes to the notice title and description:
You can customize the notice title and description independently, apply the different changes to the notice title and description:
You can mix global and specific parameters. Per example, the specific parameter descriptionAlignment
will override the global parameter alignment
.
Preferences text
You can customize the text colors, text sizes and alignments for the preferences title and description.
The customization of the preferences' title applies only to the vendor sub-title (Select partners
in english).
The customization of the preferences's description applies to the purposes and vendors descriptions.
The default text alignment is start
.
The default text color is computed from the background color (black
or white
).
The default text size for Preferences' title is 18px
.
The default text size for Preferences' description is 16px
.
You can customize the notice globally, apply the same changes to the notice title and description:
You can customize the notice title and description independently, apply the different changes to the preferences
title and description:
Custom Font Family
We provide the capacity to customize the font family for the notice and the preferences titles and descriptions. In order to do so, you will need to add the font to your application then provide its name with a custom json parameter
Add a font for Android
Note that Android does provide some fonts depending on the API version. In order to make the font available to all supported API versions, you must add the font manually. Android will need only the "regular" font file to handle the font weight and / or style (<b>
, <i>
).
Android resources files must not contains any uppercase characters or spaces, on order to manage custom fonts for Android and iOS from a single configuration file, you need to follow this name convention for the resource file: replace space chars by underscore chars and put the file name in lower case.
Examples:
Font family name: Trebuchet MS
-> Resource file name: trebuchet_ms
Font family name: Arial
-> Resource file name: arial
Add a font for iOS
Note that iOS is already providing many fonts ready to use from your application. If you want to use a system provided font, you can skip this part. iOS will need one font file for each variant (regular bold, bold+italic, italic). The variants are only required if you need to add html tags to change the font weight and / or style (<b>
, <i>
).
Since iOS is using the font family name, the font file name doesn't matter.
Examples:
Font family name: Trebuchet MS
-> Same as the Font Family Name from Font Book or from the iOS system.
Font family name: Arial
-> Same as the Font Family Name from Font Book or from the iOS system.
Custom json from the console
You need to set the font family name for the title and/or description for the notice screen and the preferences screens.
You can apply a font family to all UI buttons (title, descriptions and buttons) displayed in the notice and preferences using theme.notice.fontFamily
and theme.preferences.fontFamily
:
You can use the titleFontFamily
and descriptionFontFamily
properties to set a font family for the notice and preferences as shown below. These changes will have no effect on buttons:
You can mix global and specific parameters. Per example, the specific parameter descriptionFontFamily
will override the global parameter fontFamily
.
You can mix global and specific parameters. Per example, the specific parameter descriptionAlignment
will override the global parameter alignment
.
Fullscreen mode
You can set the notice and preferences screens to fit the device screen. This option will make the notice and the preferences screen to completely cover your application (only the system status bar will be visible).
This mode will override the notice position
parameter (bottom
/ popup
).
Sticky Buttons
You can enable the Agree and Disagree (button or link / cross) sticky buttons. When sticky buttons are enabled, they will always be visible, even if the notice text is too long to be displayed entirely in the notice. In this case the texts will be scrollable independently.
This feature will force the Fullscreen mode (and will override the notice position
parameter).
The Agree and Disagree buttons will be disabled at startup. The user will have to scroll down to the bottom of the content description in order to enable those buttons.
Custom notice
If you want to further customize the notice in your app, you can use your own custom notice to replace the standard Didomi SDK notices (banner or popup). Contact support@didomi.io to learn more and discuss feasibility.
Last updated