Skip to content

Commit 1e1deb9

Browse files
authored
Merge pull request #54 from jkvatne/master
Add accessors for some style fields and window background
2 parents 1548fcf + 249c2c3 commit 1e1deb9

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

nk/etc.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,3 +291,27 @@ func (l *ListView) Count() int {
291291
func (panel *Panel) Bounds() *Rect {
292292
return (*Rect)(&panel.bounds)
293293
}
294+
295+
func (t *StyleText) Color() *Color {
296+
return (*Color)(&t.color)
297+
}
298+
299+
func (s *Style) Text() *StyleText {
300+
return (*StyleText)(&s.text)
301+
}
302+
303+
func (s *Style) Window() *StyleWindow {
304+
return (*StyleWindow)(&s.window)
305+
}
306+
307+
func (w *StyleWindow) Background() *Color {
308+
return (*Color)(&w.background)
309+
}
310+
311+
func SetTextColor(ctx *Context, color Color) {
312+
*ctx.Style().Text().Color() = color
313+
}
314+
315+
func SetBackgroundColor(ctx *Context, color Color) {
316+
ctx.Style().Window().fixed_background = C.struct_nk_style_item(NkStyleItemColor(color))
317+
}

0 commit comments

Comments
 (0)