-
Notifications
You must be signed in to change notification settings - Fork 23
/
color.go
51 lines (46 loc) · 1.74 KB
/
color.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 utils
import "image/color"
type ColorScheme struct {
R uint8 // Red Subpixel
G uint8 // Green Subpixel
B uint8 // Blue Subpixel
O float64 // Opacity; value range 0-1
}
type GradientColorScheme struct {
Color1 ColorScheme
Color2 ColorScheme
Blend1 float64 // percent of position along X axis where color1 blend ends.
Blend2 float64 // percent of position along X axis where color2 blend ends.
}
// NRGBAColor converts figma color scheme to gioui nrgba color scheme.
func (c *ColorScheme) NRGBAColor() color.NRGBA {
transparency := 127.0 - (127.0 * c.O) // opacity = (127 - transparency) / 127
return color.NRGBA{
R: c.R,
G: c.G,
B: c.B,
A: uint8(transparency),
}
}
func GradientColorSchemes() map[AssetType]GradientColorScheme {
return map[AssetType]GradientColorScheme{
BTCWalletAsset: {
Color1: ColorScheme{R: 196, G: 203, B: 210, O: 0.3}, // rgba(196, 203, 210, 0.3)
Blend1: 34.76, // 34.76%
Color2: ColorScheme{R: 248, G: 152, B: 36, O: 0.3}, // rgba(248, 152, 36, 0.3)
Blend2: 65.88, // 65.88 %
},
DCRWalletAsset: {
Color1: ColorScheme{R: 41, G: 112, B: 255, O: 0.3}, // rgba(41, 112, 255, 0.3)
Blend1: 34.76, // 34.76%
Color2: ColorScheme{R: 45, G: 216, B: 163, O: 0.3}, // rgba(45, 216, 163, 0.3)
Blend2: 65.88, // 65.88 %
},
LTCWalletAsset: {
Color1: ColorScheme{R: 224, G: 224, B: 224, O: 0.3}, // rgba(224, 224, 224, 0.3)
Blend1: 34.76, // 34.76%
Color2: ColorScheme{R: 56, G: 115, B: 223, O: 0.3}, // rgba(56, 115, 223, 0.3)
Blend2: 65.88, // 65.88 %
},
}
}