File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,11 @@ A script that provides a working color picker for wayland and wlroots
44by leveraging [ grim] ( https://github.com/emersion/grim ) and
55[ slurp] ( https://github.com/emersion/slurp ) .
66
7+ ## Usage
8+ - Command ` wl-color-picker ` - Select position on screen and open color picker window
9+ - Command ` wl-color-picker clipboard ` - Select position on screen without opening color picker window, just copy selected color to clipboard
10+
11+
712## Inspiration
813
914This script is possible by the information provided on the following
Original file line number Diff line number Diff line change 4545 )
4646fi
4747
48- # Display a color picker and store the returned rgb color
49- rgb_color=$( zenity --color-selection \
50- --title=" Copy color to Clipboard" \
51- --color=" ${color} "
52- )
48+ if [ " $1 " == " clipboard" ]; then
49+ echo $color | wl-copy -n
50+ else
51+ # Display a color picker and store the returned rgb color
52+ rgb_color=$( zenity --color-selection \
53+ --title=" Copy color to Clipboard" \
54+ --color=" ${color} "
55+ )
5356
54- # Execute if user didn't click cancel
55- if [ " $rgb_color " != " " ]; then
56- # Convert rgb color to hex
57- hex_color=" #"
58- for value in $( echo " ${rgb_color} " | grep -E -o -m1 ' [0-9]+' ) ; do
59- hex_color=" $hex_color $( printf " %.2x" $value ) "
60- done
57+ # Execute if user didn't click cancel
58+ if [ " $rgb_color " != " " ]; then
59+ # Convert rgb color to hex
60+ hex_color=" #"
61+ for value in $( echo " ${rgb_color} " | grep -E -o -m1 ' [0-9]+' ) ; do
62+ hex_color=" $hex_color $( printf " %.2x" $value ) "
63+ done
6164
62- # Copy user selection to clipboard
63- echo $hex_color | wl-copy -n
65+ # Copy user selection to clipboard
66+ echo $hex_color | wl-copy -n
67+ fi
6468fi
You can’t perform that action at this time.
0 commit comments