summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2024-05-20 10:50:00 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2024-05-20 10:50:00 +0900
commitaee417c46a2f6d2aa87ea3fcc799fdc7bc830dfe (patch)
treea9400be9c02b13a3c97046e6bbc8a2d23ab172a0
parent04db44067dd4d9bf7f85ae4d704e740d7420f957 (diff)
Respect $NO_COLOR environment variable
Close #1762
-rw-r--r--man/man1/fzf.12
-rw-r--r--src/options.go9
2 files changed, 9 insertions, 2 deletions
diff --git a/man/man1/fzf.1 b/man/man1/fzf.1
index 41a6c22d..8f9c8611 100644
--- a/man/man1/fzf.1
+++ b/man/man1/fzf.1
@@ -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
diff --git a/src/options.go b/src/options.go
index 1f81b9de..669feef4 100644
--- a/src/options.go
+++ b/src/options.go
@@ -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,
@@ -502,7 +509,7 @@ func defaultOptions() *Options {
Multi: 0,
Ansi: false,
Mouse: true,
- Theme: tui.EmptyTheme(),
+ Theme: theme,
Black: false,
Bold: true,
MinHeight: 10,