1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-04 10:34:55 +02:00
lazygit/pkg/theme/theme.go

75 lines
2.9 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 (
// DefaultTextColor is the default text color
DefaultTextColor = style.FgDefault
// GocuiDefaultTextColor does the same as DefaultTextColor but this one only colors gocui default text colors
GocuiDefaultTextColor = gocui.ColorDefault
// 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
// FilteredActiveBorderColor is the border color of the active frame, when it's being searched/filtered
SearchingActiveBorderColor gocui.Attribute
// GocuiSelectedLineBgColor is the background color for the selected line in gocui
GocuiSelectedLineBgColor gocui.Attribute
OptionsColor gocui.Attribute
// 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()
// MarkedBaseCommitTextStyle is the text style of the marked rebase base commit
MarkedBaseCommitTextStyle = 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)
SearchingActiveBorderColor = GetGocuiStyle(themeConfig.SearchingActiveBorderColor)
2021-07-31 07:34:45 +02:00
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
markedBaseCommitBgTextStyle := GetTextStyle(themeConfig.MarkedBaseCommitBgColor, true)
markedBaseCommitFgTextStyle := GetTextStyle(themeConfig.MarkedBaseCommitFgColor, false)
MarkedBaseCommitTextStyle = markedBaseCommitBgTextStyle.MergeStyle(markedBaseCommitFgTextStyle)
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)
}