Created
March 1, 2024 16:12
-
-
Save derricw/9dd7aaf0083bd85d3cf64fdf12358e63 to your computer and use it in GitHub Desktop.
bash color picker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
color=$(gdbus call --session --dest org.gnome.Shell.Screenshot --object-path /org/gnome/Shell/Screenshot --method org.gnome.Shell.Screenshot.PickColor) | |
echo "COLOR: $color" | |
numbers=$(echo $color | sed 's/[^0-9,.]*//g') | |
echo "FLOAT: $numbers" | |
rgb=$(echo $numbers | awk -F',' '{ print $1 * 255, $2 * 255, $3 * 255 }') | |
echo "RGB: $rgb" | |
printf "HEX: #%x%x%x\n" $rgb | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment