From 91beacf0f4966e0e5ddbcdedae008d8a66f93ab9 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 1 Oct 2025 23:47:09 +0900 Subject: Add special 'strip' style attribute for stripping colors Test cases: fd --color always | fzf --ansi --delimiter / fd --color always | fzf --ansi --delimiter / --nth -1 --color fg:dim,nth:regular fd --color always | fzf --ansi --delimiter / --nth -1 --color fg:dim:strip,nth:regular fd --color always | fzf --ansi --delimiter / --nth -1 --color fg:dim:strip,nth:regular --raw fd --color always | fzf --ansi --delimiter / --nth -1 --color fg:dim:strip,nth:regular,hidden:strikethrough --raw fd --color always | fzf --ansi --delimiter / --nth -1 --color fg:dim:strip,nth:regular,hidden:strip:strikethrough --raw fd --color always | fzf --ansi --delimiter / --nth -1 --color fg:dim:strip,nth:regular,hidden:strip:dim:strikethrough --raw --- src/tui/tui.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/tui') diff --git a/src/tui/tui.go b/src/tui/tui.go index 563d3c2a..33fb626f 100644 --- a/src/tui/tui.go +++ b/src/tui/tui.go @@ -16,6 +16,7 @@ const ( AttrClear = Attr(1 << 9) BoldForce = Attr(1 << 10) FullBg = Attr(1 << 11) + Strip = Attr(1 << 12) ) func (a Attr) Merge(b Attr) Attr { @@ -384,6 +385,10 @@ func (p ColorPair) IsFullBgMarker() bool { return p.attr&FullBg > 0 } +func (p ColorPair) ShouldStripColors() bool { + return p.attr&Strip > 0 +} + func (p ColorPair) HasBg() bool { return p.attr&Reverse == 0 && p.bg != colDefault || p.attr&Reverse > 0 && p.fg != colDefault -- cgit v1.2.3