A fork of the Materia GTK theme.

Important information: Google announced that, from September 2026, Android devices will require ALL apps to be signed by Google, effectively leading to an iOS situation. Value your right to a computer that does what you want; do not tolerate this monopolistic practice! Contact me if you don't understand why it is bad. Click to learn more.

 darker.sh

View raw Download
text/x-shellscript • 698 B
Bourne-Again shell script, ASCII text executable
        
            
1
#!/usr/bin/env bash
2
set -ueo pipefail
3
#set -x
4
5
darker_channel() {
6
value="$1"
7
light_delta="$2"
8
value_int="$(bc <<< "ibase=16; $value")"
9
result="$(bc <<< "$value_int - $light_delta")"
10
if [[ "$result" -lt 0 ]]; then
11
result=0
12
fi
13
if [[ "$result" -gt 255 ]]; then
14
result=255
15
fi
16
echo "$result"
17
}
18
19
darker() {
20
hexinput="$(tr '[:lower:]' '[:upper:]' <<< "$1")"
21
light_delta="${2-10}"
22
23
a="$(cut -c-2 <<< "$hexinput")"
24
b="$(cut -c3-4 <<< "$hexinput")"
25
c="$(cut -c5-6 <<< "$hexinput")"
26
27
r="$(darker_channel "$a" "$light_delta")"
28
g="$(darker_channel "$b" "$light_delta")"
29
b="$(darker_channel "$c" "$light_delta")"
30
31
printf '%02x%02x%02x\n' "$r" "$g" "$b"
32
}
33
34
darker "$@"
35