2017-01-13 23:07:43 -07:00
|
|
|
// Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
|
2022-08-28 10:46:41 -06:00
|
|
|
// Use of this source code is governed by a GPLv3 license that can
|
2015-03-20 14:21:50 -06:00
|
|
|
// be found in the LICENSE file.
|
|
|
|
|
2015-03-11 14:15:59 -06:00
|
|
|
package termui
|
|
|
|
|
2019-01-23 21:12:10 -07:00
|
|
|
var StandardColors = []Color{
|
|
|
|
ColorRed,
|
|
|
|
ColorGreen,
|
|
|
|
ColorYellow,
|
|
|
|
ColorBlue,
|
|
|
|
ColorMagenta,
|
|
|
|
ColorCyan,
|
|
|
|
ColorWhite,
|
2015-03-11 14:15:59 -06:00
|
|
|
}
|
|
|
|
|
2019-01-23 21:12:10 -07:00
|
|
|
var StandardStyles = []Style{
|
|
|
|
NewStyle(ColorRed),
|
|
|
|
NewStyle(ColorGreen),
|
|
|
|
NewStyle(ColorYellow),
|
|
|
|
NewStyle(ColorBlue),
|
|
|
|
NewStyle(ColorMagenta),
|
|
|
|
NewStyle(ColorCyan),
|
|
|
|
NewStyle(ColorWhite),
|
2015-03-11 14:15:59 -06:00
|
|
|
}
|
|
|
|
|
2019-01-23 21:12:10 -07:00
|
|
|
type RootTheme struct {
|
|
|
|
Default Style
|
|
|
|
|
|
|
|
Block BlockTheme
|
|
|
|
|
|
|
|
BarChart BarChartTheme
|
|
|
|
Gauge GaugeTheme
|
2019-01-24 08:56:22 -07:00
|
|
|
Plot PlotTheme
|
2019-01-23 21:12:10 -07:00
|
|
|
List ListTheme
|
2019-04-16 05:57:06 -06:00
|
|
|
Tree TreeTheme
|
2019-01-23 21:12:10 -07:00
|
|
|
Paragraph ParagraphTheme
|
|
|
|
PieChart PieChartTheme
|
|
|
|
Sparkline SparklineTheme
|
|
|
|
StackedBarChart StackedBarChartTheme
|
|
|
|
Tab TabTheme
|
|
|
|
Table TableTheme
|
|
|
|
}
|
2015-03-11 14:15:59 -06:00
|
|
|
|
2019-01-23 21:12:10 -07:00
|
|
|
type BlockTheme struct {
|
|
|
|
Title Style
|
|
|
|
Border Style
|
2015-03-20 03:35:09 -06:00
|
|
|
}
|
|
|
|
|
2019-01-23 21:12:10 -07:00
|
|
|
type BarChartTheme struct {
|
|
|
|
Bars []Color
|
|
|
|
Nums []Style
|
|
|
|
Labels []Style
|
2015-03-20 03:35:09 -06:00
|
|
|
}
|
|
|
|
|
2019-01-23 21:12:10 -07:00
|
|
|
type GaugeTheme struct {
|
|
|
|
Bar Color
|
|
|
|
Label Style
|
2015-03-11 14:15:59 -06:00
|
|
|
}
|
2019-01-23 21:12:10 -07:00
|
|
|
|
2019-01-24 08:56:22 -07:00
|
|
|
type PlotTheme struct {
|
2019-01-23 21:12:10 -07:00
|
|
|
Lines []Color
|
|
|
|
Axes Color
|
2015-09-21 01:11:58 -06:00
|
|
|
}
|
|
|
|
|
2019-01-23 21:12:10 -07:00
|
|
|
type ListTheme struct {
|
|
|
|
Text Style
|
2015-09-21 01:11:58 -06:00
|
|
|
}
|
|
|
|
|
2019-04-16 05:57:06 -06:00
|
|
|
type TreeTheme struct {
|
2019-05-02 06:50:48 -06:00
|
|
|
Text Style
|
|
|
|
Collapsed rune
|
|
|
|
Expanded rune
|
2019-04-16 05:57:06 -06:00
|
|
|
}
|
|
|
|
|
2019-01-23 21:12:10 -07:00
|
|
|
type ParagraphTheme struct {
|
|
|
|
Text Style
|
2015-09-21 01:11:58 -06:00
|
|
|
}
|
|
|
|
|
2019-01-23 21:12:10 -07:00
|
|
|
type PieChartTheme struct {
|
|
|
|
Slices []Color
|
|
|
|
}
|
2015-09-21 01:11:58 -06:00
|
|
|
|
2019-01-23 21:12:10 -07:00
|
|
|
type SparklineTheme struct {
|
|
|
|
Title Style
|
|
|
|
Line Color
|
|
|
|
}
|
2015-09-21 01:11:58 -06:00
|
|
|
|
2019-01-23 21:12:10 -07:00
|
|
|
type StackedBarChartTheme struct {
|
|
|
|
Bars []Color
|
|
|
|
Nums []Style
|
|
|
|
Labels []Style
|
|
|
|
}
|
|
|
|
|
|
|
|
type TabTheme struct {
|
|
|
|
Active Style
|
|
|
|
Inactive Style
|
|
|
|
}
|
2015-09-21 01:11:58 -06:00
|
|
|
|
2019-01-23 21:12:10 -07:00
|
|
|
type TableTheme struct {
|
|
|
|
Text Style
|
2015-09-21 01:11:58 -06:00
|
|
|
}
|
2016-02-04 23:20:46 -07:00
|
|
|
|
2019-02-01 23:16:02 -07:00
|
|
|
// Theme holds the default Styles and Colors for all widgets.
|
|
|
|
// You can set default widget Styles by modifying the Theme before creating the widgets.
|
2019-01-23 21:12:10 -07:00
|
|
|
var Theme = RootTheme{
|
|
|
|
Default: NewStyle(ColorWhite),
|
|
|
|
|
|
|
|
Block: BlockTheme{
|
|
|
|
Title: NewStyle(ColorWhite),
|
|
|
|
Border: NewStyle(ColorWhite),
|
|
|
|
},
|
|
|
|
|
|
|
|
BarChart: BarChartTheme{
|
|
|
|
Bars: StandardColors,
|
|
|
|
Nums: StandardStyles,
|
|
|
|
Labels: StandardStyles,
|
|
|
|
},
|
|
|
|
|
|
|
|
Paragraph: ParagraphTheme{
|
|
|
|
Text: NewStyle(ColorWhite),
|
|
|
|
},
|
|
|
|
|
|
|
|
PieChart: PieChartTheme{
|
|
|
|
Slices: StandardColors,
|
|
|
|
},
|
|
|
|
|
|
|
|
List: ListTheme{
|
|
|
|
Text: NewStyle(ColorWhite),
|
|
|
|
},
|
|
|
|
|
2019-04-16 05:57:06 -06:00
|
|
|
Tree: TreeTheme{
|
2019-05-02 06:50:48 -06:00
|
|
|
Text: NewStyle(ColorWhite),
|
|
|
|
Collapsed: COLLAPSED,
|
|
|
|
Expanded: EXPANDED,
|
2019-04-16 05:57:06 -06:00
|
|
|
},
|
|
|
|
|
2019-01-23 21:12:10 -07:00
|
|
|
StackedBarChart: StackedBarChartTheme{
|
|
|
|
Bars: StandardColors,
|
|
|
|
Nums: StandardStyles,
|
|
|
|
Labels: StandardStyles,
|
|
|
|
},
|
|
|
|
|
|
|
|
Gauge: GaugeTheme{
|
|
|
|
Bar: ColorWhite,
|
|
|
|
Label: NewStyle(ColorWhite),
|
|
|
|
},
|
|
|
|
|
|
|
|
Sparkline: SparklineTheme{
|
2019-01-23 22:36:58 -07:00
|
|
|
Title: NewStyle(ColorWhite),
|
|
|
|
Line: ColorWhite,
|
2019-01-23 21:12:10 -07:00
|
|
|
},
|
|
|
|
|
2019-01-24 08:56:22 -07:00
|
|
|
Plot: PlotTheme{
|
2019-01-23 21:12:10 -07:00
|
|
|
Lines: StandardColors,
|
2019-01-23 22:36:58 -07:00
|
|
|
Axes: ColorWhite,
|
2019-01-23 21:12:10 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
Table: TableTheme{
|
|
|
|
Text: NewStyle(ColorWhite),
|
|
|
|
},
|
|
|
|
|
|
|
|
Tab: TabTheme{
|
|
|
|
Active: NewStyle(ColorRed),
|
|
|
|
Inactive: NewStyle(ColorWhite),
|
|
|
|
},
|
2016-02-04 23:20:46 -07:00
|
|
|
}
|