From ecb0f83cd4d6213d7eaf2573fd0d668afa878366 Mon Sep 17 00:00:00 2001 From: Mark Stosberg Date: Sat, 1 Aug 2020 18:12:54 -0400 Subject: [PATCH] Add tips for HTML color picking --- Tricks.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Tricks.md b/Tricks.md index 83565f4..183898e 100644 --- a/Tricks.md +++ b/Tricks.md @@ -2,6 +2,25 @@ swaymsg -t get_outputs | jq -r '.[] | select(.focused) | (.current_mode.width | tostring) + "x" + (.current_mode.height | tostring)' +# HTML color picker + +Bind this to a key, select a point on the screen and get a HTML color code for that point copied to the clipboard. Requires ImageMagick, `grim` and `slurp` to be installed. + + grim -g "$(slurp -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:- | tail -n 1 | cut -d ' ' -f 4 | wl-copy + +If you don't use a color picker frequently enough to reminder the keybinding, you can create a simple .desktop file for it in ~/.local/share/applications/ and then launch it searching for the name with a desktop file launcher like Rofi. Here's an example .desktop file: + +`Name=HTML Color Picker for Sway` +`Comment=Copies to Clipboard` +`Keywords=` +`Exec=/home/yourusername/.local/bin/html-color-picker-for-sway` +`Terminal=false` +`Type=Application` +`StartupNotify=true` + +Put the command above in `~/.local/bin/html-color-picker-for-sway` and add a shebang line as the first line: `#!/usr/bin/env bash` + + # Tamefox - suspend Firefox when loses focus ```