From 2a92c7d792b45112ab82eef0be2aa11038e6185d Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 17 Sep 2025 19:38:49 +0900 Subject: [PATCH] Adjust base16 (16) theme (#4501) Motivation: `--color base16` can be a better default than `dark` or `light`, since it uses the colors defined by the current theme. This usually blends in more naturally and works well in both light and dark modes. However, some elements were previously hard-coded with white or black foreground colors, which can cause rendering issues in certain terminal themes. --- CHANGELOG.md | 1 + man/man1/fzf.1 | 8 ++++---- src/options.go | 4 ++-- src/tui/tui.go | 20 ++++++++++++++------ 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 228624a5..f96128a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ CHANGELOG 0.66.0 ------ - Style changes + - Updated `--color base16` (alias: `16`) theme so that it works better with both dark and light themes. - Narrowed the gutter column by using the left-half block character (`▌`). - Removed background colors from markers. - Added `--gutter CHAR` option for customizing the gutter column. Some examples using [box-drawing characters](https://en.wikipedia.org/wiki/Box-drawing_characters): diff --git a/man/man1/fzf.1 b/man/man1/fzf.1 index d53d4991..0a6a9ff9 100644 --- a/man/man1/fzf.1 +++ b/man/man1/fzf.1 @@ -246,11 +246,11 @@ color mappings. Each entry is separated by a comma and/or whitespaces. .RS .B BASE SCHEME: - (default: \fBdark\fR on 256-color terminal, otherwise \fB16\fR; If \fBNO_COLOR\fR is set, \fBbw\fR) + (default: \fBdark\fR on 256-color terminal, otherwise \fBbase16\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 - \fB16 \fRColor scheme for 16-color terminal + \fBdark \fRColor scheme for dark terminal + \fBlight \fRColor scheme for light terminal + \fBbase16 \fRColor scheme using base 16 colors (alias: \fB16\fR) \fBbw \fRNo colors (equivalent to \fB\-\-no\-color\fR) .B COLOR NAMES: diff --git a/src/options.go b/src/options.go index 5e89a261..71782bf2 100644 --- a/src/options.go +++ b/src/options.go @@ -59,7 +59,7 @@ Usage: fzf [options] GLOBAL STYLE --style=PRESET Apply a style preset [default|minimal|full[:BORDER_STYLE] - --color=COLSPEC Base scheme (dark|light|16|bw) and/or custom colors + --color=COLSPEC Base scheme (dark|light|base16|bw) and/or custom colors --no-color Disable colors --no-bold Do not use bold text @@ -1326,7 +1326,7 @@ func parseTheme(defaultTheme *tui.ColorTheme, str string) (*tui.ColorTheme, erro theme = dupeTheme(tui.Dark256) case "light": theme = dupeTheme(tui.Light256) - case "16": + case "base16", "16": theme = dupeTheme(tui.Default16) case "bw", "no": theme = tui.NoColorTheme() diff --git a/src/tui/tui.go b/src/tui/tui.go index 965be337..106d6c86 100644 --- a/src/tui/tui.go +++ b/src/tui/tui.go @@ -303,6 +303,14 @@ const ( colMagenta colCyan colWhite + colGrey + colBrightRed + colBrightGreen + colBrightYellow + colBrightBlue + colBrightMagenta + colBrightCyan + colBrightWhite ) type FillReturn int @@ -923,19 +931,19 @@ func init() { SelectedFg: ColorAttr{colUndefined, AttrUndefined}, SelectedBg: ColorAttr{colUndefined, AttrUndefined}, SelectedMatch: ColorAttr{colUndefined, AttrUndefined}, - DarkBg: ColorAttr{colBlack, AttrUndefined}, + DarkBg: ColorAttr{colGrey, AttrUndefined}, Prompt: ColorAttr{colBlue, AttrUndefined}, Match: ColorAttr{colGreen, AttrUndefined}, - Current: ColorAttr{colYellow, AttrUndefined}, - CurrentMatch: ColorAttr{colGreen, AttrUndefined}, + Current: ColorAttr{colBrightWhite, AttrUndefined}, + CurrentMatch: ColorAttr{colBrightGreen, AttrUndefined}, Spinner: ColorAttr{colGreen, AttrUndefined}, - Info: ColorAttr{colWhite, AttrUndefined}, + Info: ColorAttr{colYellow, AttrUndefined}, Cursor: ColorAttr{colRed, AttrUndefined}, Marker: ColorAttr{colMagenta, AttrUndefined}, Header: ColorAttr{colCyan, AttrUndefined}, Footer: ColorAttr{colCyan, AttrUndefined}, - Border: ColorAttr{colBlack, AttrUndefined}, - BorderLabel: ColorAttr{colWhite, AttrUndefined}, + Border: ColorAttr{colDefault, Dim}, + BorderLabel: ColorAttr{colDefault, AttrUndefined}, Ghost: ColorAttr{colUndefined, Dim}, Disabled: ColorAttr{colUndefined, AttrUndefined}, PreviewFg: ColorAttr{colUndefined, AttrUndefined},