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

75 lines
2.6 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-09-29 14:00:56 +01:00
// CherryPickedCommitColor is the text style when cherry picking a commit
CherryPickedCommitTextStyle = style.New()
2021-07-31 12:54:28 +10:00
OptionsFgColor = style.New()
2021-07-31 12:54:28 +10:00
DiffTerminalColor = style.FgMagenta
2022-01-29 00:15:55 +01:00
UnstagedChangesColor = style.New()
)
// 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)
2021-09-29 14:00:56 +01:00
2021-09-29 22:24:59 +10:00
cherryPickedCommitBgTextStyle := GetTextStyle(themeConfig.CherryPickedCommitBgColor, true)
2021-09-29 22:25:18 +10:00
cherryPickedCommitFgTextStyle := GetTextStyle(themeConfig.CherryPickedCommitFgColor, false)
CherryPickedCommitTextStyle = cherryPickedCommitBgTextStyle.MergeStyle(cherryPickedCommitFgTextStyle)
2021-09-29 14:00:56 +01:00
2022-01-29 00:15:55 +01:00
unstagedChangesTextStyle := GetTextStyle(themeConfig.UnstagedChangesColor, false)
UnstagedChangesColor = unstagedChangesTextStyle
2021-07-31 15:34:45 +10:00
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
}
}