archcraft-openbox/files/scripts/ob-colorpicker

23 lines
550 B
Plaintext
Raw Permalink Normal View History

2023-10-05 10:09:04 +00:00
#!/usr/bin/env bash
## Copyright (C) 2020-2024 Aditya Shakya <adi1090x@gmail.com>
2023-10-05 10:09:04 +00:00
##
## 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