Skip to content

Instantly share code, notes, and snippets.

@Thesola10
Last active January 31, 2022 10:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Thesola10/9b58fe80e2d2a6047ce563e9a78b0c8d to your computer and use it in GitHub Desktop.
Save Thesola10/9b58fe80e2d2a6047ce563e9a78b0c8d to your computer and use it in GitHub Desktop.
(in)elegant weapons, for a more civilized age.
#!/bin/bash
# chroma by Karim Vergnes <me@thesola.io>
# License: WTFPL 1.0
# Requires xrandr to work.
# Display to modify
: ${XRDISP:="eDP1"}
# Speed at which to alternate colors
: ${COEF:=1}
# Intensity of result
: ${MAX:=100}
xrandr_color_shift()
{
xrandr --output $XRDISP --gamma $1:$2:$3
}
# Increase factors
rinc=$COEF
ginc=1
binc=-$COEF
red=1
green=1
blue=$MAX
trap "xrandr_color_shift 1 1 1 && exit" INT
while true
do
xrandr_color_shift $red $green $blue
(( red += rinc ))
(( green += ginc ))
(( blue += binc ))
(( red >= $MAX )) && rinc=-$COEF ginc=$COEF binc=0
(( green >= $MAX )) && rinc=0 ginc=-$COEF binc=$COEF
(( blue >= $MAX )) && rinc=$COEF ginc=0 binc=-$COEF
done
@Thesola10
Copy link
Author

Just cycles the gamma on the selected display. To change the intensity, add a MAX environment variable. The COEF environment variable changes the step (the higher the value, the faster the colors will cycle)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment