feat(#300): スペクトラムに透明度と角丸の設定キーを追加#302
Conversation
#297 フォローアップの軽微な設定化2項目。どちらもデフォルトで既存の見た目 を維持する後方互換。 - bar_opacity (0–1, 既定 1): バー全体の不透明度。背景描画の後に GraphicsContext.opacity としてバー層へ適用するので bar_color 自身の アルファと乗算合成され、background_color とは独立。不透明な bar_color と併用すれば色と透明度を分離できる。 - bar_corner_radius (既定 nil = 自動): バーの角丸半径。コード固定だった min(bar_width/4, 3) を純粋関数 autoCornerRadius(thickness:) へ抽出して テスタブル化し、spectrumBarRects にオプショナルの cornerRadius: 引数を 追加 (per-bar で厚みの半分にクランプ、0 で角なし)。 - ConfigRepository で opacity を 0…1、corner radius を 0 下限にクランプ。 Config → Style → View の既存パイプラインに乗せ、SpectrumConfig / SpectrumStyle / ConfigRepository / SpectrumView / README / CLAUDE.md を更新。 デコード・クランプ・幾何 (autoCornerRadius / cornerRadius クランプ) を ユニットテストで検証。 Closes #300
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds two backward-compatible Spectrum options, ChangesSpectrum bar opacity and corner radius
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds two new opt-in spectrum appearance knobs—master bar opacity and configurable bar corner radius—wired through the existing Config → Style → View pipeline while keeping default rendering unchanged.
Changes:
- Add
[spectrum]config keysbar_opacity(0–1, default 1) andbar_corner_radius(optional; default auto). - Implement bar-layer opacity in
SpectrumViewand extract the default corner radius intoautoCornerRadius(thickness:), with per-bar clamping. - Update docs, templates/snapshots, tests, and bump version to
2.20.0.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/ViewsTests/SpectrumBarRectsTests.swift | Adds unit tests for autoCornerRadius and spectrumBarRects corner-radius clamping behavior. |
| Tests/ConfigRepositoryTests/ConfigRepositoryTests.swift | Verifies repository clamping for bar_opacity (0…1) and bar_corner_radius (floored at 0). |
| Tests/ConfigDataSourceTests/ConfigTemplateTests.swift | Updates expected TOML/JSON templates to reflect the new default bar_opacity field. |
| Tests/ConfigDataSourceTests/ConfigDecodingTests.swift | Adds decoding coverage for default and explicitly-specified bar_opacity / bar_corner_radius. |
| Sources/Views/Spectrum/SpectrumView.swift | Applies barOpacity to the bar layer and threads barCornerRadius into geometry; introduces autoCornerRadius. |
| Sources/VersionHandler/Resources/version.txt | Bumps version from 2.19.0 to 2.20.0. |
| Sources/Entity/Style/SpectrumStyle.swift | Extends SpectrumStyle with barOpacity and barCornerRadius. |
| Sources/Entity/Config/SpectrumConfig.swift | Extends SpectrumConfig Codable model with bar_opacity and bar_corner_radius keys + defaults. |
| Sources/ConfigRepository/ConfigRepositoryImpl.swift | Clamps barOpacity and floors barCornerRadius when building SpectrumStyle. |
| README.md | Documents the new spectrum keys and their behavior/defaults. |
| .claude/CLAUDE.md | Updates architecture/feature notes to include the new spectrum knobs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- SpectrumConfig.barOpacity の doc コメント: グラデの各 stop の alpha 比率を 保ったまま1ノブで全体をフェードできるエルゴノミクスを前面に出す - README.md の bar_opacity 行: 同趣旨で書き換え(per-stop alpha を手計算不要 という key value を一文で伝える) 「hex alpha と冗長では?」という誤解を防ぐための記述改善。
CI 高負荷時、tickUntil の 3 秒壁時計デッドラインでは leaky integrator の ~4x overshoot から <1 まで落ちる tick 数が足りずフレーキーに失敗していた。 終了条件を秒数ではなく tick 数の予算に切り替え、負荷時は遅くなるだけで デッドラインを踏まないようにした。1ms sleep は capturing フラグの メインキュー配送を drain する用途で残置。
概要
#297 のフォローアップ。スペクトラムアナライザに
bar_opacity(バーの不透明度)とbar_corner_radius(バーの角丸半径)の設定キーを追加する。どちらもデフォルトで既存の描画結果を保つ後方互換な追加。変更内容
bar_opacity(0–1、既定1): バー全体の不透明度。背景描画の後・バー塗りの前にGraphicsContext.opacityとしてバー層へ適用するので、bar_color自身のアルファと乗算合成され、background_colorとは独立して効く。不透明なbar_colorと併用すれば「色」と「透明度」を分離指定できる。ConfigRepositoryで0…1にクランプ。bar_corner_radius(既定nil= 自動): バーの角丸半径(pt)。従来コード固定だったmin(bar_width/4, 3)を純粋関数autoCornerRadius(thickness:)に抽出してテスタブル化し、spectrumBarRectsにオプショナルのcornerRadius:引数を追加。指定時は per-bar で厚みの半分にクランプ(0で角なし)。ConfigRepositoryで0下限にクランプ。SpectrumConfig/SpectrumStyle/ConfigRepository/SpectrumView)に沿って伝搬。README.md/.claude/CLAUDE.mdを更新。2.20.0に更新。背景・動機
#297 のクローズ時に残った軽微な設定化2項目を切り出したフォローアップ(#297 → #300)。「良い状態をデフォルトで見せつつ、必要なら調整できる」という本プロジェクトの方針に沿って、curated-default-but-configurable として追加する。
テスト計画
ConfigDecodingTests: セクション欠如でbar_opacity == 1/bar_corner_radius == nil、明示指定のデコードConfigTemplateTests: TOML / JSON テンプレートのスナップショット更新ConfigRepositoryTests: opacity の0…1クランプ、corner radius の0下限クランプ、パススルーSpectrumBarRectsTests:autoCornerRadius(thickness:)、cornerRadiusの nil→自動 / 明示 /0→角なし / 厚み半分クランプ / 負値フロアmake lintクリーン備考
bar_opacity既定1.0+bar_corner_radius既定 = 従来の自動式と同一)。2つのノブはどちらも opt-in。Closes #300
Summary by CodeRabbit
New Features
[spectrum]tuning keys for bar appearance:bar_opacityandbar_corner_radius.Bug Fixes
bar_opacityto 0…1 and ensuringbar_corner_radiusis non-negative.Documentation
Tests