mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 14:43:55 +00:00
add color picker and get mouse pos example
This commit is contained in:
parent
e2fd078da8
commit
83845a8488
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 New Issue
Block a user