Fix illegible text on light pywal palettes + hot-reload

Use bread-theme 0.2.7's luminance-picked ink (@on-*): type chips on @overlay and
selected sidebar rows / confirm buttons on @blue kept @fg or @bg, which vanished
when those slots came out light/dark. They now use @on-overlay / @on-accent.

Add breadpad_shared::theme::apply_live (wraps bread_theme::gtk::apply_app_css) so
breadpad and breadman recolour live on `bread-theme reload` and re-read the user's
style.css — replacing the build-once provider. bread-theme bumped to v0.2.7
(gtk feature).
This commit is contained in:
Breadway 2026-06-17 12:42:12 +08:00
parent dfe19708ba
commit c30aa2497e
5 changed files with 27 additions and 39 deletions

View file

@ -4,7 +4,6 @@ use breadpad_shared::{
parser::parse_rule_based,
scheduler::Scheduler,
store::Store,
theme::{build_css, load_palette},
types::{Note, NoteType, RecurrenceRule},
};
use chrono::Local;
@ -924,19 +923,7 @@ fn show_add_note_window(parent: &gtk4::ApplicationWindow, state: AppState) {
// ── CSS ───────────────────────────────────────────────────────────────────────
fn apply_css(_cfg: &Config) {
let palette = load_palette();
let user_css = std::fs::read_to_string(breadpad_shared::config::style_css_path()).ok();
let css = build_css(&palette, user_css.as_deref());
let provider = gtk4::CssProvider::new();
provider.load_from_string(&css);
let Some(display) = gtk4::gdk::Display::default() else {
tracing::warn!("no default display; skipping CSS provider");
return;
};
gtk4::style_context_add_provider_for_display(
&display,
&provider,
gtk4::STYLE_PROVIDER_PRIORITY_APPLICATION,
);
// Hot-reloads on `bread-theme reload` (recolours to the new pywal palette
// and re-reads the user's style.css). See breadpad_shared::theme::apply_live.
breadpad_shared::theme::apply_live();
}