1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-26 05:37:18 +02:00
lazygit/pkg/theme/theme.go

62 lines
2.0 KiB
Go
Raw Normal View History

package theme
import (
"github.com/jesseduffield/gocui"
2020-10-03 14:54:55 +10:00
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/gui/style"
)
var (
// GocuiDefaultTextColor does the same as DefaultTextColor but this one only colors gocui default text colors
GocuiDefaultTextColor gocui.Attribute
// ActiveBorderColor is the border color of the active frame
ActiveBorderColor gocui.Attribute
// InactiveBorderColor is the border color of the inactive active frames
InactiveBorderColor gocui.Attribute
// GocuiSelectedLineBgColor is the background color for the selected line in gocui
GocuiSelectedLineBgColor gocui.Attribute
OptionsColor gocui.Attribute
// DefaultTextColor is the default text color
2021-07-31 12:54:28 +10:00
DefaultTextColor = style.FgWhite
// DefaultHiTextColor is the default highlighted text color
2021-07-31 12:54:28 +10:00
DefaultHiTextColor = style.FgLightWhite
// SelectedLineBgColor is the background color for the selected line
2021-07-31 12:54:28 +10:00
SelectedLineBgColor = style.New()
// SelectedRangeBgColor is the background color of the selected range of lines
2021-07-31 12:54:28 +10:00
SelectedRangeBgColor = style.New()
2021-07-31 12:54:28 +10:00
OptionsFgColor = style.New()
2021-07-31 12:54:28 +10:00
DiffTerminalColor = style.FgMagenta
)
// UpdateTheme updates all theme variables
2020-10-03 14:54:55 +10:00
func UpdateTheme(themeConfig config.ThemeConfig) {
2021-07-31 15:34:45 +10:00
ActiveBorderColor = GetGocuiStyle(themeConfig.ActiveBorderColor)
InactiveBorderColor = GetGocuiStyle(themeConfig.InactiveBorderColor)
SelectedLineBgColor = GetTextStyle(themeConfig.SelectedLineBgColor, true)
SelectedRangeBgColor = GetTextStyle(themeConfig.SelectedRangeBgColor, true)
GocuiSelectedLineBgColor = GetGocuiStyle(themeConfig.SelectedLineBgColor)
OptionsColor = GetGocuiStyle(themeConfig.OptionsTextColor)
OptionsFgColor = GetTextStyle(themeConfig.OptionsTextColor, false)
2020-10-03 14:54:55 +10:00
isLightTheme := themeConfig.LightTheme
if isLightTheme {
DefaultTextColor = style.FgBlack
DefaultHiTextColor = style.FgBlackLighter
GocuiDefaultTextColor = gocui.ColorBlack
} else {
DefaultTextColor = style.FgWhite
DefaultHiTextColor = style.FgLightWhite
GocuiDefaultTextColor = gocui.ColorWhite
}
}