aboutsummaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/github.com/gizak/termui/theme.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-06-24 23:40:18 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-06-24 23:40:18 +0800
commit1ce40d7581bac2b776d1e47ec49c03c0fcc7fdc1 (patch)
treef7b957645b11bc19ecf7fb29baaa13530557af7a /Godeps/_workspace/src/github.com/gizak/termui/theme.go
parent92ef33d97a437dce2d7b55f06342de388d95f575 (diff)
downloadgo-tangerine-1ce40d7581bac2b776d1e47ec49c03c0fcc7fdc1.tar
go-tangerine-1ce40d7581bac2b776d1e47ec49c03c0fcc7fdc1.tar.gz
go-tangerine-1ce40d7581bac2b776d1e47ec49c03c0fcc7fdc1.tar.bz2
go-tangerine-1ce40d7581bac2b776d1e47ec49c03c0fcc7fdc1.tar.lz
go-tangerine-1ce40d7581bac2b776d1e47ec49c03c0fcc7fdc1.tar.xz
go-tangerine-1ce40d7581bac2b776d1e47ec49c03c0fcc7fdc1.tar.zst
go-tangerine-1ce40d7581bac2b776d1e47ec49c03c0fcc7fdc1.zip
Godeps: remove mist remnants, add termui deps
Diffstat (limited to 'Godeps/_workspace/src/github.com/gizak/termui/theme.go')
-rw-r--r--Godeps/_workspace/src/github.com/gizak/termui/theme.go84
1 files changed, 84 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/gizak/termui/theme.go b/Godeps/_workspace/src/github.com/gizak/termui/theme.go
new file mode 100644
index 000000000..c8ad94756
--- /dev/null
+++ b/Godeps/_workspace/src/github.com/gizak/termui/theme.go
@@ -0,0 +1,84 @@
+// Copyright 2015 Zack Guo <gizak@icloud.com>. All rights reserved.
+// Use of this source code is governed by a MIT license that can
+// be found in the LICENSE file.
+
+package termui
+
+// A ColorScheme represents the current look-and-feel of the dashboard.
+type ColorScheme struct {
+ BodyBg Attribute
+ BlockBg Attribute
+ HasBorder bool
+ BorderFg Attribute
+ BorderBg Attribute
+ BorderLabelTextFg Attribute
+ BorderLabelTextBg Attribute
+ ParTextFg Attribute
+ ParTextBg Attribute
+ SparklineLine Attribute
+ SparklineTitle Attribute
+ GaugeBar Attribute
+ GaugePercent Attribute
+ LineChartLine Attribute
+ LineChartAxes Attribute
+ ListItemFg Attribute
+ ListItemBg Attribute
+ BarChartBar Attribute
+ BarChartText Attribute
+ BarChartNum Attribute
+ MBarChartBar Attribute
+ MBarChartText Attribute
+ MBarChartNum Attribute
+}
+
+// default color scheme depends on the user's terminal setting.
+var themeDefault = ColorScheme{HasBorder: true}
+
+var themeHelloWorld = ColorScheme{
+ BodyBg: ColorBlack,
+ BlockBg: ColorBlack,
+ HasBorder: true,
+ BorderFg: ColorWhite,
+ BorderBg: ColorBlack,
+ BorderLabelTextBg: ColorBlack,
+ BorderLabelTextFg: ColorGreen,
+ ParTextBg: ColorBlack,
+ ParTextFg: ColorWhite,
+ SparklineLine: ColorMagenta,
+ SparklineTitle: ColorWhite,
+ GaugeBar: ColorRed,
+ GaugePercent: ColorWhite,
+ LineChartLine: ColorYellow | AttrBold,
+ LineChartAxes: ColorWhite,
+ ListItemBg: ColorBlack,
+ ListItemFg: ColorYellow,
+ BarChartBar: ColorRed,
+ BarChartNum: ColorWhite,
+ BarChartText: ColorCyan,
+ MBarChartBar: ColorRed,
+ MBarChartNum: ColorWhite,
+ MBarChartText: ColorCyan,
+}
+
+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":
+ theme = themeHelloWorld
+ default:
+ theme = themeDefault
+ }
+}