add more color examples

This commit is contained in:
vcaesar 2017-12-25 17:17:50 +08:00
parent 4f85eb5056
commit e0fb010ae1
3 changed files with 25 additions and 1 deletions

View File

@ -125,8 +125,20 @@ func screen() {
// gets the pixel color at 100, 200.
color := robotgo.GetPixelColor(100, 200)
fmt.Println("color----", color, "-----------------")
clo := robotgo.GetPxColor(100, 200)
fmt.Println("color...", clo)
clostr := robotgo.PadHex(clo)
fmt.Println("color...", clostr)
rgb := robotgo.RgbToHex(255, 100, 200)
rgbstr := robotgo.PadHex(robotgo.U32ToHex(rgb))
fmt.Println("rgb...", rgbstr)
hex := robotgo.HexToRgb(uint32(rgb))
fmt.Println("hex...", hex)
hexh := robotgo.PadHex(robotgo.U8ToHex(hex))
fmt.Println("HexToRgb...", hexh)
// gets the pixel color at 10, 20.
color2 := robotgo.GetPixelColor(10, 20)

View File

@ -38,8 +38,20 @@ func main() {
// gets the pixel color at 100, 200.
color := robotgo.GetPixelColor(100, 200)
fmt.Println("color----", color, "-----------------")
clo := robotgo.GetPxColor(100, 200)
fmt.Println("color...", clo)
clostr := robotgo.PadHex(clo)
fmt.Println("color...", clostr)
rgb := robotgo.RgbToHex(255, 100, 200)
rgbstr := robotgo.PadHex(robotgo.U32ToHex(rgb))
fmt.Println("rgb...", rgbstr)
hex := robotgo.HexToRgb(uint32(rgb))
fmt.Println("hex...", hex)
hexh := robotgo.PadHex(robotgo.U8ToHex(hex))
fmt.Println("HexToRgb...", hexh)
// gets the pixel color at 10, 20.
color2 := robotgo.GetPixelColor(10, 20)