Repository navigation
Adaptive theme from cover art - #439
Conversation
📝 WalkthroughWalkthroughThe PR adds adaptive cover-art theming. It extracts album palettes, derives and fades accent colors, preserves user themes, adds a configuration setting, and integrates palette updates with cover-art loading and animation ticks. ChangesAdaptive cover-art theme flow
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant fetch_cover_art
participant App
participant ThemeTransition
fetch_cover_art->>App: store_cover_art(image, palette)
App->>ThemeTransition: create transition to derived theme
App->>ThemeTransition: advance on tick
ThemeTransition-->>App: current interpolated theme
App-->>App: restore user theme when palette or setting is cleared
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/tui/runner.rs (1)
1101-1113: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winGate all cover-art draw sites with
do_draw_cover_art. The playbar applies this gate, butdraw_cover_art_contentand the plugindraw_cover_artrender cached artwork based only onavailable(). Theme-only fetching can therefore display artwork whendraw_cover_artis disabled or image support is unavailable.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/tui/runner.rs` around lines 1101 - 1113, Update draw_cover_art_content and the plugin draw_cover_art paths to require do_draw_cover_art before rendering cached artwork. Apply the same gate used by the playbar, alongside the existing available() and image-support checks, so disabled cover-art drawing never displays artwork.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/tui/runner.rs`:
- Around line 1101-1113: Update draw_cover_art_content and the plugin
draw_cover_art paths to require do_draw_cover_art before rendering cached
artwork. Apply the same gate used by the playbar, alongside the existing
available() and image-support checks, so disabled cover-art drawing never
displays artwork.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: f1d62f3e-229e-4b41-956e-938ac7db3c9e
📒 Files selected for processing (7)
src/core/app.rssrc/core/cover_theme.rssrc/core/migrations.rssrc/core/mod.rssrc/core/user_config.rssrc/infra/network/playback.rssrc/tui/runner.rs
Summary
Adds an Adaptive Theme option (Settings > Theme, off by default): UI accent colors are derived from the current track's cover art and fade in on track change, fading back to the user's own theme when art clears. Text, background, borders, and error colors stay untouched so legibility never depends on the art.
core/cover_thememodule (cfgcover-art): dominant-color extraction from the decoded cover (scored 4-bit color bins, saturation and mid-brightness weighted), theme derivation with a legibility clamp against the base background, and a time-based fade driven fromupdate_on_tick.App::store_cover_art/App::clear_cover_artkeep the palette paired with the art at one chokepoint.custom_theme, and a save from another category keeps the base theme intact.UserConfig::needs_cover_art, so theming works with the art pane hidden (disabled or no terminal image support). Color-space math reusescsscolorparser(via the existingcolorgraddep) instead of hand-rolled conversions, and the fade sharesease_in_out_cubicwith the lyrics animation.Testing
Ran:
Still to run before merge (test binaries with
cover-artcannot run from the agent harness):cargo runbuildAdditional notes
migrations.rson non-Unix,runner.rswithoutlocal-files) that only surface in feature/platform combos CI does not build.user_config.themein place, the same fieldScriptEffect::SetThemewrites, so a Lua theme write during a fade gets overwritten. A resolution-pointApp::theme()would fix this but touches every theme read site, so it is left for a separate PR.Summary by CodeRabbit