Skip to content

Az-21/material-you-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Material You Adapter

Adapt Material You (M3) theme files to various languages and technologies

Usage

  1. Export Jetpack Compose (Kotlin) theme from Material Theme Builder.
  2. [Optional] Rename the zip file; output will use the name of zip file(s).
  3. Place the .zip file in Input/ folder of this program.
  4. Run main.py.
  5. Find generated outputs in Output/ folder.

Important

This project supports uv package manager. Simply run

uv run ./main.py

Tip

This script supports multiple theme files. All .zip files inside Input/ folder will be adapted.

Outputs

Typst

Typst is a markup-based typesetting system.

Sample Output

#let m3light = (
  primary: rgb("#4C662B"),
  onPrimary: rgb("#FFFFFF"),
  //...
)

#let m3dark = (
  primary: rgb("#B1D18A"),
  onPrimary: rgb("#1F3701"),
  // ...
)

Usage

#import "color.typ": m3dark, m3light

#box(width: 32pt, height: 32pt, fill: m3dark.primary)
#box(width: 32pt, height: 32pt, fill: m3light.primary)

Power Apps

Power Apps is a low-code application building tool.

Sample Output

// Light
Set(M3Primary, ColorValue("#4C662B"));
Set(M3OnPrimary, ColorValue("#FFFFFF"));
// ...
// Dark
Set(M3Primary, ColorValue("#B1D18A"));
Set(M3OnPrimary, ColorValue("#1F3701"));
// ...

Usage

  • Copy paste the variable declarations in the OnStart $f x$ parameter of the App.

Python

Sample Output

@dataclass(frozen=True)
class LightTheme:
  primary: str = "#4C662B"
  onPrimary: str = "#FFFFFF"
  # ...

@dataclass(frozen=True)
class DarkTheme:
  primary: str = "#B1D18A"
  onPrimary: str = "#1F3701"
  # ...

dark = DarkTheme()
light = LightTheme()

Usage

from src.theme.colors import dark as m3
#                            ^--^ Easily switch theme by changing just one line

print(m3.primary)
# Alternatively call both light and dark variants
import src.theme.colors as m3
print(m3.dark.primary)
print(m3.light.primary)

About

🎨 Adapt Material You (M3) theme files to various languages and technologies

Topics

Resources

License

Stars

Watchers

Forks

Languages