Merge pull request #724 from peco/chore-remove-use256color

Remove dead Use256Color config field
This commit is contained in:
lestrrat 2026-02-19 19:46:48 +09:00 committed by GitHub
commit d9e46440b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 8 additions and 46 deletions

View file

@ -11,6 +11,9 @@ v0.6.0 - UNRELEASED
* The action `ViewArround` has been renamed to `ViewAround` (fix typo).
The old name still works but shows a deprecation notice. If you have
`"ViewArround"` in your config, please update it to `"ViewAround"`.
* Removed `Use256Color` config field. After the tcell migration,
256-color and truecolor support is automatic via terminfo detection.
Existing configs with this field will continue to load without error.
[Features]
* Added YAML configuration file support. You can now use

View file

@ -455,7 +455,6 @@ Below are configuration sections that you may specify in your config file:
* [Styles](#styles)
* [CustomFilter](#customfilter)
* [Prompt](#prompt)
* [Use256Color](#use256color)
* [ANSI](#ansi)
## Global
@ -800,7 +799,7 @@ Styles can be customized in `config.json`.
- `"magenta"` for `tcell.ColorMagenta`
- `"cyan"` for `tcell.ColorCyan`
- `"white"` for `tcell.ColorWhite`
- `"0"`-`"255"` for 256color ([Use256Color](#use256color) must be enabled)
- `"0"`-`"255"` for 256color (automatically supported via tcell)
### Background Colors
@ -812,7 +811,7 @@ Styles can be customized in `config.json`.
- `"on_magenta"` for `tcell.ColorMagenta`
- `"on_cyan"` for `tcell.ColorCyan`
- `"on_white"` for `tcell.ColorWhite`
- `"on_0"`-`"on_255"` for 256color ([Use256Color](#use256color) must be enabled)
- `"on_0"`-`"on_255"` for 256color (automatically supported via tcell)
### Attributes
@ -896,18 +895,6 @@ See --layout.
}
```
## Use256Color
Boolean value that determines whether or not to use 256color. The default is `false`.
Note: This has no effect on Windows because Windows console does not support extra color modes.
```json
{
"Use256Color": true
}
```
# FAQ
## Does peco work on (msys2|cygwin)?

View file

@ -45,7 +45,6 @@ type Config struct {
Style StyleSet `json:"Style" yaml:"Style"`
Prompt string `json:"Prompt" yaml:"Prompt"`
Layout string `json:"Layout" yaml:"Layout"`
Use256Color bool `json:"Use256Color" yaml:"Use256Color"`
OnCancel OnCancelBehavior `json:"OnCancel" yaml:"OnCancel"`
CustomFilter map[string]CustomFilterConfig `json:"CustomFilter" yaml:"CustomFilter"`
QueryExecutionDelay int `json:"QueryExecutionDelay" yaml:"QueryExecutionDelay"`
@ -153,7 +152,6 @@ func (c *Config) Init() error {
c.Style.Init()
c.Prompt = DefaultPrompt
c.Layout = LayoutTypeTopDown
c.Use256Color = false
return nil
}

View file

@ -741,8 +741,6 @@ CustomFilter
.IP \[bu] 2
Prompt
.IP \[bu] 2
Use256Color
.IP \[bu] 2
ANSI
.SS Global
.PP
@ -1578,8 +1576,8 @@ used.
.IP \[bu] 2
\f[V]\[dq]white\[dq]\f[R] for \f[V]tcell.ColorWhite\f[R]
.IP \[bu] 2
\f[V]\[dq]0\[dq]\f[R]-\f[V]\[dq]255\[dq]\f[R] for 256color (Use256Color
must be enabled)
\f[V]\[dq]0\[dq]\f[R]-\f[V]\[dq]255\[dq]\f[R] for 256color
(automatically supported via tcell)
.SS Background Colors
.IP \[bu] 2
\f[V]\[dq]on_black\[dq]\f[R] for \f[V]tcell.ColorBlack\f[R]
@ -1599,7 +1597,7 @@ must be enabled)
\f[V]\[dq]on_white\[dq]\f[R] for \f[V]tcell.ColorWhite\f[R]
.IP \[bu] 2
\f[V]\[dq]on_0\[dq]\f[R]-\f[V]\[dq]on_255\[dq]\f[R] for 256color
(Use256Color must be enabled)
(automatically supported via tcell)
.SS Attributes
.IP \[bu] 2
\f[V]\[dq]bold\[dq]\f[R] for fg: \f[V]tcell.AttrBold\f[R]
@ -1735,21 +1733,6 @@ See \[en]layout.
}
\f[R]
.fi
.SS Use256Color
.PP
Boolean value that determines whether or not to use 256color.
The default is \f[V]false\f[R].
.PP
Note: This has no effect on Windows because Windows console does not
support extra color modes.
.IP
.nf
\f[C]
{
\[dq]Use256Color\[dq]: true
}
\f[R]
.fi
.SH FAQ
.SS Does peco work on (msys2|cygwin)?
.PP

View file

@ -84,7 +84,6 @@ type Peco struct {
readConfigFn func(*Config, string) error
styles StyleSet
enableANSI bool // Enable ANSI color code support
use256Color bool
fuzzyLongestSort bool
// Source is where we buffer input. It gets reused when a new query is
@ -241,10 +240,6 @@ func (p *Peco) Styles() *StyleSet {
return &p.styles
}
func (p *Peco) Use256Color() bool {
return p.use256Color
}
func (p *Peco) Prompt() string {
return p.prompt
}
@ -738,8 +733,6 @@ func (p *Peco) ApplyConfig(opts CLIOptions) error {
p.prompt = v
}
p.use256Color = p.config.Use256Color
p.onCancel = p.config.OnCancel
if p.onCancel == "" {
p.onCancel = OnCancelSuccess

View file

@ -405,7 +405,6 @@ func TestApplyConfig(t *testing.T) {
t.Run("Config-level fields", func(t *testing.T) {
p := newPeco()
p.config.MaxScanBufferSize = 512
p.config.Use256Color = true
p.config.FuzzyLongestSort = true
p.config.ANSI = true
@ -413,7 +412,6 @@ func TestApplyConfig(t *testing.T) {
require.NoError(t, p.ApplyConfig(opts), "p.ApplyConfig should succeed")
require.Equal(t, 512, p.maxScanBufferSize, "p.maxScanBufferSize should be equal to config.MaxScanBufferSize")
require.True(t, p.use256Color, "p.use256Color should be true when config.Use256Color is true")
require.True(t, p.fuzzyLongestSort, "p.fuzzyLongestSort should be true when config.FuzzyLongestSort is true")
require.True(t, p.enableANSI, "p.enableANSI should be true when config.ANSI is true")
})