dotfiles/.local/bin/rgb-control

49 lines
837 B
Text
Raw Normal View History

2021-01-16 00:20:54 +01:00
#!/bin/bash
declare -A colors=(
[r]=0 # Red
[o]=10 # Orange
[y]=30 # Yellow
[h]=70 # cHartreuse
[g]=120 # Green
[s]=135 # Spring
[c]=165 # Cyan
[a]=210 # Azure
[b]=240 # Blue
[v]=270 # Violet
[m]=320 # Magenta
[p]=350 # Pink
)
declare -A colors_name=(
[r]="red"
[o]="orange"
[y]="yellow"
[h]="chartreuse"
[g]="green"
[s]="spring"
[c]="cyan"
[a]="azure"
[b]="blue"
[v]="violet"
[m]="magenta"
[p]="pink"
)
2021-01-16 00:27:10 +01:00
if [[ "$1" == "off" ]]
then
openrgb -d 0 -c 000000 &>/dev/null
exit
elif [[ "$1" == "cycle" || "$#" -eq 0 ]]
then
openrgb -d 0 -m "Color Cycle" &>/dev/null
exit
fi
2021-01-16 00:20:54 +01:00
lumi=20
2021-01-16 00:27:10 +01:00
mode=${3:-Direct} # Direct, Pulse, Flashing
logo="$(hsv2rgb "${colors[${1}]}" 100 "$lumi")"
fans="$(hsv2rgb "${colors[${2:-$1}]}" 100 "$lumi")"
2021-01-16 00:20:54 +01:00
openrgb -d 0 -m "$mode" -c 000000,000000,"$logo","$logo","$fans",000000 &>/dev/null