diff --git a/checkbox.go b/checkbox.go index 7e1e7dd..cdc6b24 100644 --- a/checkbox.go +++ b/checkbox.go @@ -23,13 +23,15 @@ type Checkbox struct { // NewCheckbox returns a new Checkbox widget. func NewCheckbox(onSelect func() error) *Checkbox { - return &Checkbox{ + c := &Checkbox{ Box: NewBox(), checkColor: Style.TextColorDark, borderSize: 2, borderColor: Style.ButtonBorderBottom, onSelect: onSelect, } + c.SetBackground(Style.CheckboxBgColor) + return c } // SetRect sets the position and size of the Checkbox. The checkbox is always diff --git a/examples/showcase/checkbox.go b/examples/showcase/checkbox.go index f99384c..7bfb6a1 100644 --- a/examples/showcase/checkbox.go +++ b/examples/showcase/checkbox.go @@ -25,7 +25,6 @@ func newCheckboxExample() (etk.Widget, etk.Widget) { return nil } chk = etk.NewCheckbox(onSelectChk) - chk.SetBackground(color.RGBA{255, 255, 255, 255}) label = etk.NewButton("Unchecked", onSelectLabel) label.SetHorizontal(etk.AlignStart) label.SetVertical(etk.AlignCenter) diff --git a/style.go b/style.go index b8c11be..b79eea3 100644 --- a/style.go +++ b/style.go @@ -18,12 +18,6 @@ type Attributes struct { TextBgColor color.RGBA - ButtonBorderSize int - ButtonBorderTop color.RGBA - ButtonBorderRight color.RGBA - ButtonBorderBottom color.RGBA - ButtonBorderLeft color.RGBA - InputBorderSize int InputBorderFocused color.RGBA InputBorderUnfocused color.RGBA @@ -42,6 +36,14 @@ type Attributes struct { ButtonTextColor color.RGBA ButtonBgColor color.RGBA ButtonBgColorDisabled color.RGBA + + ButtonBorderSize int + ButtonBorderTop color.RGBA + ButtonBorderRight color.RGBA + ButtonBorderBottom color.RGBA + ButtonBorderLeft color.RGBA + + CheckboxBgColor color.RGBA } // Style is the current default attribute configuration. Integer values will be scaled. @@ -53,12 +55,6 @@ var Style = &Attributes{ TextBgColor: transparent, - ButtonBorderSize: 4, - ButtonBorderTop: color.RGBA{220, 220, 220, 255}, - ButtonBorderRight: color.RGBA{0, 0, 0, 255}, - ButtonBorderBottom: color.RGBA{0, 0, 0, 255}, - ButtonBorderLeft: color.RGBA{220, 220, 220, 255}, - InputBorderSize: 2, InputBorderFocused: color.RGBA{220, 220, 220, 255}, InputBorderUnfocused: color.RGBA{0, 0, 0, 255}, @@ -76,4 +72,12 @@ var Style = &Attributes{ ButtonBgColor: color.RGBA{255, 255, 255, 255}, ButtonBgColorDisabled: color.RGBA{110, 110, 110, 255}, + + ButtonBorderSize: 4, + ButtonBorderTop: color.RGBA{220, 220, 220, 255}, + ButtonBorderRight: color.RGBA{0, 0, 0, 255}, + ButtonBorderBottom: color.RGBA{0, 0, 0, 255}, + ButtonBorderLeft: color.RGBA{220, 220, 220, 255}, + + CheckboxBgColor: color.RGBA{255, 255, 255, 255}, }