24 lines
328 B
Go
24 lines
328 B
Go
package blocks
|
|
|
|
import "image/color"
|
|
|
|
type OptFunc func(*Block)
|
|
|
|
func Size(w, h int) OptFunc {
|
|
return func(b *Block) {
|
|
b.width, b.height = w, h
|
|
}
|
|
}
|
|
|
|
func BackgroundColor(c color.Color) OptFunc {
|
|
return func(b *Block) {
|
|
b.backgroundColor = &c
|
|
}
|
|
}
|
|
|
|
func Name(n string) OptFunc {
|
|
return func(b *Block) {
|
|
b.name = n
|
|
}
|
|
}
|