Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions docs/theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,25 @@ Now you can use the facade:

```brightscript
theme = ThemeFacade()
theme.getFont("regular") ' It corresponds to the font name defined in the getMyTheme function.
theme.getFontUri("regular")' It is the same as getFont but returns uri
theme.rgba("0x00000000", 0.8) ' 1 represents "FF" and 0 - "00". All other values are between them.
theme.colors.white ' Other data that is passed to theme node
theme.getFont("regular", 28) ' It corresponds to the font name defined in the getMyTheme function.
theme.getScaledFont("regular", 28) ' Scales font size using current resolution and FHD baseline
theme.getFontUri("regular") ' It is the same as getFont but returns uri
theme.scaleX(320) ' Scales value against resolution width / 1920
theme.scaleY(180) ' Scales value against resolution height / 1080
theme.scaleUniform(48) ' Uses smaller of X/Y scale
size = theme.scaleSize([320, 180]) ' Returns [scaledWidth, scaledHeight]
theme.rgba("0x00000000", 0.8) ' 1 represents "FF" and 0 - "00". All other values are between them.
theme.colors.white ' Other data that is passed to theme node
```

Built-in helpers use `theme.resolution.width` and `theme.resolution.height` if present. Missing resolution falls back to the FHD baseline `1920x1080`, so existing apps keep current behaviour until they opt in.

Available built-in helpers:
- `getFont(fontName as String, sizeInPixels as Integer) as Object`
- `getScaledFont(fontName as String, sizeInPixels as Float, mode = "uniform" as String) as Object`
- `getFontUri(fontName as String) as String`
- `scaleX(value as Float) as Integer`
- `scaleY(value as Float) as Integer`
- `scaleUniform(value as Float) as Integer`
- `scaleSize(size as Object) as Object`
- `rgba(color as String, opacity as Float) as String`
Loading