x
This commit is contained in:
78
internal/ui/style/style.go
Normal file
78
internal/ui/style/style.go
Normal file
@@ -0,0 +1,78 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package style
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gdamore/tcell/v2"
|
||||
"github.com/rivo/tview"
|
||||
)
|
||||
|
||||
const (
|
||||
// HeavyGreenCheckMark unicode.
|
||||
HeavyGreenCheckMark = "\u2705"
|
||||
// HeavyRedCrossMark unicode.
|
||||
HeavyRedCrossMark = "\u274C"
|
||||
// ProgressBar cell.
|
||||
ProgressBarCell = "▉"
|
||||
)
|
||||
|
||||
var (
|
||||
// infobar.
|
||||
InfoBarItemFgColor = tcell.ColorSilver
|
||||
// main views.
|
||||
FgColor = tcell.ColorFloralWhite
|
||||
BgColor = tview.Styles.PrimitiveBackgroundColor
|
||||
BorderColor = tcell.NewRGBColor(135, 175, 146) //nolint:mnd
|
||||
HelpHeaderFgColor = tcell.NewRGBColor(135, 175, 146) //nolint:mnd
|
||||
MenuBgColor = tcell.ColorMediumSeaGreen
|
||||
PageHeaderBgColor = tcell.ColorMediumSeaGreen
|
||||
PageHeaderFgColor = tcell.ColorFloralWhite
|
||||
RunningStatusFgColor = tcell.NewRGBColor(95, 215, 0) //nolint:mnd
|
||||
PausedStatusFgColor = tcell.NewRGBColor(255, 175, 0) //nolint:mnd
|
||||
// dialogs.
|
||||
DialogBgColor = tcell.NewRGBColor(38, 38, 38) //nolint:mnd
|
||||
DialogBorderColor = tcell.ColorMediumSeaGreen
|
||||
DialogFgColor = tcell.ColorFloralWhite
|
||||
DialogSubBoxBorderColor = tcell.ColorDimGray
|
||||
ErrorDialogBgColor = tcell.NewRGBColor(215, 0, 0) //nolint:mnd
|
||||
ErrorDialogButtonBgColor = tcell.ColorDarkRed
|
||||
// terminal.
|
||||
TerminalFgColor = tcell.ColorFloralWhite
|
||||
TerminalBgColor = tcell.NewRGBColor(5, 5, 5) //nolint:mnd
|
||||
TerminalBorderColor = tcell.ColorDimGray
|
||||
// table header.
|
||||
TableHeaderBgColor = tcell.ColorMediumSeaGreen
|
||||
TableHeaderFgColor = tcell.ColorFloralWhite
|
||||
// progress bar.
|
||||
PrgBgColor = tcell.ColorDimGray
|
||||
PrgBarColor = tcell.ColorDarkOrange
|
||||
PrgBarEmptyColor = tcell.ColorWhite
|
||||
PrgBarOKColor = tcell.ColorGreen
|
||||
PrgBarWarnColor = tcell.ColorOrange
|
||||
PrgBarCritColor = tcell.ColorRed
|
||||
// dropdown.
|
||||
DropDownUnselected = tcell.StyleDefault.Background(tcell.ColorWhiteSmoke).Foreground(tcell.ColorBlack)
|
||||
DropDownSelected = tcell.StyleDefault.Background(tcell.ColorLightSlateGray).Foreground(tcell.ColorWhite)
|
||||
// other primitives.
|
||||
InputFieldBgColor = tcell.ColorGray
|
||||
ButtonBgColor = tcell.ColorMediumSeaGreen
|
||||
)
|
||||
|
||||
// GetColorName returns convert tcell color to its name.
|
||||
func GetColorName(color tcell.Color) string {
|
||||
for name, c := range tcell.ColorNames {
|
||||
if c == color {
|
||||
return name
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// GetColorHex returns convert tcell color to its hex useful for textview primitives.
|
||||
func GetColorHex(color tcell.Color) string {
|
||||
return fmt.Sprintf("#%x", color.Hex())
|
||||
}
|
||||
81
internal/ui/style/style_windows.go
Normal file
81
internal/ui/style/style_windows.go
Normal file
@@ -0,0 +1,81 @@
|
||||
//go:build windows
|
||||
|
||||
package style
|
||||
|
||||
import (
|
||||
"github.com/gdamore/tcell/v2"
|
||||
"github.com/rivo/tview"
|
||||
)
|
||||
|
||||
const (
|
||||
// HeavyGreenCheckMark unicode.
|
||||
HeavyGreenCheckMark = "[green::]\u25CF[-::]"
|
||||
// HeavyRedCrossMark unicode.
|
||||
HeavyRedCrossMark = "[red::]\u25CF[-::]"
|
||||
// ProgressBar cell.
|
||||
ProgressBarCell = "\u2593"
|
||||
)
|
||||
|
||||
var (
|
||||
// infobar.
|
||||
InfoBarItemFgColor = tcell.ColorGray
|
||||
// main views.
|
||||
FgColor = tview.Styles.PrimaryTextColor
|
||||
BgColor = tview.Styles.PrimitiveBackgroundColor
|
||||
BorderColor = tcell.ColorSpringGreen
|
||||
MenuBgColor = tcell.ColorSpringGreen
|
||||
HelpHeaderFgColor = tcell.ColorSpringGreen
|
||||
PageHeaderBgColor = tcell.ColorSpringGreen
|
||||
PageHeaderFgColor = tview.Styles.PrimaryTextColor
|
||||
RunningStatusFgColor = tcell.ColorLime
|
||||
PausedStatusFgColor = tcell.ColorYellow
|
||||
|
||||
// dialogs.
|
||||
DialogBgColor = tview.Styles.PrimitiveBackgroundColor
|
||||
DialogFgColor = tview.Styles.PrimaryTextColor
|
||||
DialogBorderColor = tcell.ColorSpringGreen
|
||||
DialogSubBoxBorderColor = tcell.ColorGray
|
||||
ErrorDialogBgColor = tcell.ColorRed
|
||||
ErrorDialogButtonBgColor = tcell.ColorSpringGreen
|
||||
// terminal.
|
||||
TerminalBgColor = tview.Styles.PrimitiveBackgroundColor
|
||||
TerminalFgColor = tview.Styles.PrimaryTextColor
|
||||
TerminalBorderColor = tview.Styles.PrimitiveBackgroundColor
|
||||
// table header.
|
||||
TableHeaderBgColor = tcell.ColorSpringGreen
|
||||
TableHeaderFgColor = tview.Styles.PrimaryTextColor
|
||||
// progress bar.
|
||||
PrgBgColor = tview.Styles.PrimaryTextColor
|
||||
PrgBarColor = tcell.ColorFuchsia
|
||||
PrgBarEmptyColor = tcell.ColorWhite
|
||||
PrgBarOKColor = tcell.ColorLime
|
||||
PrgBarWarnColor = tcell.ColorYellow
|
||||
PrgBarCritColor = tcell.ColorRed
|
||||
// dropdown.
|
||||
DropDownUnselected = tcell.StyleDefault.Background(tcell.ColorGray).Foreground(tcell.ColorWhite)
|
||||
DropDownSelected = tcell.StyleDefault.Background(tcell.ColorPurple).Foreground(tview.Styles.PrimaryTextColor)
|
||||
// other primitives.
|
||||
InputFieldBgColor = tcell.ColorGray
|
||||
ButtonBgColor = tcell.ColorSpringGreen
|
||||
)
|
||||
|
||||
// GetColorName returns convert tcell color to its name.
|
||||
func GetColorName(color tcell.Color) string {
|
||||
for name, c := range tcell.ColorNames {
|
||||
if c == color {
|
||||
return name
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// GetColorHex shall returns convert tcell color to its hex useful for textview primitives,
|
||||
// however, for windows nodes it will return color name.
|
||||
func GetColorHex(color tcell.Color) string {
|
||||
for name, c := range tcell.ColorNames {
|
||||
if c == color {
|
||||
return name
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
Reference in New Issue
Block a user