-
Notifications
You must be signed in to change notification settings - Fork 8
/
reference.go
52 lines (46 loc) · 957 Bytes
/
reference.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package colors
import (
"image/color"
"github.com/grokify/mogo/math/mathutil"
)
// GoogleChartColorsHex is the color palette for Google Charts as collected by
// Craig Davis here: https://gist.github.com/there4/2579834
var GoogleChartColorsHex = [...]string{
"#3366CC",
"#DC3912",
"#FF9900",
"#109618",
"#990099",
"#3B3EAC",
"#0099C6",
"#DD4477",
"#66AA00",
"#B82E2E",
"#316395",
"#994499",
"#22AA99",
"#AAAA11",
"#6633CC",
"#E67300",
"#8B0707",
"#329262",
"#5574A6",
"#3B3EAC",
}
func GetGoogleChartColors() []color.RGBA {
rgbas := []color.RGBA{}
for _, hex := range GoogleChartColorsHex {
rgb, err := ParseHex(hex)
if err != nil {
panic(err)
}
rgbas = append(rgbas, rgb)
}
return rgbas
}
var GoogleChartColors = GetGoogleChartColors()
func GoogleChartColorX(index uint64) color.RGBA {
_, remainder := mathutil.DivideInt64(int64(index),
int64(len(GoogleChartColorsHex)))
return GoogleChartColors[remainder]
}