30 lines
487 B
Go
30 lines
487 B
Go
package base
|
|
|
|
import (
|
|
"image/color"
|
|
|
|
"git.vezzani.net/ben/games/common/elements/v1"
|
|
)
|
|
|
|
type OptFunc func(*Element)
|
|
|
|
func Children(children ...elements.Element) OptFunc {
|
|
return func(c *Element) {
|
|
c.children = children
|
|
}
|
|
}
|
|
|
|
func Name(name string) OptFunc {
|
|
return func(s *Element) {
|
|
s.name = name
|
|
}
|
|
}
|
|
|
|
func (b elements.Builder) BackgroundColor(c color.Color) elements.Builder {
|
|
return func() elements.Element {
|
|
ce := b().(*Element)
|
|
ce.backgroundColor = c
|
|
return ce
|
|
}
|
|
}
|