Theming
Customize widget appearance with server-side and client-side theme overrides.
Widgets support visual theming through the theme field. Themes can be set server-side when creating the widget and overridden client-side in the Android SDK.
Theme fields
| Name | Type | Default | Description |
|---|---|---|---|
background_color | String? | null | Background color as hex string (e.g. #f9fafb or #80f9fafb for alpha) |
border_radius | Int? | null | Corner radius in DP applied to the widget container |
padding | Int? | null | Inner padding in DP |
font_family | String? | null | Font family name for caption text |
caption_color | String? | null | Text color for captions as hex string |
Server-side theming
Set the theme when creating or updating a widget via the API:
{
"theme": {
"background_color": "#f0f4f8",
"border_radius": 12,
"padding": 16,
"caption_color": "#4a5568"
}
}The theme is stored with the widget and delivered to all clients.
Client-side overrides
Override specific theme fields in the Android SDK using themeOverrides:
import com.vizco.sdk.model.WidgetTheme
import com.vizco.sdk.ui.VizcoWidget
@Composable
fun ThemedWidget() {
VizcoWidget(
widgetSlug = "hero-carousel",
themeOverrides = WidgetTheme(
backgroundColor = "#1a1a2e",
borderRadius = 16,
padding = 8
)
)
}Client-side overrides completely replace the server-side theme. If you override backgroundColor, the server value for that field is ignored. Fields you don't set in the override remain null and the server values are used.
How theming is applied
The SDK resolves the final theme by merging server-side and client-side values:
- The widget's
themeJSON is parsed into aWidgetThemeobject. - If
themeOverridesis provided, non-null fields from the override replace corresponding server values. - The resolved theme is passed to the layout composable.
- Each layout applies theme values using a
themedBackground()utility that sets background color, border radius, and padding.
Color format
Colors use hex string format:
- 6-digit:
#f9fafb(RGB) - 8-digit:
#80f9fafb(ARGB with alpha)
The SDK parses hex colors into Compose Color values at render time.