跳到正文

配置参考

由 Treble schema 和示例 TOML 生成的完整配置字段、默认值、示例值与约束。

更新于

事实来源与更新

本页字段表由 treble.schema.json 和 treble.example.toml 确定性生成,不手写默认值或范围。Rust 测试守护 schema 与示例的一致性;mise run docs:sync 更新 CEL 事实和本页片段,mise run docs:ci 检查生成物是否新鲜。

配置文件位置和 Options 操作见配置与外观。playback.output_mode 的 schema 默认值用于跨平台序列化;Linux 默认构建的运行时首选 PipeWire,不能把 schema 默认值理解为所有平台的运行时后端选择。

字段参考

关于本参考

生成自 treble.schema.json(类型、默认值与约束)和 treble.example.toml(示例值)。请勿手工修改此片段;使用文档事实同步脚本重新生成。

顶层分区

分区 说明
appearance Appearance and semantic UI colors.
eq —
general —
keybindings —
library —
metadata Online metadata provider credentials.
network Global network settings for every outbound request Treble makes at runtime.
playback —
remote Remote library profiles keyed by URI scheme then profile name, matching [remote.<scheme>.<profile>].

外观

Appearance and semantic UI colors.

Colors live in named schemes under [appearance.color_schemes.<name>], and active_color_scheme selects the one the UI paints with. Default is always selectable: a [appearance.color_schemes.Default] table is authoritative when present, otherwise the historical top-level accent_color / <role>_color keys supply it (the compatibility source). On load a missing Default table is materialized from those keys, so Default is a normal editable scheme; the first save writes the table and removes the legacy keys. Inherit is reserved: it has no table and resolves to the terminal’s own ANSI palette, read-only in Options.

Accepted values are the 16 ANSI names (case-insensitive) or strict #RRGGBB; Default means the terminal’s own color. Invalid values are rejected by [Config::validate] with the full config path.

兼容性。 顶层 *_color 键是 Default 方案的旧版来源,单独列在下文。加载时,如果缺少 Default 表,会从这些键生成;首次保存会写入该表并删除旧键。Inherit 是保留方案:它没有 [appearance.color_schemes.Inherit] 表,解析为终端自身的 ANSI 调色板,其颜色行在 Options 中只读。

字段 类型 默认值 示例值 约束 描述
appearance.active_color_scheme string "Default" "Default" — Name of the active color scheme: Default, Inherit, or an exact [appearance.color_schemes.<name>] key.
appearance.image_protocol string "Auto" "Auto" 枚举: Auto, Iterm2, Sixel, Kitty, Halfblocks Terminal graphics protocol for inline images (album art). Auto queries the terminal at startup; the explicit values override the query result — useful over SSH, where the env vars ratatui-image uses to blacklist broken Kitty placeholders in WezTerm don’t propagate.

配色方案

appearance.color_schemes 是以方案名为键的映射。每个值都是包含全部 13 个语义角色的完整配色;Default 始终可用,Inherit 永远没有对应表。角色值接受 16 个 ANSI 名称(不区分大小写)或严格的 #RRGGBB 值;Default 表示终端自身颜色。内部 name 字段未在下表列出,因为表键才是权威来源。

字段 类型 默认值 示例值 约束 描述
appearance.color_schemes object {} {…} 映射值类型: ColorScheme Complete schemes, including Default once it is materialized (always after a save). Custom entries are independent complete palettes; Inherit never has one.
ColorScheme 角色

每一行是 appearance.color_schemes.<name> 下的一个角色。示例值来自 treble.example.toml 中的 Default 方案。

