This commit is contained in:
flick0
2023-10-15 17:07:12 +00:00
parent d871dd23a3
commit 2003be0bb3
3 changed files with 36 additions and 12 deletions

View File

@@ -31,7 +31,7 @@ def apply(pre=None,wallpaper=None):
if line and not line.startswith("#"):
color,value = line.split(":")
if color.isnumeric():
new_colors[color.strip()] = colormix(value.strip(),colors["colors"]["color"+color.strip()],mix=0.90)
new_colors[color.strip()] = colormix(value.strip(),colors["colors"]["color"+color.strip()],mix=0.75)
for color,value in colors["special"].items():
new_colors[color] = value
@@ -44,9 +44,6 @@ def apply(pre=None,wallpaper=None):
for color,value in colors["colors"].items():
f.write(f"{color[5:]}: {value}\n")
for color,value in colors["special"].items():
if color == "cursor":
f.write(f"cursor: {colors['colors']['color5']}\n")
continue
f.write(f"{color}: {value}\n")
subprocess.run("touch ~/.config/hypr/themes/uicolors",shell=True)

View File

@@ -19,12 +19,12 @@ json=$(echo $json | jq '.[0]')
width=$(echo $json | jq '.width')
height=$(echo $json | jq '.height')
# if [ -f /tmp/prev_bg.png ]; then
# if cmp -s "$1" /tmp/prev_bg.png; then
# echo "Image is the same"
# exit 0
# fi
# fi
if [ -f /tmp/prev_bg.png ]; then
if cmp -s "$1" /tmp/prev_bg.png; then
echo "Image is the same"
exit 0
fi
fi
cp "$1" /tmp/prev_bg.png

View File

@@ -4,13 +4,23 @@ import pywal
import argparse
import os
import subprocess
import numpy as np
import matplotlib as mpl
THEME_DIR = os.environ.get("HYPRLAND_THEME")
print(THEME_DIR)
def colormix(c1,c2,mix=0):
#get np arrays c1 and c2 from hex
c1 = np.array(mpl.colors.to_rgb(c1))
c2 = np.array(mpl.colors.to_rgb(c2))
return mpl.colors.to_hex((1-mix)*c1 + mix*c2)
def apply(pre=None,wallpaper=None):
if not pre:
colors = pywal.colors.get(wallpaper,backend="colorz")
colors = pywal.colors.get(wallpaper,backend="wal")
else:
colors = pre
print(wallpaper)
@@ -18,6 +28,23 @@ def apply(pre=None,wallpaper=None):
cmd = f"swww img '{wallpaper}' --transition-type simple --transition-step 15"
subprocess.run(cmd,shell=True)
with open(os.path.expanduser("~/.config/hypr/themes/colors_base"),"r") as cr:
raw = cr.read()
new_colors = {}
for line in raw.split("\n"):
if line and not line.startswith("#"):
color,value = line.split(":")
if color.isnumeric():
new_colors[color.strip()] = colormix(value.strip(),colors["colors"]["color"+color.strip()],mix=0.75)
for color,value in colors["special"].items():
new_colors[color] = value
with open(os.path.expanduser("~/.config/hypr/themes/colors"),"w") as f:
for color,value in new_colors.items():
f.write(f"{color}: {value}\n")
with open(os.path.expanduser("~/.config/hypr/themes/uicolors"),"w") as f:
for color,value in colors["colors"].items():
@@ -25,7 +52,7 @@ def apply(pre=None,wallpaper=None):
for color,value in colors["special"].items():
f.write(f"{color}: {value}\n")
#subprocess.run("touch ~/.config/hypr/themes/uicolors",shell=True)
subprocess.run("touch ~/.config/hypr/themes/uicolors",shell=True)
subprocess.run("pkill -USR2 fish",shell=True)
# active borders