Customization

Customize the SDK-provided screens to match your application's style

All Composables taken in the standard Jetpack Compose Modifier parameter, which can be used to further customize the screen as needed.

Localization and Copy

You may override specific strings by defining new values for the XML string resources defined in the SDK. The full list of string resources is available here: https://github.com/smileidentity/android/blob/main/lib/src/main/res/values/strings.xml

For example, to update the Smart Selfie instructions, you can override the si_smart_selfie_instructions XML resource in your own strings.xml file

<string name="si_smart_selfie_instructions">Your custom instruction</string>

To provide translations, create a new values folder specific to the language (i.e. values-fr) and create a strings.xml overriding all values. For further information, refer to https://developer.android.com/guide/topics/resources/localization

Theming

There are 2 options for customizing the colours of the screens presented by the SDK: via Jetpack Compose or XML Resources.

Note: If you're using Jetpack Compose, you may choose to use XML Resources or the native Compose approach, as per your preference. However, the Compose approach is the best practice in case of a dynamic theme (i.e. Material You Dynamic Color Scheme, Dark/Light mode, etc). The default SmileIdentityColorScheme picks its colours from resources.

Colour Scheme

When invoking a Composable function, the colour scheme and typography can be customized by the values passed to the colorScheme and typography parameters, respectively.

The default theme is publicly exposed as SmileID.colorScheme and can be copied and modified.

import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import com.smileidentity.SmileID
import com.smileidentity.compose.theme.colorScheme
import com.smileidentity.compose.SmartSelfieRegistration

@Composable
fun ColorSchemeThemingExample() {
    val colorScheme = SmileID.colorScheme.copy(primary = Color.Green)
    // Alternatively, if you already have your own MaterialTheme.colorScheme, you can use that:
    // val colorScheme = MaterialTheme.colorScheme
    SmileID.SmartSelfieRegistration(colorScheme = colorScheme)
}

Typography

Additionally, you may also customize the typography in a similar fashion via the typography parameter to all Composables.

The default typography is exposed as SmileID.typography and can be copied and modified.

import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.sp
import com.smileidentity.SmileID
import com.smileidentity.compose.theme.typography
import com.smileidentity.compose.SmartSelfieRegistration

@Composable
fun TypographyThemingExample() {
    val typography = SmileID.typography.copy(displayLarge = TextStyle(fontSize = 24.sp))
    // Alternatively, if you already have your own MaterialTheme.typography, you can use that:
    // val typography = MaterialTheme.typography
    SmileID.SmartSelfieRegistration(typography = typography)
}

Last updated