-
Notifications
You must be signed in to change notification settings - Fork 1
/
option.go
66 lines (56 loc) · 1.55 KB
/
option.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package mdavatar
import (
"image"
"image/color"
)
// Option set field value for Config
type Option func(*Config)
// WithAvatarTextHandle with option for Config.avatarTextHandle field
func WithAvatarTextHandle(avatarTextHandle AvatarTextHandler) Option {
return func(config *Config) {
config.avatarTextHandle = avatarTextHandle
}
}
// WithAvatarSize with option for Config.avatarSize field
func WithAvatarSize(avatarSize int) Option {
return func(config *Config) {
config.avatarSize = avatarSize
}
}
// WithPadding with option for Config.padding field
func WithPadding(padding int) Option {
return func(config *Config) {
config.padding = padding
}
}
// WithLetterFont with option for Config.letterFont field
func WithLetterFont(letterFont string) Option {
return func(config *Config) {
config.letterFont = letterFont
}
}
// WithAsianFont with option for Config.asianFont field
func WithAsianFont(asianFont string) Option {
return func(config *Config) {
config.asianFont = asianFont
}
}
// DisableAsianFontChar set Config.enableAsianFontChar is false and reset Config.asianFont is empty
func DisableAsianFontChar() Option {
return func(config *Config) {
config.enableAsianFontChar = false
config.asianFont = ""
}
}
// WithColors with option for Config.colors field
func WithColors(colors []color.RGBA) Option {
return func(config *Config) {
config.colors = colors
}
}
// WithBackground with option for Config.background field
func WithBackground(background *image.RGBA) Option {
return func(config *Config) {
config.background = background
}
}