Skip to content

Commit aee417c

Browse files
committed
Respect $NO_COLOR environment variable
Close #1762
1 parent 04db440 commit aee417c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

man/man1/fzf.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ color mappings.
482482

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

487487
\fBdark \fRColor scheme for dark 256-color terminal
488488
\fBlight \fRColor scheme for light 256-color terminal

src/options.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,13 @@ func defaultPreviewOpts(command string) previewOpts {
481481
}
482482

483483
func defaultOptions() *Options {
484+
var theme *tui.ColorTheme
485+
if os.Getenv("NO_COLOR") != "" {
486+
theme = tui.NoColorTheme()
487+
} else {
488+
theme = tui.EmptyTheme()
489+
}
490+
484491
return &Options{
485492
Bash: false,
486493
Zsh: false,
@@ -502,7 +509,7 @@ func defaultOptions() *Options {
502509
Multi: 0,
503510
Ansi: false,
504511
Mouse: true,
505-
Theme: tui.EmptyTheme(),
512+
Theme: theme,
506513
Black: false,
507514
Bold: true,
508515
MinHeight: 10,

0 commit comments

Comments
 (0)