mirror of
https://gitee.com/energye/energy.git
synced 2024-12-05 13:17:54 +08:00
d9f14c6a46
代码授权注释修改
94 lines
1.3 KiB
Go
94 lines
1.3 KiB
Go
//----------------------------------------
|
|
//
|
|
// Copyright © yanghy. All Rights Reserved.
|
|
//
|
|
// Licensed under Apache License Version 2.0, January 2004
|
|
//
|
|
// https://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
//----------------------------------------
|
|
|
|
package progressbar
|
|
|
|
type BarColor struct {
|
|
Graph int
|
|
Back int
|
|
Ratio int
|
|
Percent int
|
|
Notice int
|
|
}
|
|
|
|
type Color struct {
|
|
Black int
|
|
Blue int
|
|
Green int
|
|
Aqua int
|
|
Red int
|
|
Purple int
|
|
Yellow int
|
|
White int
|
|
Gray int
|
|
}
|
|
|
|
var (
|
|
FontColor Color
|
|
BackColor Color
|
|
)
|
|
|
|
func init() {
|
|
initColor()
|
|
}
|
|
|
|
func initColor() {
|
|
FontColor = Color{
|
|
Black: 30,
|
|
Blue: 34,
|
|
Green: 32,
|
|
Aqua: 36,
|
|
Red: 31,
|
|
Purple: 35,
|
|
Yellow: 33,
|
|
White: 37,
|
|
Gray: 37,
|
|
}
|
|
BackColor = Color{
|
|
Black: 40,
|
|
Blue: 44,
|
|
Green: 42,
|
|
Aqua: 46,
|
|
Red: 41,
|
|
Purple: 45,
|
|
Yellow: 43,
|
|
White: 47,
|
|
Gray: 47,
|
|
}
|
|
}
|
|
|
|
func (m *Bar) SetProgressGraphColor(color int) {
|
|
m.color.Graph = color
|
|
}
|
|
|
|
func (m *Bar) SetColor(color BarColor) {
|
|
m.color = color
|
|
}
|
|
|
|
func (m *Bar) SetGraphColor(color int) {
|
|
m.color.Graph = color
|
|
}
|
|
|
|
func (m *Bar) SetBackColor(color int) {
|
|
m.color.Back = color
|
|
}
|
|
|
|
func (m *Bar) SetRatioColor(color int) {
|
|
m.color.Ratio = color
|
|
}
|
|
|
|
func (m *Bar) SetPercentColor(color int) {
|
|
m.color.Percent = color
|
|
}
|
|
|
|
func (m *Bar) SetNoticeColor(color int) {
|
|
m.color.Notice = color
|
|
}
|