Skip to content

Commit

Permalink
Respect $NO_COLOR environment variable
Browse files Browse the repository at this point in the history
Close #1762
  • Loading branch information
junegunn committed May 20, 2024
1 parent 04db440 commit aee417c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion man/man1/fzf.1
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ color mappings.

.RS
.B BASE SCHEME:
(default: dark on 256-color terminal, otherwise 16)
(default: \fBdark\fR on 256-color terminal, otherwise \fB16\fR; If \fBNO_COLOR\fR is set, \fBbw\fR)

\fBdark \fRColor scheme for dark 256-color terminal
\fBlight \fRColor scheme for light 256-color terminal
Expand Down
9 changes: 8 additions & 1 deletion src/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,13 @@ func defaultPreviewOpts(command string) previewOpts {
}

func defaultOptions() *Options {
var theme *tui.ColorTheme
if os.Getenv("NO_COLOR") != "" {
theme = tui.NoColorTheme()
} else {
theme = tui.EmptyTheme()
}

return &Options{
Bash: false,
Zsh: false,
Expand All @@ -502,7 +509,7 @@ func defaultOptions() *Options {
Multi: 0,
Ansi: false,
Mouse: true,
Theme: tui.EmptyTheme(),
Theme: theme,
Black: false,
Bold: true,
MinHeight: 10,
Expand Down

0 comments on commit aee417c

Please sign in to comment.