Adapt Material You (M3) theme files to various languages and technologies
- Export Jetpack Compose (Kotlin) theme from Material Theme Builder.
- [Optional] Rename the zip file; output will use the name of zip file(s).
- Place the
.zip
file inInput/
folder of this program. - Run
main.py
. - Find generated outputs in
Output/
folder.
Tip
This script supports multiple theme files. All .zip
files inside Input/
folder will be adapted.
// Generated by Material Theme Builder (zip file > ui/theme/Color.kt)
val primaryLight = Color(0xFF4C662B)
val onPrimaryLight = Color(0xFFFFFFFF)
// ...
val primaryDark = Color(0xFFB1D18A)
val onPrimaryDark = Color(0xFF1F3701)
// ...
Typst is a markup-based typesetting system.
#let m3light = (
primary: rgb("#4C662B"),
onPrimary: rgb("#FFFFFF"),
//...
)
#let m3dark = (
primary: rgb("#B1D18A"),
onPrimary: rgb("#1F3701"),
// ...
)
#import "color.typ": m3dark, m3light
#box(width: 32pt, height: 32pt, fill: m3dark.primary)
#box(width: 32pt, height: 32pt, fill: m3light.primary)
Power Apps is a low-code application building tool.
Note
To reduce modifications required when switching themes, this module generates dark mode and light mode in separate files.
// Light
Set(M3Primary, ColorValue("#4C662B"));
Set(M3OnPrimary, ColorValue("#FFFFFF"));
// ...
// Dark
Set(M3Primary, ColorValue("#B1D18A"));
Set(M3OnPrimary, ColorValue("#1F3701"));
// ...
- Copy paste the variable declarations in the
OnStart
$f x$ parameter of the App.