R8.1: document content keeps the file's colours in a dark app

Pages, cells, slides and PDF pages paint as the file says in any
appearance; only the chrome around them follows dark mode. The
kernel keeps Ely's one light scheme, sent once a view, and MuPDF
no longer inverts. Reviews now run gpt-6.1-sol at xhigh.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude committed 2026-10-18 19:42:13 -04:00
1 parent d4cb274749
commit 6f1eebb4b5
42 files changed
+204 -209

No files matched your search

+4 -4
View File
@@ -100,12 +100,12 @@ impl Host for Deck {
view.turn_parts();
});
}
// Pictures follow the kernel's light or dark scheme.
let dark = view.read(cx).dark();
// Pictures before the scheme landed are repainted.
let lit = view.read(cx).lit();
if let Some(tab) = self.tab_mut(id)
&& tab.extra.dark != dark
&& tab.extra.lit != lit
{
tab.extra.dark = dark;
tab.extra.lit = lit;
self.repaint_all(id, cx);
}
self.offer_menu(id, view, cx);
+2 -2
View File
@@ -50,8 +50,8 @@ pub struct Extra {
pub painting: bool,
/// The parts are masters.
pub masters: bool,
/// The scheme the pictures were painted with.
pub dark: Option<bool>,
/// The pictures were painted with Ely's scheme.
pub lit: bool,
/// The view was fitted to the slide once.
pub fitted: bool,
}
+1 -1
View File
@@ -267,7 +267,7 @@ impl Deck {
let range = output.pages();
let (w, h) = tab.extra.size;
let size = (PICTURE, (f64::from(PICTURE) * h as f64 / w.max(1) as f64).round() as u32);
let (copy, light) = (tab.work.join("output.odp"), ely_lok::scheme(false));
let (copy, light) = (tab.work.join("output.odp"), ely_lok::SCHEME);
let (shown, opened) = (folder.display().to_string(), folder.clone());
log::info!("show: writes slide pictures");
self.read_in(
+2 -2
View File
@@ -252,7 +252,7 @@ impl Deck {
// A show starts from black; effects play on the page.
let behind = match &preview.playing {
Playing::Transition { .. } => gpui::black(),
Playing::Effects { .. } => ely_lok::paper(cx),
Playing::Effects { .. } => ely_lok::paper(),
};
let content = match &preview.playing {
Playing::Effects {
@@ -266,7 +266,7 @@ impl Deck {
} else {
(t / preview.length) as f32
};
let paper = ely_lok::paper(cx);
let paper = ely_lok::paper();
// Exits are not read; the old slide shows everything.
let from = (from.as_deref())
.map(|from| compose::slide(from, |_| true, frame, paper).into_any_element());
+1 -1
View File
@@ -159,7 +159,7 @@ impl Render for Presenter {
let big = stage::fit(show.slide, (room.width * 0.6, room.height * 0.8));
let small = stage::fit(show.slide, (room.width * 0.3, room.height * 0.35));
let next = match show.upcoming() {
Some(part) => stage::still(show, part, small, cx),
Some(part) => stage::still(show, part, small),
None => div().w(small.0).h(small.1).into_any_element(),
};
let notes = show.part().map(|part| show.slides[part].notes.clone());
+3 -3
View File
@@ -27,7 +27,7 @@ pub fn stage(show: &Show, (w, h): (Pixels, Pixels), cx: &App) -> AnyElement {
let Some(stack) = show.stack(part) else {
return black((w, h));
};
let paper = ely_lok::paper(cx);
let paper = ely_lok::paper();
let t = show.entered.elapsed().as_secs_f64();
let slide = &show.slides[part];
let shown = match &show.leaving {
@@ -76,9 +76,9 @@ pub fn stage(show: &Show, (w, h): (Pixels, Pixels), cx: &App) -> AnyElement {
}
/// A slide as it first shows, still.
pub fn still(show: &Show, part: usize, size: (Pixels, Pixels), cx: &App) -> AnyElement {
pub fn still(show: &Show, part: usize, size: (Pixels, Pixels)) -> AnyElement {
match show.stack(part) {
Some(stack) => compose::slide(stack, |visible| visible, size, ely_lok::paper(cx))
Some(stack) => compose::slide(stack, |visible| visible, size, ely_lok::paper())
.into_any_element(),
None => black(size),
}
+4 -7
View File
@@ -59,16 +59,14 @@ pub fn discard(worker: Arc<Mutex<Worker>>, doc: Doc, copy: PathBuf, cx: &App) {
fn copy(
worker: &mut Worker,
doc: &Doc,
(copy, scheme): (&std::path::Path, Option<&'static str>),
copy: &std::path::Path,
) -> io::Result<(usize, Doc, Vec<ShowSlide>)> {
let current = doc.sheets(worker)?.current;
let url = ely_lok::file_url(copy);
doc.save_as(worker, &url, "odp")?;
let shown = worker.load(&url)?;
let read = |worker: &mut Worker| -> io::Result<Vec<ShowSlide>> {
if let Some(scheme) = scheme {
worker.run(&shown, "view.theme", &[scheme])?;
}
worker.run(&shown, "view.theme", &[ely_lok::SCHEME])?;
ely_lok::show::slide_show(&worker.values(&shown, ely_lok::show::SLIDE_SHOW)?)
};
match read(worker) {
@@ -161,14 +159,13 @@ impl Deck {
self.show_starting = false;
return;
};
let scheme = tab.view.read(cx).dark().map(ely_lok::scheme);
let path = tab.work.join(format!("show-{}.odp", self.shows));
self.shows += 1;
let into = path.clone();
let worker = self.core.worker.clone();
self.read_in(
id,
move |worker, doc| copy(worker, doc, (&into, scheme)),
move |worker, doc| copy(worker, doc, &into),
move |deck, read, _, cx| {
deck.show_starting = false;
let (current, doc, slides) = match read {
@@ -382,7 +379,7 @@ mod tests {
let deck = deck.read(app);
let tab = deck.active_tab().expect("a tab");
let mut worker = deck.core.worker.lock().expect("the worker lock");
let (_, doc, slides) = super::copy(&mut worker, &tab.doc, (&path, None)).expect("a copy");
let (_, doc, slides) = super::copy(&mut worker, &tab.doc, &path).expect("a copy");
super::Starting { tab: tab.id, slides, first: 0, doc, copy: path.clone(), audience: 99, presenter: false }
});
update(&mut cx, &deck, |deck, cx| {