Merge branch 'Matt3o12-master'

This commit is contained in:
gizak 2015-03-20 08:41:56 -04:00
commit daed6d1aa5

View File

@ -1,6 +1,7 @@
package termui package termui
type colorScheme struct { // A ColorScheme represents the current look-and-feel of the dashboard.
type ColorScheme struct {
BodyBg Attribute BodyBg Attribute
BlockBg Attribute BlockBg Attribute
HasBorder bool HasBorder bool
@ -24,9 +25,9 @@ type colorScheme struct {
} }
// default color scheme depends on the user's terminal setting. // 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, BodyBg: ColorBlack,
BlockBg: ColorBlack, BlockBg: ColorBlack,
HasBorder: true, HasBorder: true,
@ -51,6 +52,18 @@ var themeHelloWorld = colorScheme{
var theme = themeDefault // global dep 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) { func UseTheme(th string) {
switch th { switch th {
case "helloworld": case "helloworld":