mirror of
https://github.com/go-vgo/robotgo
synced 2026-05-24 10:19:01 +00:00
add color picker and get mouse pos example
This commit is contained in:
parent
e2fd078da8
commit
83845a8488
1 changed files with 24 additions and 0 deletions
24
examples/color-picker/main.go
Normal file
24
examples/color-picker/main.go
Normal file
|
|
@ -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()
|
||||
}
|
||||
Loading…
Reference in a new issue