Created
May 5, 2024 15:43
-
-
Save cirrusUK/3aa26c4459c9a005059ee6c2038fb2e3 to your computer and use it in GitHub Desktop.
copy defined hex colorcode to clipboard
This file contains hidden or 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
#!/usr/bin/env bash | |
## Copyright (C) 2020-2024 <[email protected]> | |
## | |
## Simple script to pick color quickly. | |
color=$(xcolor --format hex --preview-size 255 --scale 10) | |
image=/tmp/${color}.png | |
main() { | |
if [[ "$color" ]]; then | |
# copy color code to clipboard | |
echo $color | tr -d "\n" | xclip -selection clipboard | |
# generate preview | |
convert -size 48x48 xc:"$color" ${image} | |
# notify about it | |
dunstify -u low -h string:x-dunst-stack-tag:obcolorpicker -i ${image} "$color, copied to clipboard." | |
fi | |
} | |
# run the script | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment