Class IncodeThemeConfig
-
- All Implemented Interfaces:
@Serializable() public final class IncodeThemeConfigIncode theme configuration used in modules designed using Compose.
It supports typography IncodeTypography and color scheme IncodeColorScheme customisation, look into concrete classes for more info. Objects has JSON support, so it's possible to serialize content using IncodeThemeConfig.toJson or deserialize it using IncodeThemeConfig.fromJson.
Example of JSON:
{ "typography": { "family": { "text": { "android": { "variable": "dm_sans_variable", // if `variable` variant is provided, others keys from same object are ignored "regular": "dm_sans_regular", "bold": "dm_sans_bold", "medium": "dm_sans_medium" } }, "display": { "android": { "regular": "dm_sans_regular", "bold": "dm_sans_bold", "medium": "dm_sans_medium" } } }, "letterSpacing": { "none": 0, "medium": -0.5, "large": -1.0, "extraLarge": -1.5 } }, "colorPalette": { "brand": "#ff006aff", "neutral": "#ffffffff", "black": "#ff000000" ... }, "displayMode": "LIGHT", // or "DARK" or "SYSTEM" "components": { "buttons": [ { "style": "primary", "surface": { "default": ["#000000", "#E8E8E8"], "hover": "#04FF5C", "pressed": "#00B540", "disabled": ["#EBECEF", "#000000"] }, "text": { "default": ["#FFFFFF", "#000000"], "disabled": ["#959595", "#666666"] }, "border": { "color": { "default": "#00D149", "hover": "#04FF5C", "pressed": "#00B540", "disabled": "#EBECEF" }, "width": 0, "radius": 15 } }, { "style": "secondary", "surface": { "default": ["#000000", "#E8E8E8"], "hover": "#04FF5C", "pressed": "#00B540", "disabled": ["#EBECEF", "#000000"] }, "text": { "default": ["#FFFFFF", "#000000"], "disabled": ["#959595", "#666666"] }, "border": { "color": { "default": "#00D149", "hover": "#04FF5C", "pressed": "#00B540", "disabled": "#EBECEF" }, "width": 2, "radius": 15 } } ] } }- Since:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classIncodeThemeConfig.Builder
-
Field Summary
Fields Modifier and Type Field Description private final IncodeTypographytypographyprivate final IncodeColorPalettecolorPaletteprivate final IncodeComponentscomponentsprivate final DisplayModedisplayMode
-
Constructor Summary
Constructors Constructor Description IncodeThemeConfig(IncodeTypography typography, IncodeColorPalette colorPalette, IncodeComponents components, DisplayMode displayMode)
-
Method Summary
Modifier and Type Method Description final IncodeTypographygetTypography()final IncodeColorPalettegetColorPalette()final IncodeComponentsgetComponents()final DisplayModegetDisplayMode()final StringtoJson(Context context)final static IncodeThemeConfigfromJson(Context context, String json)JSON deserialization of IncodeThemeConfig. -
-
Constructor Detail
-
IncodeThemeConfig
IncodeThemeConfig(IncodeTypography typography, IncodeColorPalette colorPalette, IncodeComponents components, DisplayMode displayMode)
- Parameters:
typography- The typography to be used in the configuration.colorPalette- The color palette to be used in the configuration.components- The components configuration including button styles; Default SDK values will be used unless provided by the user.displayMode- The display mode (light/dark/system) to be used in the configuration.
-
-
Method Detail
-
getTypography
final IncodeTypography getTypography()
-
getColorPalette
final IncodeColorPalette getColorPalette()
-
getComponents
final IncodeComponents getComponents()
-
getDisplayMode
final DisplayMode getDisplayMode()
-
fromJson
final static IncodeThemeConfig fromJson(Context context, String json)
JSON deserialization of IncodeThemeConfig.
- Parameters:
context- Context used for resolving resources while configuring the theme.json- Actual json value that represent IncodeThemeConfig.
-
-
-
-