Fix illegible text on light pywal palettes + hot-reload
All checks were successful
Mirror to GitHub / mirror (push) Successful in 3s
All checks were successful
Mirror to GitHub / mirror (push) Successful in 3s
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). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
35e0481314
commit
1671439f90
5 changed files with 27 additions and 39 deletions
3
Cargo.lock
generated
3
Cargo.lock
generated
|
|
@ -305,9 +305,10 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bread-theme"
|
||||
version = "0.2.3"
|
||||
source = "git+https://github.com/Breadway/bread-ecosystem?tag=v0.2.6#0c8c5c00e435fedff4f81e36d603424c153519a9"
|
||||
source = "git+https://github.com/Breadway/bread-ecosystem?tag=v0.2.7#ea87083c0615fc9141b0ae4c99f833748a0189d1"
|
||||
dependencies = [
|
||||
"dirs 5.0.1",
|
||||
"gtk4",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -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: >k4::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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ authors.workspace = true
|
|||
|
||||
|
||||
[dependencies]
|
||||
bread-theme = { git = "https://github.com/Breadway/bread-ecosystem", tag = "v0.2.6" }
|
||||
bread-theme = { git = "https://github.com/Breadway/bread-ecosystem", tag = "v0.2.7", features = ["gtk"] }
|
||||
anyhow.workspace = true
|
||||
tracing.workspace = true
|
||||
serde.workspace = true
|
||||
|
|
|
|||
|
|
@ -1,5 +1,18 @@
|
|||
pub use bread_theme::{load_palette, Palette};
|
||||
|
||||
/// Apply breadpad/breadman's stylesheet and keep it live across palette changes.
|
||||
/// [`build_css`] bundles the shared component sheet with the app's own rules from
|
||||
/// the current pywal palette; `bread_theme::gtk::apply_app_css` re-runs this
|
||||
/// whenever `bread-theme reload` rewrites the shared theme file, so the UI
|
||||
/// recolours in place (and re-reads the user's `style.css` override too).
|
||||
pub fn apply_live() {
|
||||
bread_theme::gtk::apply_app_css(|| {
|
||||
let palette = load_palette();
|
||||
let user_css = std::fs::read_to_string(crate::config::style_css_path()).ok();
|
||||
build_css(&palette, user_css.as_deref())
|
||||
});
|
||||
}
|
||||
|
||||
/// Generate the full breadpad/breadman CSS string. The base — `@define-color`
|
||||
/// palette, fonts, and generic widget styling — comes from the shared
|
||||
/// `bread_theme::stylesheet`, so breadpad and breadman look identical to the
|
||||
|
|
@ -32,7 +45,7 @@ window { border-radius: 8px; }
|
|||
|
||||
.type-chip {
|
||||
background: @overlay;
|
||||
color: @fg;
|
||||
color: @on-overlay;
|
||||
border-radius: 999px;
|
||||
padding: 4px 12px;
|
||||
font-size: 12px;
|
||||
|
|
@ -41,12 +54,12 @@ window { border-radius: 8px; }
|
|||
|
||||
.type-chip.active {
|
||||
background: @blue;
|
||||
color: @bg;
|
||||
color: @on-accent;
|
||||
}
|
||||
|
||||
.confirm-button {
|
||||
background: @blue;
|
||||
color: @bg;
|
||||
color: @on-accent;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
padding: 8px 16px;
|
||||
|
|
@ -90,7 +103,7 @@ window { border-radius: 8px; }
|
|||
|
||||
.sidebar-row:selected {
|
||||
background: @blue;
|
||||
color: @bg;
|
||||
color: @on-accent;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,9 @@ use anyhow::Result;
|
|||
use breadpad_shared::{
|
||||
calendar::CalDavClient,
|
||||
classifier::Classifier,
|
||||
config::{style_css_path, Config},
|
||||
config::Config,
|
||||
scheduler::Scheduler,
|
||||
store::Store,
|
||||
theme::{build_css, load_palette},
|
||||
types::{Note, NoteType},
|
||||
};
|
||||
use gtk4::{glib, prelude::*};
|
||||
|
|
@ -765,19 +764,7 @@ fn save_note_classified(
|
|||
}
|
||||
|
||||
fn apply_css(_cfg: &Config) {
|
||||
let palette = load_palette();
|
||||
let user_css = std::fs::read_to_string(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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue