Adjustment of theme is done through theme variables. These variables can be set through Shoutem builder, which interprets the variables schema.
Variables schema file is nothing else than Shoutem flavored JSON Schema.
Example:
{
"properties": {
"primaryColor": {
"type": "string",
"format": "color",
"title": "Primary color",
"default": "rgba(12, 111, 34, 0.5)"
},
"textFont": {
"type": "object",
"format": "font",
"title": "Text font",
"default": {
"fontFamily": "rubicon",
"fontStyle": "normal",
"fontWeight": "regular",
"fontSize": 15,
"color": "rgba(255,255,255,1)"
}
}
},
"layout": {
"sections": [{
"title": "Colors",
"properties": ["primaryColor"]
}, {
"title": "Text",
"properties": ["textFont"]
}]
}
}
It’s properties are the variable descriptors - they describe the variable to the Shoutem builder. For now, there are only 2 types of variables:
"type": "string", "format": "color""type": "object", "format": "font"Based on what the type is, descriptor has different fields. However, some fields are shared:
false.Variable of type color will result in color picker in interface for customizing theme.
String. One of the React Native supported Color formats.
Currently, there are no additional properties variable descriptor supports.
Variable of type font will result in complex control in interface for customizing theme.
Object with following fields:
{
"fontFamily": "rubicon",
"fontStyle": "normal",
"fontWeight": "normal",
"fontSize": 20,
"color": "rgba(255,255,255,1)"
}
"normal", "italic". Defaults to “normal”."normal", "bold", "100", "200", "300", "400", "500", "600", "700", "800", "900""rgba(0,0,0,1)"These are the additional properties font variable descriptor supports: