| 1 |
package terminal |
| 2 |
|
| 3 |
// |
| 4 |
//import ( |
| 5 |
// "fmt" |
| 6 |
// "image/color" |
| 7 |
//) |
| 8 |
// |
| 9 |
//var ( |
| 10 |
// White = color.RGBA{R: 255, G: 255, B: 255, A: 255} |
| 11 |
// Black = color.RGBA{A: 255} |
| 12 |
//) |
| 13 |
// |
| 14 |
//// hexToRGBA convert hex string into color.RGBA |
| 15 |
//func hexToRGBA(s string) color.RGBA { |
| 16 |
// c := color.RGBA{ |
| 17 |
// R: 0, |
| 18 |
// G: 0, |
| 19 |
// B: 0, |
| 20 |
// A: 0xff, |
| 21 |
// } |
| 22 |
// |
| 23 |
// var err error |
| 24 |
// switch len(s) { |
| 25 |
// case 7: |
| 26 |
// _, err = fmt.Sscanf(s, "#%02x%02x%02x", &c.R, &c.G, &c.B) |
| 27 |
// case 4: |
| 28 |
// _, err = fmt.Sscanf(s, "#%1x%1x%1x", &c.R, &c.G, &c.B) |
| 29 |
// // Double the hex digits: |
| 30 |
// c.R *= 17 |
| 31 |
// c.G *= 17 |
| 32 |
// c.B *= 17 |
| 33 |
// default: |
| 34 |
// err = fmt.Errorf("invalid length, must be 7 or 4") |
| 35 |
// } |
| 36 |
// if err != nil { |
| 37 |
// panic(err) |
| 38 |
// } |
| 39 |
// |
| 40 |
// return c |
| 41 |
//} |