dotfiles/hypr/scripts/colorpicker
2024-10-23 11:53:39 +02:00

24 lines
662 B
Bash
Executable File

#!/usr/bin/env bash
## Copyright (C) 2020-2024 Aditya Shakya <adi1090x@gmail.com>
##
## Simple Script To Pick Color Quickly.
#color=$(grim -g "`slurp -b 00000000 -p`" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:- | tail -n1 | cut -d' ' -f4)
color=`$HOME/.config/hypr/scripts/hyprpicker`
image=/tmp/${color}.png
main() {
if [[ "$color" ]]; then
# copy color code to clipboard
echo $color | tr -d "\n" | wl-copy
# generate preview
convert -size 48x48 xc:"$color" ${image}
# notify about it
notify-send -h string:x-canonical-private-synchronous:sys-notify-picker -u low -i ${image} "$color, copied to clipboard."
fi
}
# Run the script
main