aboutsummaryrefslogtreecommitdiff
path: root/hypr/.config/hypr/scripts/colorpicker
diff options
context:
space:
mode:
Diffstat (limited to 'hypr/.config/hypr/scripts/colorpicker')
-rwxr-xr-xhypr/.config/hypr/scripts/colorpicker20
1 files changed, 20 insertions, 0 deletions
diff --git a/hypr/.config/hypr/scripts/colorpicker b/hypr/.config/hypr/scripts/colorpicker
new file mode 100755
index 0000000..8f214eb
--- /dev/null
+++ b/hypr/.config/hypr/scripts/colorpicker
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+## Simple Script To Pick Color Quickly.
+
+color=$(grim -g "$(slurp -b 1B1F2800 -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:- | tail -n1 | cut -d' ' -f4)
+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 -u low -i ${image} "$color, copied to clipboard."
+ fi
+}
+
+# Run the script
+main