hyprland + waybar + GTK (Catpuccin)
This commit is contained in:
34
home-modules/theme/theme_oomox/scripts/darker.sh
Executable file
34
home-modules/theme/theme_oomox/scripts/darker.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ueo pipefail
|
||||
#set -x
|
||||
|
||||
darker_channel() {
|
||||
value="$1"
|
||||
light_delta="$2"
|
||||
value_int="$(bc <<< "ibase=16; $value")"
|
||||
result="$(bc <<< "$value_int - $light_delta")"
|
||||
if [[ "$result" -lt 0 ]]; then
|
||||
result=0
|
||||
fi
|
||||
if [[ "$result" -gt 255 ]]; then
|
||||
result=255
|
||||
fi
|
||||
echo "$result"
|
||||
}
|
||||
|
||||
darker() {
|
||||
hexinput="$(tr '[:lower:]' '[:upper:]' <<< "$1")"
|
||||
light_delta="${2-10}"
|
||||
|
||||
a="$(cut -c-2 <<< "$hexinput")"
|
||||
b="$(cut -c3-4 <<< "$hexinput")"
|
||||
c="$(cut -c5-6 <<< "$hexinput")"
|
||||
|
||||
r="$(darker_channel "$a" "$light_delta")"
|
||||
g="$(darker_channel "$b" "$light_delta")"
|
||||
b="$(darker_channel "$c" "$light_delta")"
|
||||
|
||||
printf '%02x%02x%02x\n' "$r" "$g" "$b"
|
||||
}
|
||||
|
||||
darker "$@"
|
||||
16
home-modules/theme/theme_oomox/scripts/is_dark.sh
Executable file
16
home-modules/theme/theme_oomox/scripts/is_dark.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
script_dir="$(readlink -f "$(dirname "${0}")")"
|
||||
|
||||
is_dark() {
|
||||
hexinput=$(echo "${1}" | tr '[:lower:]' '[:upper:]')
|
||||
half_darker=$("${script_dir}/darker.sh" "${hexinput}" 88)
|
||||
if [[ "${half_darker}" = "000000" ]] ; then
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
fi
|
||||
}
|
||||
|
||||
is_dark "$@"
|
||||
37
home-modules/theme/theme_oomox/scripts/mix.sh
Executable file
37
home-modules/theme/theme_oomox/scripts/mix.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ueo pipefail
|
||||
#set -x
|
||||
|
||||
mix_channel() {
|
||||
value1="$(printf '%03d' "0x$1")"
|
||||
value2="$(printf '%03d' "0x$2")"
|
||||
ratio="$3"
|
||||
result="$(bc <<< "scale=0; ($value1 * 100 * $ratio + $value2 * 100 * (1 - $ratio)) / 100")"
|
||||
if [[ "$result" -lt 0 ]]; then
|
||||
result=0
|
||||
elif [[ "$result" -gt 255 ]]; then
|
||||
result=255
|
||||
fi
|
||||
echo "$result"
|
||||
}
|
||||
|
||||
mix() {
|
||||
hexinput1="$(tr '[:lower:]' '[:upper:]' <<< "$1")"
|
||||
hexinput2="$(tr '[:lower:]' '[:upper:]' <<< "$2")"
|
||||
ratio="${3-0.5}"
|
||||
|
||||
a="$(cut -c-2 <<< "$hexinput1")"
|
||||
b="$(cut -c3-4 <<< "$hexinput1")"
|
||||
c="$(cut -c5-6 <<< "$hexinput1")"
|
||||
d="$(cut -c-2 <<< "$hexinput2")"
|
||||
e="$(cut -c3-4 <<< "$hexinput2")"
|
||||
f="$(cut -c5-6 <<< "$hexinput2")"
|
||||
|
||||
r="$(mix_channel "$a" "$d" "$ratio")"
|
||||
g="$(mix_channel "$b" "$e" "$ratio")"
|
||||
b="$(mix_channel "$c" "$f" "$ratio")"
|
||||
|
||||
printf '%02x%02x%02x\n' "$r" "$g" "$b"
|
||||
}
|
||||
|
||||
mix "$@"
|
||||
Reference in New Issue
Block a user