From 82df70eff06e7b44ee84283070d7f801f7fc1d92 Mon Sep 17 00:00:00 2001 From: Sam Chudnick Date: Sat, 6 Nov 2021 20:25:45 -0400 Subject: initial commit --- .local/bin/theme/get-gradient | 13 +++++++++++++ .local/bin/theme/gradient.py | 24 ++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100755 .local/bin/theme/get-gradient create mode 100755 .local/bin/theme/gradient.py (limited to '.local/bin/theme') diff --git a/.local/bin/theme/get-gradient b/.local/bin/theme/get-gradient new file mode 100755 index 0000000..91f9391 --- /dev/null +++ b/.local/bin/theme/get-gradient @@ -0,0 +1,13 @@ +#!/bin/sh +# Gets and sets a color gradient for cava + +start="$1" +end="$2" +colors=$(~/.local/bin/theme/gradient.py $start $end 7) + +num=1 +path="$HOME/.config/cava/config" +for color in $colors; do + sed -i "s/gradient_color_$num.*$/gradient_color_$num = '$color'/" $path + num=$((num+1)) +done diff --git a/.local/bin/theme/gradient.py b/.local/bin/theme/gradient.py new file mode 100755 index 0000000..f95bb07 --- /dev/null +++ b/.local/bin/theme/gradient.py @@ -0,0 +1,24 @@ +#!/usr/bin/python3 +# Gets a color gradient based on input color and number +# Depends on python3-colour + +import colour,sys + +if len(sys.argv) != 4: + print("arg error") + sys.exit(1) + +start = sys.argv[1] +end = sys.argv[2] +num = int(sys.argv[3]) + +grad = colour.color_scale(colour.hex2hsl(start),colour.hex2hsl(end),num) +grad_hex = [] +for hsl in grad: + grad_hex.append(colour.hsl2hex(hsl)) + +for color in grad_hex: + sys.stdout.write(color + "\n") + + + -- cgit v1.2.3