From 83845a8488ffbc5ffa2789124283c0f400457145 Mon Sep 17 00:00:00 2001 From: vcaesar Date: Sun, 21 Oct 2018 12:48:34 -0400 Subject: [PATCH] add color picker and get mouse pos example --- examples/color-picker/main.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 examples/color-picker/main.go diff --git a/examples/color-picker/main.go b/examples/color-picker/main.go new file mode 100644 index 0000000..c5ad23e --- /dev/null +++ b/examples/color-picker/main.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "github.com/go-vgo/robotgo" +) + +func colorPicker() { + m := robotgo.AddEvent("mleft") + if m == 0 { + x, y := robotgo.GetMousePos() + fmt.Println("mouse pos: ", x, y) + + clo := robotgo.GetPixelColor(x, y) + fmt.Println("color: #", clo) + } +} + +func main() { + fmt.Println("color picker...") + + colorPicker() +}