33 lines
682 B
Go
33 lines
682 B
Go
package main
|
|
|
|
import (
|
|
"bufio"
|
|
"fmt"
|
|
hsv "git.snrd.eu/sunred/humanshader/validator"
|
|
"os"
|
|
"strconv"
|
|
)
|
|
|
|
func main() {
|
|
args := os.Args[1:]
|
|
var pxX int
|
|
var pxY int
|
|
if len(args) == 2 {
|
|
pxX, _ = strconv.Atoi(args[0])
|
|
pxY, _ = strconv.Atoi(args[1])
|
|
} else {
|
|
fmt.Print("Pixel x coordinate: ")
|
|
input := bufio.NewScanner(os.Stdin)
|
|
input.Scan()
|
|
pxX, _ = strconv.Atoi(input.Text())
|
|
fmt.Print("Pixel y coordinate: ")
|
|
input = bufio.NewScanner(os.Stdin)
|
|
input.Scan()
|
|
pxY, _ = strconv.Atoi(input.Text())
|
|
}
|
|
|
|
val := hsv.NewValidator(true)
|
|
val.Calculate(pxX, pxY)
|
|
r, g, b := val.GetColor()
|
|
fmt.Printf("R: %d\nG: %d\nB: %d\nHEX: #%02X%02X%02X\n", r, g, b, r, g, b)
|
|
}
|