1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-12 11:15:00 +02:00
lazygit/pkg/theme/theme.go

64 lines
2.3 KiB
Go
Raw Normal View History

package theme
import (
"github.com/jesseduffield/gocui"
2020-10-03 06:54:55 +02: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 04:54:28 +02:00
DefaultTextColor = style.FgWhite
// SelectedLineBgColor is the background color for the selected line
2021-07-31 04:54:28 +02:00
SelectedLineBgColor = style.New()
// SelectedRangeBgColor is the background color of the selected range of lines
2021-07-31 04:54:28 +02:00
SelectedRangeBgColor = style.New()
2021-09-29 15:00:56 +02:00
// CherryPickedCommitColor is the text style when cherry picking a commit
CherryPickedCommitTextStyle = style.New()
2021-07-31 04:54:28 +02:00
OptionsFgColor = style.New()
2021-07-31 04:54:28 +02:00
DiffTerminalColor = style.FgMagenta
2022-01-29 01:15:55 +02:00
UnstagedChangesColor = style.New()
)
// UpdateTheme updates all theme variables
2020-10-03 06:54:55 +02:00
func UpdateTheme(themeConfig config.ThemeConfig) {
2021-07-31 07:34:45 +02:00
ActiveBorderColor = GetGocuiStyle(themeConfig.ActiveBorderColor)
InactiveBorderColor = GetGocuiStyle(themeConfig.InactiveBorderColor)
SelectedLineBgColor = GetTextStyle(themeConfig.SelectedLineBgColor, true)
SelectedRangeBgColor = GetTextStyle(themeConfig.SelectedRangeBgColor, true)
2021-09-29 15:00:56 +02:00
2021-09-29 14:24:59 +02:00
cherryPickedCommitBgTextStyle := GetTextStyle(themeConfig.CherryPickedCommitBgColor, true)
2021-09-29 14:25:18 +02:00
cherryPickedCommitFgTextStyle := GetTextStyle(themeConfig.CherryPickedCommitFgColor, false)
CherryPickedCommitTextStyle = cherryPickedCommitBgTextStyle.MergeStyle(cherryPickedCommitFgTextStyle)
2021-09-29 15:00:56 +02:00
2022-01-29 01:15:55 +02:00
unstagedChangesTextStyle := GetTextStyle(themeConfig.UnstagedChangesColor, false)
UnstagedChangesColor = unstagedChangesTextStyle
2021-07-31 07:34:45 +02:00
GocuiSelectedLineBgColor = GetGocuiStyle(themeConfig.SelectedLineBgColor)
OptionsColor = GetGocuiStyle(themeConfig.OptionsTextColor)
OptionsFgColor = GetTextStyle(themeConfig.OptionsTextColor, false)
DefaultTextColor = GetTextStyle(themeConfig.DefaultFgColor, false)
GocuiDefaultTextColor = GetGocuiStyle(themeConfig.DefaultFgColor)
}