blob: 2ea0c810a4ee73b0164175fb09b5d4bddd57af80 (
plain) (
blame)
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
|
package layout
import (
"image/color"
)
var (
defaultBg = color.Transparent
)
// Option is a function option for layout constructors.
type Option func(*options)
type options struct {
bg color.Color // background color
}
// Background sets the background color of a layout.
func Background(bg color.Color) Option {
return func(o *options) {
o.bg = bg
}
}
// EvalOptions evaluates a list of option functions, returning the final set.
func evalOptions(o ...Option) options {
opts := options{
bg: defaultBg,
}
for i := range o {
o[i](&opts)
}
return opts
}
|