mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 14:43:55 +00:00
33 lines
445 B
Go
33 lines
445 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/go-vgo/robotgo"
|
|
)
|
|
|
|
func colorPicker() {
|
|
m := robotgo.AddEvent("mleft")
|
|
if m {
|
|
x, y := robotgo.GetMousePos()
|
|
fmt.Println("mouse pos: ", x, y)
|
|
|
|
clo := robotgo.GetPixelColor(x, y)
|
|
fmt.Println("color: #", clo)
|
|
|
|
// clipboard
|
|
err := robotgo.WriteAll("#" + clo)
|
|
if err != nil {
|
|
fmt.Println("err: ", err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func main() {
|
|
fmt.Println("color picker...")
|
|
|
|
for {
|
|
colorPicker()
|
|
}
|
|
}
|