glow/ui/styles.go

64 lines
2.2 KiB
Go
Raw Normal View History

2020-11-11 21:28:48 +00:00
package ui
import (
lib "github.com/charmbracelet/charm/ui/common"
2020-11-11 21:28:48 +00:00
te "github.com/muesli/termenv"
)
type styleFunc func(string) string
const (
darkGray = "#333333"
)
var (
normalFg = newFgStyle(lib.NewColorPair("#dddddd", "#1a1a1a"))
dimNormalFg = newFgStyle(lib.NewColorPair("#777777", "#A49FA5"))
2020-11-11 21:28:48 +00:00
brightGrayFg = newFgStyle(lib.NewColorPair("#979797", "#847A85"))
dimBrightGrayFg = newFgStyle(lib.NewColorPair("#4D4D4D", "#C2B8C2"))
2020-11-11 21:28:48 +00:00
grayFg = newFgStyle(lib.NewColorPair("#626262", "#909090"))
midGrayFg = newFgStyle(lib.NewColorPair("#4A4A4A", "#B2B2B2"))
darkGrayFg = newFgStyle(lib.NewColorPair("#3C3C3C", "#DDDADA"))
2020-11-11 21:28:48 +00:00
greenFg = newFgStyle(lib.NewColorPair("#04B575", "#04B575"))
semiDimGreenFg = newFgStyle(lib.NewColorPair("#036B46", "#35D79C"))
dimGreenFg = newFgStyle(lib.NewColorPair("#0B5137", "#72D2B0"))
2020-11-11 21:28:48 +00:00
fuchsiaFg = newFgStyle(lib.Fuschia)
dimFuchsiaFg = newFgStyle(lib.NewColorPair("#99519E", "#F1A8FF"))
2020-11-11 21:28:48 +00:00
dullFuchsiaFg = newFgStyle(lib.NewColorPair("#AD58B4", "#F793FF"))
dimDullFuchsiaFg = newFgStyle(lib.NewColorPair("#6B3A6F", "#F6C9FF"))
2020-11-11 21:28:48 +00:00
indigoFg = newFgStyle(lib.Indigo)
dimIndigoFg = newFgStyle(lib.NewColorPair("#494690", "#9498FF"))
2020-11-11 21:28:48 +00:00
subtleIndigoFg = newFgStyle(lib.NewColorPair("#514DC1", "#7D79F6"))
dimSubtleIndigoFg = newFgStyle(lib.NewColorPair("#383584", "#BBBDFF"))
2020-11-11 21:28:48 +00:00
yellowFg = newFgStyle(lib.YellowGreen) // renders light green on light backgrounds
dullYellowFg = newFgStyle(lib.NewColorPair("#9BA92F", "#6BCB94")) // renders light green on light backgrounds
redFg = newFgStyle(lib.Red)
faintRedFg = newFgStyle(lib.FaintRed)
// Ultimately, we should transition to named styles
tabColor = newFgStyle(lib.NewColorPair("#626262", "#909090"))
selectedTabColor = newFgStyle(lib.NewColorPair("#979797", "#332F33"))
2020-11-11 21:28:48 +00:00
)
// Returns a termenv style with foreground and background options.
func newStyle(fg, bg lib.ColorPair, bold bool) func(string) string {
2020-11-24 23:24:31 +00:00
s := te.Style{}.Foreground(fg.Color()).Background(bg.Color())
if bold {
s = s.Bold()
}
return s.Styled
2020-11-11 21:28:48 +00:00
}
// Returns a new termenv style with background options only.
func newFgStyle(c lib.ColorPair) styleFunc {
2020-11-11 21:28:48 +00:00
return te.Style{}.Foreground(c.Color()).Styled
}