-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path_gamut.go
51 lines (41 loc) · 1.04 KB
/
_gamut.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
package color
import (
"image/color"
"github.com/muesli/gamut"
)
func Monochromatic(c RGBA, count int) []RGBA {
res := gamut.Monochromatic(toGoColor(c), count)
return convert(res)
}
func Shades(c RGBA, count int) []RGBA {
res := gamut.Shades(toGoColor(c), count)
return convert(res)
}
func Tints(c RGBA, count int) []RGBA {
res := gamut.Tints(toGoColor(c), count)
return convert(res)
}
func Tones(c RGBA, count int) []RGBA {
res := gamut.Tones(toGoColor(c), count)
return convert(res)
}
func Blends(a, b RGBA, count int) []RGBA {
res := gamut.Blends(toGoColor(a), toGoColor(b), count)
return convert(res)
}
func Lighter(c RGBA, percent float32) RGBA {
res := gamut.Lighter(toGoColor(c), float64(percent))
return fromGoColor(res)
}
// TODO Darker doesn't work as expected
func Darker(c RGBA, percent float32) RGBA {
res := gamut.Darker(toGoColor(c), float64(percent))
return fromGoColor(res)
}
func convert(in []color.Color) []RGBA {
out := make([]RGBA, 0, len(in))
for _, x := range in {
out = append(out, fromGoColor(x))
}
return out
}