mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-19 00:53:42 -05:00
@@ -673,9 +673,10 @@ func defaultPreviewOpts(command string) previewOpts {
|
||||
}
|
||||
|
||||
func defaultOptions() *Options {
|
||||
var theme *tui.ColorTheme
|
||||
var theme, baseTheme *tui.ColorTheme
|
||||
if os.Getenv("NO_COLOR") != "" {
|
||||
theme = tui.NoColorTheme
|
||||
baseTheme = tui.NoColorTheme
|
||||
} else {
|
||||
theme = tui.EmptyTheme
|
||||
}
|
||||
@@ -703,6 +704,7 @@ func defaultOptions() *Options {
|
||||
Ansi: false,
|
||||
Mouse: true,
|
||||
Theme: theme,
|
||||
BaseTheme: baseTheme,
|
||||
Black: false,
|
||||
Bold: true,
|
||||
MinHeight: -10,
|
||||
|
||||
@@ -295,8 +295,9 @@ func (a ColorAttr) IsColorDefined() bool {
|
||||
}
|
||||
|
||||
func (a ColorAttr) IsAttrDefined() bool {
|
||||
return a.Attr != AttrUndefined
|
||||
return a.Attr&^BoldForce != AttrUndefined
|
||||
}
|
||||
|
||||
func (a ColorAttr) IsUndefined() bool {
|
||||
return !a.IsColorDefined() && !a.IsAttrDefined()
|
||||
}
|
||||
@@ -1156,12 +1157,12 @@ func InitTheme(theme *ColorTheme, baseTheme *ColorTheme, boldify bool, forceBlac
|
||||
// e.g. fzf --delimiter / --nth -1 --color fg:dim,nth:regular
|
||||
current := theme.Current
|
||||
if !baseTheme.Colored && current.IsUndefined() {
|
||||
current.Attr = Reverse
|
||||
current.Attr |= Reverse
|
||||
}
|
||||
theme.Current = theme.Fg.Merge(o(baseTheme.Current, current))
|
||||
currentMatch := theme.CurrentMatch
|
||||
if !baseTheme.Colored && currentMatch.IsUndefined() {
|
||||
currentMatch.Attr = Reverse | Underline
|
||||
currentMatch.Attr |= Reverse | Underline
|
||||
}
|
||||
theme.CurrentMatch = o(baseTheme.CurrentMatch, currentMatch)
|
||||
theme.Spinner = o(baseTheme.Spinner, theme.Spinner)
|
||||
|
||||
Reference in New Issue
Block a user