字段 类型 默认值 示例值 约束 描述
appearance.color_schemes.<name>.accent_color string "Yellow" "Yellow" — —
appearance.color_schemes.<name>.border_color string "Default" "Default" — —
appearance.color_schemes.<name>.dialog_background_color string "#25282D" "#25282D" — —
appearance.color_schemes.<name>.dim_color string "Default" "Default" — —
appearance.color_schemes.<name>.error_color string "Red" "Red" — —
appearance.color_schemes.<name>.info_color string "Cyan" "Cyan" — —
appearance.color_schemes.<name>.muted_color string "DarkGray" "DarkGray" — —
appearance.color_schemes.<name>.playing_color string "Yellow" "Yellow" — —
appearance.color_schemes.<name>.progress_color string "Yellow" "Yellow" — —
appearance.color_schemes.<name>.selection_color string "Default" "Default" — —
appearance.color_schemes.<name>.success_color string "Green" "Green" — —
appearance.color_schemes.<name>.text_color string "Default" "Default" — —
appearance.color_schemes.<name>.warning_color string "Yellow" "Yellow" — —

旧版颜色键

这些顶层键仅在不存在 Default 表时读取;首次保存后,它们的值位于 appearance.color_schemes.Default,旧键会被删除。

字段 类型 默认值 示例值 约束 描述
appearance.accent_color string "Yellow" — — Compatibility source for Default, used only while no Default table exists. Read on load, then dropped from the file on save.
appearance.border_color string "Default" — — —
appearance.dialog_background_color string "#25282D" — — —
appearance.dim_color string "Default" — — —
appearance.error_color string "Red" — — —
appearance.info_color string "Cyan" — — —
appearance.muted_color string "DarkGray" — — —
appearance.playing_color string "Yellow" — — —
appearance.progress_color string "Yellow" — — —
appearance.selection_color string "Default" — — —
appearance.success_color string "Green" — — —
appearance.text_color string "Default" — — —
appearance.warning_color string "Yellow" — — —

均衡器

字段 类型 默认值 示例值 约束 描述
eq.bands array<integer> [0,0,0,0,0,0,0,0,0,0] [0,0,0,0,0,0,0,0,0,0] 条目数: 10; 条目范围: -32768..=32767 —
eq.enabled boolean false false — —
eq.mode string "Graphic" "Graphic" 枚举: Graphic, Parametric —
eq.parametric_preset string | null null — — —
eq.preamp integer 0 0 格式: int16; 范围: -32768..=32767 —

通用

字段 类型 默认值 示例值 约束 描述
general.log_level string "Info" "Info" 枚举: Error, Warn, Info, Debug, Trace —
general.startup_screen string "Player" "Player" 枚举: Player, Library, Options, About —

按键绑定

字段 类型 默认值 示例值 约束 描述
keybindings.next_track string "n" "n" 最小长度: 1 —
keybindings.play_pause string "Space" "Space" 最小长度: 1 —
keybindings.previous_track string "p" "p" 最小长度: 1 —
keybindings.seek_back string "Left" "Left" 最小长度: 1 —
keybindings.seek_forward string "Right" "Right" 最小长度: 1 —

媒体库

