Skip to content

Instantly share code, notes, and snippets.

@lsjostro
Created September 5, 2022 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lsjostro/8253985f7d16724f08e82a18828de13a to your computer and use it in GitHub Desktop.
Save lsjostro/8253985f7d16724f08e82a18828de13a to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e -o pipefail
gdbus call --session --dest org.gnome.Shell.Screenshot --object-path /org/gnome/Shell/Screenshot --method org.gnome.Shell.Screenshot.PickColor |
sed 's#.*: <(\([0-9].[0-9]*\), \([0-9].[0-9]*\), \([0-9].[0-9]*\).*#{"r":\1, "g":\2, "b":\3 }#' |
jq -r '{r:(.r*255),g:(.g*255),b:(.b*255)}| join(" ")' |
xargs printf "#%x%x%x\n" | xclip -selection clipboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment