Skip to content

Commit

Permalink
Use GitHub URL for background image
Browse files Browse the repository at this point in the history
  • Loading branch information
basnijholt committed Sep 7, 2024
1 parent a37376d commit c27fbbc
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 62 deletions.
13 changes: 7 additions & 6 deletions create-themes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
with open("settings-light-dark.yaml", "r") as f:
all_settings = yaml.safe_load(f)

COMMIT = "a37376d918fcfe4785be99910dc9a7200ac37da9"

BASE_URL = f"https://raw.githubusercontent.com/basnijholt/lovelace-ios-themes/{COMMIT}/themes"

def parse(x):
return x if "#" not in x else f'"{x}"'
Expand All @@ -25,11 +28,9 @@ def average_color(fname):
return "rgba({}, {}, {}, 0.4)".format(*rgb_color)


def base64_encode_file(fname):
with open(fname, 'rb') as image_file:
extension = fname.suffix.split('.')[-1]
base64_utf8_str = base64.b64encode(image_file.read()).decode('utf-8')
return f'data:image/{extension};base64,{base64_utf8_str}'
def fname_to_url(fname):
return f"{BASE_URL}/{fname.name}"


BACKGROUND_COLORS = {
# Suggested by @okets in issue #42
Expand Down Expand Up @@ -75,7 +76,7 @@ def base64_encode_file(fname):
folder=folder,
which=which,
app_header_background_color=app_header_background_color,
background_jpg=base64_encode_file(background),
background_jpg=fname_to_url(background),
# background_jpg=str(background.name),
color=color,
suffix=suffix,
Expand Down
56 changes: 28 additions & 28 deletions manual-install/ios-themes.yaml

Large diffs are not rendered by default.

56 changes: 28 additions & 28 deletions themes/ios-themes.yaml

Large diffs are not rendered by default.

0 comments on commit c27fbbc

Please sign in to comment.