字段 类型 默认值 示例值 约束 描述
library.group_on_startup boolean false false — Group albums in the Library pane into an album tree at startup; false starts Flat. Pressing g changes only the current view, never this setting.
library.hide_shorter_than_seconds integer 30 30 格式: uint16; 范围: 0..=600 —
library.music_folders array<string> ["~/Music"] ["~/Music"] 最少条目: 1; 条目最小长度: 1 —
library.remote string | null null — — Optional root URI of the active remote library (for example navidrome://home), or unset for the local library. The profile it names is configured under [remote.<scheme>.<profile>]. Changes take effect after a restart.
library.rescan_on_start boolean true true — —
library.track_display string "{{ artist or \"Unknown Artist\" }} — {{ title }}" "{{ artist or \"Unknown Artist\" }} — {{ title }}" — —
library.watch_folders boolean true true — —

元数据

Online metadata provider credentials.

The token is deliberately configuration-only: it is never shown in the Options UI and never logged. A non-blank discogs_token takes precedence; when it is unset or blank, Discogs falls back to the TREBLE_DISCOGS_TOKEN environment variable, and Discogs lookups are unavailable only when neither source holds a usable value (MusicBrainz needs no credentials).

字段 类型 默认值 示例值 约束 描述
metadata.discogs_token string | null null — — Discogs personal access token. A non-blank value wins over the TREBLE_DISCOGS_TOKEN environment variable; unset or blank falls back to it. Discogs is usable only when one of the two is non-blank.

metadata.discogs_token 仅用于配置:它不会显示在 Options UI 中,也不会写入日志。本参考从不输出真实 token:示例未设置时显示 —,已配置时显示脱敏占位符。

Network

Global network settings for every outbound request Treble makes at runtime.

This is a configuration-file-only section: it is not shown in Options and is not hot-reloaded, so restart Treble after changing it. Validation rejects an unsupported proxy scheme or a malformed no_proxy entry before any request is attempted.

字段 类型 默认值 示例值 约束 描述
network.no_proxy string "" — — Comma-separated hosts that bypass the proxy. A bare domain matches only that exact host; *.example.com matches exactly one subdomain level below example.com (not example.com itself and not deeper levels). An IP literal or an IPv4/IPv6 CIDR block matches the URL host literally; no DNS resolution is performed. Empty means no bypass entries.
network.proxy string | null null — — Optional proxy URL for outbound HTTP/HTTPS requests. Accepts the http://, https:// and socks5:// schemes; unset or blank means a direct connection. Credentials embedded in the URL are used for proxy authentication and are not included in validation errors. socks5:// resolves target hostnames locally before connecting through the proxy.

播放

字段 类型 默认值 示例值 约束 描述
playback.alsa_device string "Default" "Default" 最小长度: 1 —
playback.asio_device string "Default" "Default" 最小长度: 1 —
playback.crossfade_seconds integer 0 0 格式: uint16; 范围: 0..=30 Crossfade duration in seconds; 0 disables crossfade.
playback.dsd_mode string "Auto" "Auto" 枚举: Auto, Dop, Direct, Pcm —
playback.gapless boolean true true — —
playback.gapless_preopen_seconds integer 2 2 格式: uint16; 范围: 1..=10 Seconds of the next track pre-opened ahead of a gapless transition.
playback.loudness_mode unknown "Off" "Off" — Loudness normalization mode (Off, ReplayGainTrack, ReplayGainAlbum, or Lufs; default: Off).
playback.output_mode string "WasapiShared" "WasapiShared" 枚举: WasapiShared, WasapiExclusive, Asio, Pipewire, Alsa —
playback.pipewire_device string "Default" "Default" 最小长度: 1 —
playback.prevent_clipping boolean true true — Cap positive normalization gain against track/album peak to prevent clipping (boolean; default: true).
playback.queue_mode unknown "StopAtEnd" "StopAtEnd" — What playback does when the queue reaches its end.
playback.replaygain_fallback_preamp_tenths integer 0 0 格式: int16; 范围: -150..=150 Fallback preamp in tenths of dB for tracks without ReplayGain or LUFS metadata (valid: -150..=150; default: 0).
playback.replaygain_preamp_tenths integer 0 0 格式: int16; 范围: -150..=150 Preamp applied with ReplayGain / LUFS normalization in tenths of dB (valid: -150..=150; default: 0).
playback.resample_quality string "High" "High" 枚举: Quick, Low, Medium, Generic, High, Extreme, VeryHigh, Ultra —
playback.resume_on_start boolean true true — —
playback.seek_step_long_seconds integer 30 30 格式: uint16; 范围: 1..=300 —
playback.seek_step_seconds integer 5 5 格式: uint16; 范围: 1..=300 —
playback.target_lufs_tenths integer -140 -140 格式: int16; 范围: -300..=-50 Target integrated loudness in tenths of LUFS when loudness_mode = “Lufs” (-140 = -14.0 LUFS; valid: -300..=-50; default: -140).
playback.volume_step_percent integer 5 5 格式: uint8; 范围: 1..=100 —
playback.wasapi_exclusive_device string "Default" "Default" 最小长度: 1 —
playback.wasapi_shared_device string "Default" "Default" 最小长度: 1 —

output_mode 在 schema 中的默认值是 WasapiShared。在 Linux 默认构建且 PipeWire 可用时,运行时首选 Pipewire;这不是所有 Linux 构建的无条件默认值。

其他顶层字段

字段 类型 默认值 示例值 约束 描述
remote object {} — 映射值类型: object Remote library profiles keyed by URI scheme then profile name, matching [remote.<scheme>.<profile>]. Configuration-file only: profiles are not shown in Options and passwords remain plaintext in the file.

枚举定义

上文字段共享的枚举,按 schema 顺序列出。可选值按配置接受的原始形式书写。

定义 可选值 描述
DsdMode Auto, Dop, Direct, Pcm —
EqMode Graphic, Parametric —
ImageProtocol Auto, Iterm2, Sixel, Kitty, Halfblocks Terminal graphics protocol for inline images (album art). Auto queries the terminal at startup; the explicit values override the query result — useful over SSH, where the env vars ratatui-image uses to blacklist broken Kitty placeholders in WezTerm don’t propagate.
LogLevel Error, Warn, Info, Debug, Trace —
OutputMode WasapiShared, WasapiExclusive, Asio, Pipewire, Alsa —
ResampleQuality Quick, Low, Medium, Generic, High, Extreme, VeryHigh, Ultra —
StartupScreen Player, Library, Options, About —

完整示例

以下代码块直接来自仓库中的 treble.example.toml,包含注释、配色方案和安全的 Discogs token 占位。

示例配置

随 Treble 提供的完整 treble.example.toml。可将其作为起点复制;schema 会校验每个键,Rust 测试套件保证示例与配置默认值同步。

#:schema ./treble.schema.json

[general]
# Screen shown at startup (Player, Library, Options, or About; default: Player).
startup_screen = "Player"
# Logging verbosity (Error, Warn, Info, Debug, or Trace; default: Info).
log_level = "Info"

[playback]
# Resume the previous track on startup (boolean; default: true).
resume_on_start = true
# Enable gapless playback for consecutive PCM tracks (boolean; default: true). Honoured only when crossfade_seconds = 0; DSD or a differently negotiated output format falls back to a normal track change.
gapless = true
# Seconds before a gapless transition at which the next track's decoder is pre-opened (integer; valid: 1..=10; default: 2). Only schedules the pre-open; the switch itself happens at decoder EOF.
gapless_preopen_seconds = 2
# Crossfade duration in seconds (integer; valid: 0..=30; default: 0; 0 disables crossfade).
crossfade_seconds = 0
# Volume adjustment step percentage (integer; valid: 1..=100; default: 5).
volume_step_percent = 5
# Seek duration in seconds for the plain seek key (integer; valid: 1..=300; default: 5).
seek_step_seconds = 5
# Seek duration in seconds for modifier+seek key (integer; valid: 1..=300; default: 30).
seek_step_long_seconds = 30
# Audio output mode (WasapiShared, WasapiExclusive, Asio, Pipewire, or Alsa; Pipewire and Alsa are Linux options; default: WasapiShared).
output_mode = "WasapiShared"
# Output device per mode (string, device ID; "Default" uses the system default device).
wasapi_shared_device = "Default"
wasapi_exclusive_device = "Default"
asio_device = "Default"
pipewire_device = "Default"
# ALSA PCM name (e.g. "default" or "hw:CARD=...,DEV=..."); "hw:" devices give exclusive bit-perfect output.
alsa_device = "Default"
# DSD playback mode (Auto, Dop, Direct, or Pcm; default: Auto).
dsd_mode = "Auto"
# SoX rate effect quality (Quick, Low, Medium, Generic, High, Extreme, VeryHigh, Ultra; default: High).
resample_quality = "High"
# What playback does when the queue ends (StopAtEnd, RepeatAll, or Random; default: StopAtEnd).
queue_mode = "StopAtEnd"
# Loudness normalization mode (Off, ReplayGainTrack, ReplayGainAlbum, or Lufs; default: Off).
loudness_mode = "Off"
# Target integrated loudness in tenths of LUFS when loudness_mode = "Lufs" (-140 = -14.0 LUFS; valid: -300..=-50; default: -140).
target_lufs_tenths = -140
# Preamp applied with ReplayGain / LUFS normalization in tenths of dB (valid: -150..=150; default: 0).
replaygain_preamp_tenths = 0
# Fallback preamp in tenths of dB when loudness metadata is unavailable (valid: -150..=150; default: 0).
replaygain_fallback_preamp_tenths = 0
# Cap positive normalization gain against peak to prevent clipping (boolean; default: true).
prevent_clipping = true

[eq]
mode = "Graphic"
enabled = false
preamp = 0
bands = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

[library]
# Music library folders (array of non-empty strings, scanned recursively; default: ["~/Music"]).
music_folders = ["~/Music"]
# Watch library folders for changes (boolean; default: true).
watch_folders = true
# Rescan the library on startup (boolean; default: true).
rescan_on_start = true
# Start the Library pane with grouped album tree (boolean; false starts flat; default: false).
group_on_startup = false
# Hide tracks shorter than this many seconds (integer; valid: 0..=600; default: 30).
hide_shorter_than_seconds = 30
# Track display template (miniJinja syntax; default: "{{ artist or \"Unknown Artist\" }} — {{ title }}").
# Available variables:
#   artist              artist name (none when untagged)
#   title               track title
#   album               album name (none when untagged)
#   track               track number (none when untagged)
#   duration            duration in seconds
#   duration_formatted  duration as "m:ss" ("--:--" when unknown)
#   filename            file name without extension
#   path                full file path
track_display = "{{ artist or \"Unknown Artist\" }} — {{ title }}"
# Active remote library root URI (string; default: unset, local folders only).
# Set a root URI such as "navidrome://home" to use the profile configured under
# [remote.navidrome.home]. It must name the scheme and profile only, without a
# track or cover path. Changes take effect after a restart.
# remote = "navidrome://home"

[appearance]
# Active color scheme (string; default: "Default"). Values are "Default",
# "Inherit", or the exact name of a [appearance.color_schemes.<name>] table.
# "Default" is always available and editable. "Inherit" has no stored table:
# every role is an ANSI name the terminal resolves itself, and the Colors rows
# are read-only while it is active.
active_color_scheme = "Default"
# Terminal graphics protocol for inline images (album art) (Auto, Iterm2, Sixel, Kitty, or
# Halfblocks; default: Auto queries the terminal). Set explicitly when
# auto-detection fails, e.g. over SSH to WezTerm where the environment
# variables used to avoid WezTerm's broken Kitty placeholders don't
# propagate — use "Iterm2" there.
image_protocol = "Auto"

# Color schemes. Each table is a complete palette of all 13 semantic roles;
# no value is inherited from another scheme. Each accepts an ANSI color name
# (Black, Red, Green, Yellow, Blue, Magenta, Cyan, Gray, DarkGray, LightRed,
# LightGreen, LightYellow, LightBlue, LightMagenta, LightCyan, White, Default —
# case insensitive) or a strict "#RRGGBB" hex value. "Default" means the
# terminal's own foreground/background. Invalid values are rejected on load.
# Scheme names are arbitrary strings; TOML quoting applies (a name with a dot
# or space is written as a quoted key). "Inherit" is reserved and must not
# have a table. Names that differ only by case are rejected.
#
# The historical top-level accent_color/text_color/... keys are still read as
# the compatibility source for Default; the first save migrates them into
# [appearance.color_schemes.Default] and removes the old keys.
[appearance.color_schemes.Default]
# Accent color: borders, titles and highlights (string; default: "Yellow").
accent_color = "Yellow"
# Normal text (string; default: "Default").
text_color = "Default"
# De-emphasized secondary text (string; default: "Default").
dim_color = "Default"
# Muted/tertiary text such as hints (string; default: "DarkGray").
muted_color = "DarkGray"
# Pane and popup borders (string; default: "Default").
border_color = "Default"
# Selected row / inverted cursor (string; default: "Default").
selection_color = "Default"
# Dialog and popup surface background (string; default: "#25282D").
dialog_background_color = "#25282D"
# Now-playing indicator (string; default: "Yellow").
playing_color = "Yellow"
# Progress bar fill (string; default: "Yellow").
progress_color = "Yellow"
# Success/confirmation messages (string; default: "Green").
success_color = "Green"
# Warnings and notices (string; default: "Yellow").
warning_color = "Yellow"
# Errors and failures (string; default: "Red").
error_color = "Red"
# Informational highlights (string; default: "Cyan").
info_color = "Cyan"
#
# A custom scheme is an independent copy; edit it in Options or add a table
# like this and select it with active_color_scheme:
# [appearance.color_schemes."Ocean Night"]
# accent_color = "#7AA2F7"
# text_color = "#C0CAF5"
# dim_color = "#A9B1D6"
# muted_color = "#565F89"
# border_color = "#3B4261"
# selection_color = "#2E3C64"
# dialog_background_color = "#1F2335"
# playing_color = "#9ECE6A"
# progress_color = "#7AA2F7"
# success_color = "#9ECE6A"
# warning_color = "#E0AF68"
# error_color = "#F7768E"
# info_color = "#7DCFFF"

[keybindings]
# Key for toggling playback (string; non-empty; default: "Space").
play_pause = "Space"
# Key for next track (string; non-empty; default: "n").
next_track = "n"
# Key for previous track (string; non-empty; default: "p").
previous_track = "p"
# Key for seeking forward (string; non-empty; default: "Right").
seek_forward = "Right"
# Key for seeking backward (string; non-empty; default: "Left").
seek_back = "Left"

[metadata]
# Discogs personal access token used for online metadata lookups (string; default: unset).
# Create one at https://www.discogs.com/settings/developers. Keep it commented out until you
# have a token, and never commit a real token to a shared repository.
# discogs_token = "paste-your-discogs-personal-access-token-here"

[network]
# Proxy for all runtime online requests (string; http://, https://, or socks5://;
# default: direct connection). Proxy credentials are omitted from validation errors.
# socks5:// resolves target hostnames locally before connecting through the proxy.
# proxy = "http://127.0.0.1:8080"
# Comma-separated hosts that bypass the proxy (string; default: empty).
# A bare domain matches only that exact host; *.example.com matches exactly one
# subdomain level below example.com (not example.com itself and not deeper
# levels). An IP literal or an IPv4/IPv6 CIDR block matches the URL host
# literally; no DNS resolution is performed.
# no_proxy = "localhost,*.example.com,10.0.0.0/8,::1"

# Remote library profiles, keyed by <scheme>.<profile>. The root URI in
# library.remote selects one (for example "navidrome://home" selects
# [remote.navidrome.home]). These settings are configuration-file only and are
# not shown in Options; restart Treble after changing them.
#
# The password is stored as PLAINTEXT in this file: keep the file private and
# prefer an HTTPS server URL. cache_dir is optional (unset uses Treble's normal
# cache location); cache_max_mib bounds the local remote cache in MiB.
#
# [remote.navidrome.home]
# # Base server URL (http:// or https://; no user info, query or fragment).
# url = "https://music.example"
# username = "your-username"
# password = "your-password"
# # Optional per-profile cache directory.
# cache_dir = "C:/TrebleCache"
# # Local cache limit in MiB (integer; valid: 1..=1048576; default: 2048).
# cache_max_mib = 2048

输入关键词开始搜索…

↑↓ 选择↵ 打开Esc 关闭