Theme API for Android
Use theme API to fully customize all visual aspects of the Android SDK.
Starting from SDK version 1.26, it is possible to use the SDK Theme API:
// create a theme using builder SNSTheme
val customTheme = SNSTheme {
// customize theme parameters
colors.backgroundCommon = SNSThemeColor(resources.getColor(R.color.owl_yellow_200))
fonts.headline1 = SNSThemeFont(Typeface.MONOSPACE, 40)
metrics.activityIndicatorStyle = SNSThemeMetric.Size.LARGE
// ... other parameters
// or like so
colors {
backgroundNeutral = SNSThemeColor(Color.RED)
// ... other parameters
}
fonts {
headline1 = SNSThemeFont(Typeface.MONOSPACE, 40)
subtitle2 = SNSThemeFont(Typeface.MONOSPACE, 10)
// ... other parameters here
}
metrics {
screenHorizontalMargin = resources.getDimension(R.dimen.sns_margin_large)
screenHeaderAlignment = SNSThemeMetric.TextAlignment.RIGHT
bottomSheetHandleSize = SizeF(20f, 20f)
// ... other parameters
}
}
// provide the theme to the SDK builder
val snsSdkBuilder = SNSMobileSDK.Builder(this, apiUrl).withTheme(customTheme)// create a theme using SNSThemeKt.newSNSTheme() method
SNSThemeHolder theme = SNSThemeKt.newSNSTheme();
// get parameter scopes
ColorsScope colorsScope = theme.getColorsScope();
MetricsScope metricsScope = theme.getMetricsScope();
FontsScope fontsScope = theme.getFontsScope();
// customize theme parameters
colorsScope.setBackgroundCommon(new SNSThemeColor(Color.RED, Color.GREEN));
metricsScope.setSectionHeaderAlignment(SNSThemeMetric.TextAlignment.CENTER);
fontsScope.setHeadline2(new SNSThemeFont(Typeface.SERIF, 15));
// ... other parameters
// provide the theme to the SDK builder
SNSMobileSDK.Builder builder = new SNSMobileSDK.Builder(this).withTheme(theme);Theme options are named to express their semantic and used in many different places across the Android SDK, so be aware that changing them may affect many elements at once.
For the convenience the options are split into the corresponding sections:
Fonts
data class SNSThemeFont(
val typeface: Typeface,
val sizeSp: Int
)headline1
theme.fonts.headline1: SNSThemeFontUsed for screen titles in conjunction with colors.contentStrong mostly.
headline2
theme.fonts.headline2: SNSThemeFontUsed for section titles in conjunction with colors.contentStrong mostly.
subtitle1
theme.fonts.subtitle1: SNSThemeFontUsed for subtitles in conjunction with colors.contentStrong mostly.
subtitle2
theme.fonts.subtitle2: SNSThemeFontUsed for subtitles in conjunction with colors.contentNeutral mostly.
body
theme.fonts.body: SNSThemeFontUsed for paragraphs, text fields, and so on, in conjunction with colors.contentNeutral mostly.
caption
theme.fonts.caption: SNSThemeFontUsed for minor captions in conjunction with colors.contentWeak mostly.
Colors
data class SNSThemeFont(
val typeface: Typeface,
val sizeSp: Int
)Common
navigationBarItem
theme.colors.navigationBarItem: SNSThemeColorNavigation bar items tinting color. Used for the close button only at the moment.
Default is ● #94A0B8 and ● #FFFFFF with alpha 40% for the dark appearance.
alertTint
theme.colors.alertTint: SNSThemeColorUsed for the system alert actions and the toolbar buttons.
Default is ● #1693E9 and ● #1485D1 for the dark appearance.
Backgrounds
backgroundCommon
theme.colors.backgroundCommon: SNSThemeColorUsed for almost all the screens and alerts as the background color (the exception is the Camera Screen, see cameraBackground).
Default is ● #FFFFFF and ● #1E232E for the dark appearance.
backgroundNeutral
theme.colors.backgroundNeutral: SNSThemeColorUsed as a background state color for the verification steps and as a main background color for the DEFAULT-style cards.
Default is ● #F6F7F9 and ● #FFFFFF with alpha 7% for the dark appearance.
backgroundSuccess
theme.colors.backgroundSuccess: SNSThemeColorUsed as a background state color for the verification steps.
Default is ● #18B494 with alpha 12% and ● #18B494 with alpha 30% for the dark appearance.
backgroundWarning
theme.colors.backgroundWarning: SNSThemeColorUsed as a background state color for the verification steps.
Default is ● #F2AA0D with alpha 13% and ● #F2AA0D with alpha 30% for the dark appearance.
backgroundCritical
theme.colors.backgroundCritical: SNSThemeColorUsed as a background state color for the verification steps.
Default is ● #F05C5C with alpha 12% and ● #F05C5C with alpha 30% for the dark appearance.
backgroundInfo
theme.colors.backgroundInfo: SNSThemeColorUsed as a background processing state color for the multi select in ApplicantData.
Default is ● _#1765FF with alpha 10% and ● _#1380FF with alpha 10% for the dark appearance.
Content
contentLink
theme.colors.contentLink: SNSThemeColorUsed for the text links.
Default is ● #1693E9 and ● #1485D1 for the dark appearance.
contentStrong
theme.colors.contentStrong: SNSThemeColorUsed as a foreground color for the headlines, some subtitles and text inside alert dialogs.
Default is ● #333C4D and ● #FFFFFF with alpha 85% for the dark appearance.
contentNeutral
theme.colors.contentNeutral: SNSThemeColorUsed as a foreground color for the text body, some subtitles and the accessory elements.
Default is ● #5C6B8A and ● #FFFFFF with alpha 60% for the dark appearance.
contentWeak
theme.colors.contentWeak: SNSThemeColorUsed as a foreground color for the minor captions and the light accessory elements. Represents inactive state of RadioButton and Checkbox.
Default is ● #94A0B8 and ● #FFFFFF with alpha 40% for the dark appearance.
contentInfo
theme.colors.contentInfo: SNSThemeColorUsed for the Video Screen's viewport border only at the moment.
Default is ● #1693E9 and ● #1485D1 for the dark appearance.
contentSuccess
theme.colors.contentSuccess: SNSThemeColorUsed as a foreground state color for the verification steps.
Default is ● #18B494.
contentWarning
theme.colors.contentWarning: SNSThemeColorUsed as a foreground state color for the verification steps.
Default is ● #E6A00B.
contentCritical
theme.colors.contentCritical: SNSThemeColorUsed as a foreground state color for the verification steps.
Default is ● #F05C5C.
Primary Button
primaryButtonBackground
theme.colors.primaryButtonBackground: SNSThemeColorThe primary button background color in the normal state.
Default is ● #1693E9 and ● #1485D1 for the dark appearance.
primaryButtonBackgroundHighlighted
theme.colors.primaryButtonBackgroundHighlighted: SNSThemeColorThe primary button background color in the highlighted state.
Default is ● #1485D1 and ● #0B4A75 for the dark appearance.
primaryButtonBackgroundDisabled
theme.colors.primaryButtonBackgroundDisabled: SNSThemeColorThe primary button background color in the disabled state.
Default is ● #A1D2F7 and ● #072F4B for the dark appearance.
primaryButtonContent
theme.colors.primaryButtonContent: SNSThemeColorThe primary button foreground color in the normal state.
Default is ● #FFFFFF and ● #FFFFFF with alpha 85% for the dark appearance.
primaryButtonContentHighlighted
theme.colors.primaryButtonContentHighlighted: SNSThemeColorThe primary button foreground color in the highlighted state.
Default is ● #FFFFFF and ● #FFFFFF with alpha 85% for the dark appearance.
primaryButtonContentDisabled
theme.colors.primaryButtonContentDisabled: SNSThemeColorThe primary button foreground color in the disabled state.
Default is ● #FFFFFF and ● #0B4A75 for the dark appearance.
Secondary Button
secondaryButtonBackground
theme.colors.secondaryButtonBackground: SNSThemeColorThe secondary button background color in the normal state.
Default is the transparent color.
secondaryButtonBackgroundHighlighted
theme.colors.secondaryButtonBackgroundHighlighted: SNSThemeColorThe secondary button background color in the highlighted state.
Default is ● #E8F4FD and ● #072F4B for the dark appearance.
secondaryButtonBackgroundDisabled
theme.colors.secondaryButtonBackgroundDisabled: SNSThemeColorThe secondary button background color in the disabled state.
Default is the transparent color.
secondaryButtonContent
theme.colors.secondaryButtonContent: SNSThemeColorThe secondary button foreground color in the normal state.
Default is ● #1693E9 and ● #1485D1 for the dark appearance.
secondaryButtonContentHighlighted
theme.colors.secondaryButtonContentHighlighted: SNSThemeColorThe secondary button foreground color in the highlighted state.
Default is ● #1693E9 and ● #1485D1 for the dark appearance.
secondaryButtonContentDisabled
theme.colors.secondaryButtonContentDisabled: SNSThemeColorThe secondary button foreground color in the disabled state.
Default is ● #A1D2F7 and ● #0B4A75 for the dark appearance.
Link Button
linkButtonContent
theme.colors.linkButtonContent: SNSThemeColorThe link button foreground color in the normal state.
Default is ● _#1765FF with alpha 80% and ● _#1380FF with alpha 80% for the dark appearance.
linkButtonContentDisabled
theme.colors.linkButtonContentDisabled: SNSThemeColorThe link button foreground color in the disabled state.
Default is ● _#1765FF with alpha 50% and ● _#1380FF with alpha 50% for the dark appearance.
linkButtonBackgroundHighlighted
theme.colors.linkButtonBackgroundHighlighted: SNSThemeColorThe link button background color in the pressed state.
Default is ● _#1765FF with alpha 5% and ● _#1380FF with alpha 5% for the dark appearance.
Card
cardPlainBackground
theme.colors.cardPlainBackground: SNSThemeColorUsed as a background color for the cards with PLAIN card style.
Default is the transparent color.
cardBorderedBackground
theme.colors.cardBorderedBackground: SNSThemeColorUsed as a background color for the cards with BORDERED card style.
Default is the transparent color.
Camera
cameraBackground
theme.colors.cameraBackground: SNSThemeColorThe Camera Screen background color.
Default is ● #1E232E.
cameraContent
theme.colors.cameraContent: SNSThemeColorUsed as a tint color for the elements placed on the Camera Screen such as the gallery button, the touch button, and so on.
Default is ● #FFFFFF.
cameraBackgroundOverlay
theme.colors.cameraBackgroundOverlay: SNSThemeColorThe Camera Screen overlay background color.
Default is ● #456456 with alpha 75%.
Fields
fieldBackground
theme.colors.fieldBackground: SNSThemeColorThe background color of the input fields. Used for text fields.
Default is ● #F6F7F9 and ● #FFFFFF with alpha 7% for the dark appearance.
fieldBackgroundInvalid
theme.colors.fieldBackgroundInvalid: SNSThemeColorThe background color of the input fields marked as invalid. Used for text fields.
Default is the colors.backgroundCritical color.
fieldBorder
theme.colors.fieldBorder: SNSThemeColorThe border color of the input fields. Used for text fields.
Default is the transparent color.
fieldBorderDisabled
theme.colors.fieldBorderDisabled: SNSThemeColorThe border color of the input fields in disabled state. Used for text fields.
Default is the transparent color.
fieldBorderFocused
theme.colors.fieldBorderFocused: SNSThemeColorThe border color of the input fields in focused state. Used for text fields.
Default is the transparent color.
fieldPlaceholder
theme.colors.fieldPlaceholder: SNSThemeColorThe placeholder color of the input fields. Used for text fields.
Default is ● #94A0B8 and ● #FFFFFF with alpha 40% for the dark appearance.
fieldContent
theme.colors.fieldContent: SNSThemeColorThe content color of the input fields. Used for text fields.
Default is ● #333C4D and ● #FFFFFF with alpha 85% for the dark appearance.
fieldTint
theme.colors.fieldTint: SNSThemeColorThe tint color of the input fields. Used for text fields, checkboxes (active state) and radio buttons (active state).
Default is ● #1693E9 and ● #1485D1 for the dark appearance.
List
listSeparator
theme.colors.listSeparator: SNSThemeColorThe list separator color.
Default is ● #D1D6E1 and ● #FFFFFF with alpha 20% for the dark appearance.
listSelectedItemBackground
theme.colors.listSelectedItemBackground: SNSThemeColorThe background color of the selected list item.
Default is ● #F6F7F9 and ● #FFFFFF with alpha 7% for the dark appearance.
Bottom Sheet
bottomSheetHandle
theme.colors.bottomSheetHandle: SNSThemeColorThe foreground color of the bottom sheet handle.
Note that the handle can be both inside (on bottomSheetBackground color) and outside (on the backgroundCommon color) of the bottom sheet.
Default is ● #D1D6E1 and ● #FFFFFF with alpha 20% for the dark appearance.
bottomSheetBackground
theme.colors.bottomSheetBackground: SNSThemeColorThe background color of the bottom sheet.
Default is ● #FFFFFF and ● #333C4D for the dark appearance.
Progress
progressBarTint
theme.colors.progressBarTint: SNSThemeColorThe foreground (indicator) color of the progress indicator
Default is ● _#1765FF and ● _#1380FF for the dark appearance.
progressBarBackground
theme.colors.progressBarBackground: SNSThemeColorThe foreground (indicator) color of the progress indicator
Default is ● _#1765FF with alpha 20% and ● _#1380FF with alpha 20% for the dark appearance.
Metrics
Common
activityIndicatorStyle
theme.metrics.activityIndicatorStyle: SNSThemeMetric.SizeThe loading spinner style. Default is MEDIUM.
Content
screenHorizontalMargin
theme.metrics.screenHorizontalMargin: FloatThe horizontal margins of the screen content. Default is 16dp.
Buttons
buttonHeight
theme.metrics.buttonHeight: FloatThe primary and secondary buttons height. Default is 48dp.
buttonCornerRadius
theme.metrics.buttonCornerRadius: FloatThe primary and secondary buttons corner radius. Default is 8dp.
buttonBorderWidth
theme.metrics.buttonBorderWidth: FloatThe secondary button border width. Bordered primary buttons are not supported at the moment.
Default is 1dp.
Fields
fieldHeight
theme.metrics.fieldHeight: FloatUsed for the text input fields. Default is 48dp.
fieldBorderWidth
theme.metrics.fieldBorderWidth: FloatThe text input fields border width. Default is 0dp.
fieldCornerRadius
theme.metrics.fieldCornerRadius: FloatThe text input fields corner radius. Default is 8dp.
Viewport
viewportBorderWidth
theme.metrics.viewportBorderWidth: FloatThe selfie viewport border width. Default is 8dp.
Bottom Sheet
bottomSheetCornerRadius
theme.metrics.bottomSheetCornerRadius: FloatThe bottom sheet corners radius. Default is 16dp.
bottomSheetHandleSize
theme.metrics.bottomSheetHandleSize: SizeFThe bottom sheet handle size. Default is 36dp x 4dp.
List separator
listSeparatorHeight
theme.metrics.listSeparatorHeight: FloatThe list separator thickness. Default is 1dp.
listSeparatorMarginLeft
theme.metrics.listSeparatorMarginLeft: FloatThe list separator left margin. Default is 0dp.
listSeparatorMarginRight
theme.metrics.listSeparatorMarginRight: FloatThe list separator right margin. Default is 0dp.
Card Style
enum class CardStyle(val value: String) : SNSThemeMetric {
BORDERED("bordered"),
PLAIN("plain"),
DEFAULT("default")
}- With
BORDEREDstyle a border will be rendered around the card (see alsocolors.cardBorderedBackground). - With
PLAINstyle neither border nor background will be rendered by default (seecolors.cardPlainBackground). - With
DEFAULTstyle the default background will be used.
verificationStepCardStyle
theme.metrics.verificationStepCardStyle: SNSThemeMetric.CardStyleThe verification steps card style.
Default is DEFAULT.
verificationCommentCardStyle
theme.metrics.verificationCommentCardStyle: SNSThemeMetric.CardStyleThe style of a verification comment block that can be displayed when the applicant is temporarily declined.
Default is BORDERED.
supportItemCardStyle
theme.metrics.supportItemCardStyle: SNSThemeMetric.CardStyleThe support items card style.
Default is BORDERED.
documentTypeCardStyle
theme.metrics.documentTypeCardStyle: SNSThemeMetric.CardStyleThe document types card style.
Default is DEFAULT.
selectedCountryCardStyle
theme.metrics.selectedCountryCardStyle: SNSThemeMetric.CardStyleThe selected country card style.
Default is DEFAULT.
cardCornerRadius
theme.metrics.cardCornerRadius: FloatThe cards' corners radius.
Default is 8dp.
cardBorderWidth
theme.metrics.cardBorderWidth: FloatThe cards' border width. Used for the cards with the BORDERED card style only.
Default is 1dp.
Alignment
enum class TextAlignment(val value: String) : SNSThemeMetric {
LEFT("left"),
CENTER("center"),
RIGHT("right")
}screenHeaderAlignment
theme.metrics.screenHeaderAlignment: SNSThemeMetric.TextAlignmentThe alignment for the screen headers. Default is CENTER
sectionHeaderAlignment
theme.metrics.sectionHeaderAlignment: SNSThemeMetric.TextAlignmentThe alignment for the section headers. Default is LEFT
Updated 2 days ago