diff --git a/theme.go b/theme.go index a2294e2..af51516 100644 --- a/theme.go +++ b/theme.go @@ -1,6 +1,7 @@ package termui -type colorScheme struct { +// A ColorScheme represents the current look-and-feel of the dashboard. +type ColorScheme struct { BodyBg Attribute BlockBg Attribute HasBorder bool @@ -24,9 +25,9 @@ type colorScheme struct { } // default color scheme depends on the user's terminal setting. -var themeDefault = colorScheme{HasBorder: true} +var themeDefault = ColorScheme{HasBorder: true} -var themeHelloWorld = colorScheme{ +var themeHelloWorld = ColorScheme{ BodyBg: ColorBlack, BlockBg: ColorBlack, HasBorder: true, @@ -51,6 +52,18 @@ var themeHelloWorld = colorScheme{ var theme = themeDefault // global dep +// Theme returns the currently used theme. +func Theme() ColorScheme { + return theme +} + +// SetTheme sets a new, custom theme. +func SetTheme(newTheme ColorScheme) { + theme = newTheme +} + +// UseTheme sets a predefined scheme. Currently available: "hello-world" and +// "black-and-white". func UseTheme(th string) { switch th { case "helloworld":