Skip to content
Myr

Add color name 'preview-label' (#3053)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent 6b207bb · Browse files · 5 files+38 added−37 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+38 added−37 removed

  • other:+38 added−37 removed

5 files+38 added−37 removed

modified:man/man1/fzf.1+21 added-20 removed
402 unmodified lines
403 \fB16 \fRColor scheme for 16-color terminal404 \fBbw \fRNo colors (equivalent to \fB--no-color\fR)405406.B COLOR NAMES:407 \fBfg \fRText408 \fBbg \fRBackground409 \fBpreview-fg \fRPreview window text410 \fBpreview-bg \fRPreview window background411 \fBhl \fRHighlighted substrings412 \fBfg+ \fRText (current line)413 \fBbg+ \fRBackground (current line)414 \fBgutter \fRGutter on the left (defaults to \fBbg+\fR)415 \fBhl+ \fRHighlighted substrings (current line)416 \fBquery \fRQuery string417 \fBdisabled \fRQuery string when search is disabled418 \fBinfo \fRInfo line (match counters)419 \fBseparator \fRHorizontal separator on info line (match counters)420 \fBborder \fRBorder around the window (\fB--border\fR and \fB--preview\fR)421 \fBlabel \fRBorder label (\fB--border-label\fR and \fB--preview-label\fR)422 \fBprompt \fRPrompt423 \fBpointer \fRPointer to the current line424 \fBmarker \fRMulti-select marker425 \fBspinner \fRStreaming input indicator426 \fBheader \fRHeader407 \fBfg \fRText408 \fBbg \fRBackground409 \fBpreview-fg \fRPreview window text410 \fBpreview-bg \fRPreview window background411 \fBhl \fRHighlighted substrings412 \fBfg+ \fRText (current line)413 \fBbg+ \fRBackground (current line)414 \fBgutter \fRGutter on the left (defaults to \fBbg+\fR)415 \fBhl+ \fRHighlighted substrings (current line)416 \fBquery \fRQuery string417 \fBdisabled \fRQuery string when search is disabled418 \fBinfo \fRInfo line (match counters)419 \fBseparator \fRHorizontal separator on info line (match counters)420 \fBborder \fRBorder around the window (\fB--border\fR and \fB--preview\fR)421 \fBlabel \fRBorder label (\fB--border-label\fR and \fB--preview-label\fR)422 \fBpreview-label \fRBorder label of the preview window (\fB--preview-label\fR)423 \fBprompt \fRPrompt424 \fBpointer \fRPointer to the current line425 \fBmarker \fRMulti-select marker426 \fBspinner \fRStreaming input indicator427 \fBheader \fRHeader428429.B ANSI COLORS:430 \fB-1 \fRDefault terminal foreground/background color431 \fB \fR(or the original color of the text)
715 unmodified lines
modified:src/tui/tui.go+12 added-16 removed
268 unmodified lines
269 Header ColorAttr270 Separator ColorAttr271 Border ColorAttr272 BorderLabel ColorAttr273 PreviewLabel ColorAttr274}275276type Event struct {277 Type EventType
190 unmodified lines
468 ColBorder ColorPair469 ColPreview ColorPair470 ColPreviewBorder ColorPair471 ColBorderLabel ColorPair472 ColPreviewLabel ColorPair473)474475func EmptyTheme() *ColorTheme {476 return &ColorTheme{
17 unmodified lines
494 Header: ColorAttr{colUndefined, AttrUndefined},495 Separator: ColorAttr{colUndefined, AttrUndefined},496 Border: ColorAttr{colUndefined, AttrUndefined},497 BorderLabel: ColorAttr{colUndefined, AttrUndefined},498 PreviewLabel: ColorAttr{colUndefined, AttrUndefined},499 }500}501502func NoColorTheme() *ColorTheme {
18 unmodified lines
521 Header: ColorAttr{colDefault, AttrRegular},522 Separator: ColorAttr{colDefault, AttrRegular},523 Border: ColorAttr{colDefault, AttrRegular},524 BorderLabel: ColorAttr{colDefault, AttrRegular},525 PreviewLabel: ColorAttr{colDefault, AttrRegular},526 }527}528529func errorExit(message string) {
4 unmodified lines
534func init() {535 Default16 = &ColorTheme{536 Colored: true,537 Input: ColorAttr{colDefault, AttrUndefined},534 Disabled: ColorAttr{colUndefined, AttrUndefined},538 Fg: ColorAttr{colDefault, AttrUndefined},539 Bg: ColorAttr{colDefault, AttrUndefined},537 PreviewFg: ColorAttr{colUndefined, AttrUndefined},538 PreviewBg: ColorAttr{colUndefined, AttrUndefined},540 DarkBg: ColorAttr{colBlack, AttrUndefined},540 Gutter: ColorAttr{colUndefined, AttrUndefined},541 Prompt: ColorAttr{colBlue, AttrUndefined},542 Match: ColorAttr{colGreen, AttrUndefined},543 Current: ColorAttr{colYellow, AttrUndefined},544 CurrentMatch: ColorAttr{colGreen, AttrUndefined},
8 unmodified lines
553 }554 Dark256 = &ColorTheme{555 Colored: true,556 Input: ColorAttr{colDefault, AttrUndefined},557 Disabled: ColorAttr{colUndefined, AttrUndefined},557 Fg: ColorAttr{colDefault, AttrUndefined},558 Bg: ColorAttr{colDefault, AttrUndefined},560 PreviewFg: ColorAttr{colUndefined, AttrUndefined},561 PreviewBg: ColorAttr{colUndefined, AttrUndefined},559 DarkBg: ColorAttr{236, AttrUndefined},563 Gutter: ColorAttr{colUndefined, AttrUndefined},560 Prompt: ColorAttr{110, AttrUndefined},561 Match: ColorAttr{108, AttrUndefined},562 Current: ColorAttr{254, AttrUndefined},563 CurrentMatch: ColorAttr{151, AttrUndefined},
8 unmodified lines
572 }573 Light256 = &ColorTheme{574 Colored: true,575 Input: ColorAttr{colDefault, AttrUndefined},580 Disabled: ColorAttr{colUndefined, AttrUndefined},576 Fg: ColorAttr{colDefault, AttrUndefined},577 Bg: ColorAttr{colDefault, AttrUndefined},583 PreviewFg: ColorAttr{colUndefined, AttrUndefined},584 PreviewBg: ColorAttr{colUndefined, AttrUndefined},578 DarkBg: ColorAttr{251, AttrUndefined},586 Gutter: ColorAttr{colUndefined, AttrUndefined},579 Prompt: ColorAttr{25, AttrUndefined},580 Match: ColorAttr{66, AttrUndefined},581 Current: ColorAttr{237, AttrUndefined},582 CurrentMatch: ColorAttr{23, AttrUndefined},
23 unmodified lines
606 }607 return c608 }609 theme.Input = o(baseTheme.Input, theme.Input)618 theme.Disabled = o(theme.Input, o(baseTheme.Disabled, theme.Disabled))610 theme.Fg = o(baseTheme.Fg, theme.Fg)611 theme.Bg = o(baseTheme.Bg, theme.Bg)621 theme.PreviewFg = o(theme.Fg, o(baseTheme.PreviewFg, theme.PreviewFg))622 theme.PreviewBg = o(theme.Bg, o(baseTheme.PreviewBg, theme.PreviewBg))612 theme.DarkBg = o(baseTheme.DarkBg, theme.DarkBg)624 theme.Gutter = o(theme.DarkBg, o(baseTheme.Gutter, theme.Gutter))613 theme.Prompt = o(baseTheme.Prompt, theme.Prompt)614 theme.Match = o(baseTheme.Match, theme.Match)615 theme.Current = o(baseTheme.Current, theme.Current)616 theme.CurrentMatch = o(baseTheme.CurrentMatch, theme.CurrentMatch)
5 unmodified lines
622 theme.Separator = o(baseTheme.Separator, theme.Separator)623 theme.Border = o(baseTheme.Border, theme.Border)624 theme.BorderLabel = o(baseTheme.BorderLabel, theme.BorderLabel)625626 // These colors are not defined in the base themes627 theme.Disabled = o(theme.Input, theme.Disabled)628 theme.Gutter = o(theme.DarkBg, theme.Gutter)629 theme.PreviewFg = o(theme.Fg, theme.PreviewFg)630 theme.PreviewBg = o(theme.Bg, theme.PreviewBg)631 theme.PreviewLabel = o(theme.BorderLabel, theme.PreviewLabel)632633 initPalette(theme)634}635636func initPalette(theme *ColorTheme) {
25 unmodified lines
662 ColHeader = pair(theme.Header, theme.Bg)663 ColSeparator = pair(theme.Separator, theme.Bg)664 ColBorder = pair(theme.Border, theme.Bg)665 ColBorderLabel = pair(theme.BorderLabel, theme.Bg)666 ColPreviewLabel = pair(theme.PreviewLabel, theme.PreviewBg)667 ColPreview = pair(theme.PreviewFg, theme.PreviewBg)668 ColPreviewBorder = pair(theme.Border, theme.PreviewBg)669}
modified:src/options.go+2 added
843 unmodified lines
844 case "separator":845 mergeAttr(&theme.Separator)846 case "label":847 mergeAttr(&theme.BorderLabel)848 case "preview-label":849 mergeAttr(&theme.PreviewLabel)850 case "prompt":851 mergeAttr(&theme.Prompt)852 case "spinner":853 mergeAttr(&theme.Spinner)
1086 unmodified lines
modified:src/terminal.go+1 added-1 removed
600 unmodified lines
601 // Pre-calculated empty pointer and marker signs602 t.pointerEmpty = strings.Repeat(" ", t.pointerLen)603 t.markerEmpty = strings.Repeat(" ", t.markerLen)604 t.borderLabel, t.borderLabelLen = t.ansiLabelPrinter(opts.BorderLabel.label, &tui.ColBorderLabel, false)605 t.previewLabel, t.previewLabelLen = t.ansiLabelPrinter(opts.PreviewLabel.label, &tui.ColBorderLabel, false)605 t.previewLabel, t.previewLabelLen = t.ansiLabelPrinter(opts.PreviewLabel.label, &tui.ColPreviewLabel, false)606 if opts.Separator == nil || len(*opts.Separator) > 0 {607 bar := "─"608 if opts.Separator != nil {609 bar = *opts.Separator
2532 unmodified lines
modified:CHANGELOG.md+2 added
7 unmodified lines
8 ```sh9 # No need to bind 'double-click' to the same action10 fzf --bind 'enter:execute:less {}' # --bind 'double-click:execute:less {}'11 ```12- Added color name `preview-label` for `--preview-label` (defaults to `label`13 for `--border-label`)14- Minor bug fixes and improvements15160.35.117------
1387 unmodified lines