Skip to content

Commit

Permalink
add dark/light mode natively, supported from 2021.06
Browse files Browse the repository at this point in the history
  • Loading branch information
basnijholt committed Jun 4, 2021
1 parent a133c62 commit 555dde9
Show file tree
Hide file tree
Showing 5 changed files with 1,902 additions and 2,818 deletions.
21 changes: 7 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,13 @@
A generalized version of [*iOS Dark Mode Theme*](https://github.com/basnijholt/lovelace-ios-dark-mode-theme)!
This includes both **Dark and Light Mode** and 7 different HomeKit backgrounds.
Installing this theme adds 28 different themes:
- `ios-light-mode-dark-green`
- `ios-dark-mode-dark-green`
- `ios-light-mode-light-blue`
- `ios-dark-mode-light-blue`
- `ios-light-mode-light-green`
- `ios-dark-mode-light-green`
- `ios-light-mode-orange`
- `ios-dark-mode-orange`
- `ios-light-mode-blue-red`
- `ios-dark-mode-blue-red`
- `ios-light-mode-red`
- `ios-dark-mode-red`
- `ios-light-mode-dark-blue`
- `ios-dark-mode-dark-blue`
- `ios-dark-green`
- `ios-light-blue`
- `ios-light-green`
- `ios-orange`
- `ios-blue-red`
- `ios-red`
- `ios-dark-blue`
- `...` and versions with the `-alternative` suffix

## Screenshots
Expand Down
52 changes: 27 additions & 25 deletions create-themes.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,30 @@ def average_color(fname):
for background in Path("themes").glob("homekit-bg-*.jpg"):
color = background.stem.split("homekit-bg-")[-1]
app_header_background_color = average_color(background)
for which in ["light", "dark"]:
for state_icon_yellow in [False, True]:
settings = {k: parse(v[which]) for k, v in all_settings.items()}

if state_icon_yellow:
settings["state_icon_active_color"] = "rgba(255, 214, 10, 1)"
suffix = ""
else:
suffix = "-alternative"

with open("template.jinja2") as f:
template = jinja2.Template("".join(f.readlines()))

result = template.render(
**settings,
folder=folder,
which=which,
app_header_background_color=app_header_background_color,
background_jpg=str(background.name),
color=color,
suffix=suffix,
)

with fname.open("a") as f:
f.write("\n" + result + "\n")

for state_icon_yellow in [False, True]:
settings = {
k: {_k: parse(_v) for _k, _v in v.items()}
for k, v in all_settings.items()
}
if state_icon_yellow:
dct = settings["state_icon_active_color"]
dct["light"] = dct["dark"] = "rgba(255, 214, 10, 1)"
suffix = ""
else:
suffix = "-alternative"

with open("template.jinja2") as f:
template = jinja2.Template("".join(f.readlines()))

result = template.render(
**settings,
folder=folder,
app_header_background_color=app_header_background_color,
background_jpg=str(background.name),
color=color,
suffix=suffix,
)

with fname.open("a") as f:
f.write("\n" + result + "\n")
Loading

0 comments on commit 555dde9

Please sign in to comment.