Misc fixes, color script and hex <-> color conversions
This commit is contained in:
@@ -67,4 +67,37 @@ pushall() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hex2color(){
|
||||||
|
hex=${1#"#"}
|
||||||
|
r=$(printf '0x%0.2s' "$hex")
|
||||||
|
g=$(printf '0x%0.2s' ${hex#??})
|
||||||
|
b=$(printf '0x%0.2s' ${hex#????})
|
||||||
|
printf '%03d' "$(( (r<75?0:(r-35)/40)*6*6 +
|
||||||
|
(g<75?0:(g-35)/40)*6 +
|
||||||
|
(b<75?0:(b-35)/40) + 16 ))"
|
||||||
|
}
|
||||||
|
|
||||||
|
color2hex(){
|
||||||
|
dec=$(($1%256)) ### input must be a number in range 0-255.
|
||||||
|
if [ "$dec" -lt "16" ]; then
|
||||||
|
bas=$(( dec%16 ))
|
||||||
|
mul=128
|
||||||
|
[ "$bas" -eq "7" ] && mul=192
|
||||||
|
[ "$bas" -eq "8" ] && bas=7
|
||||||
|
[ "$bas" -gt "8" ] && mul=255
|
||||||
|
a="$(( (bas&1) *mul ))"
|
||||||
|
b="$(( ((bas&2)>>1)*mul ))"
|
||||||
|
c="$(( ((bas&4)>>2)*mul ))"
|
||||||
|
printf 'dec= %3s basic= #%02x%02x%02x\n' "$dec" "$a" "$b" "$c"
|
||||||
|
elif [ "$dec" -gt 15 ] && [ "$dec" -lt 232 ]; then
|
||||||
|
b=$(( (dec-16)%6 )); b=$(( b==0?0: b*40 + 55 ))
|
||||||
|
g=$(( (dec-16)/6%6)); g=$(( g==0?0: g*40 + 55 ))
|
||||||
|
r=$(( (dec-16)/36 )); r=$(( r==0?0: r*40 + 55 ))
|
||||||
|
printf 'dec= %3s color= #%02x%02x%02x\n' "$dec" "$r" "$g" "$b"
|
||||||
|
else
|
||||||
|
gray=$(( (dec-232)*10+8 ))
|
||||||
|
printf 'dec= %3s gray= #%02x%02x%02x\n' "$dec" "$gray" "$gray" "$gray"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
set completion-ignore-case On
|
set completion-ignore-case On
|
||||||
|
|||||||
@@ -216,9 +216,9 @@ default_floating_border pixel 3
|
|||||||
smart_borders on
|
smart_borders on
|
||||||
|
|
||||||
# Border colors
|
# Border colors
|
||||||
client.focused #fab387 #fab387 #1e1e2e
|
client.focused #d75f5f #d75f5f #1e1e2e
|
||||||
client.unfocused #1e1e2e #1e1e2e #cdd6f4
|
client.unfocused #1e1e2e #1e1e2e #cdd6f4
|
||||||
client.focused_inactive #fab387 #fab387 #1e1e2e
|
client.focused_inactive #1e1e2e #1e1e2e #1e1e2e
|
||||||
client.placeholder #f9e2af #f9e2af #1e1e2e
|
client.placeholder #f9e2af #f9e2af #1e1e2e
|
||||||
client.urgent #f38ba8 #f38ba8 #1e1e2e
|
client.urgent #f38ba8 #f38ba8 #1e1e2e
|
||||||
client.background #1e1e2e
|
client.background #1e1e2e
|
||||||
|
|||||||
6
scripts/colors.sh
Executable file
6
scripts/colors.sh
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
for i in {0..255} ; do
|
||||||
|
printf "\x1b[48;5;%sm%3d\e[0m " "$i" "$i"
|
||||||
|
if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then
|
||||||
|
printf "\n";
|
||||||
|
fi
|
||||||
|
done
|
||||||
0
scripts/oneline.sh
Normal file → Executable file
0
scripts/oneline.sh
Normal file → Executable file
Reference in New Issue
Block a user