Review everything shipped this weekend, and fix what the reviewers caught
Claude-Session: https://claude.ai/code/session_01Ms2FbjQy31TVf3CEvQhGM8
This commit is contained in:
@@ -45,11 +45,17 @@ Singleton {
|
||||
|
||||
// The remembered theme for a scheme, falling back to the catalog default.
|
||||
function themeForScheme(target: string): string {
|
||||
const key = target === "light" ? "themeLight" : "themeDark";
|
||||
const fallback = target === "light" ? ThemeCatalog.defaultLight : ThemeCatalog.defaultDark;
|
||||
const scheme = target === "light" ? "light" : "dark";
|
||||
const key = scheme === "light" ? "themeLight" : "themeDark";
|
||||
const fallback = scheme === "light" ? ThemeCatalog.defaultLight : ThemeCatalog.defaultDark;
|
||||
const stored = String(DesktopPreferences.get(key) || "");
|
||||
return ThemeProfileModel.findProfile(root.customProfiles, stored, root.shippedThemes)
|
||||
? stored : fallback;
|
||||
const profile = ThemeProfileModel.findProfile(
|
||||
root.customProfiles, stored, root.shippedThemes);
|
||||
// Existing is not enough: the slot has to hold a theme OF that scheme.
|
||||
// A custom theme edited from dark to light stayed in the dark slot, so
|
||||
// asking for dark selected a light theme, which flipped the scheme back
|
||||
// to light -- the light/dark toggle simply stopped working.
|
||||
return profile && profile.scheme === scheme ? stored : fallback;
|
||||
}
|
||||
|
||||
function commitActive(profile: var): bool {
|
||||
@@ -64,7 +70,11 @@ Singleton {
|
||||
profile.scheme === "light" ? "themeLight" : "themeDark", profile.id);
|
||||
SystemSettings.commitPreference("accentName",
|
||||
ThemeProfileModel.nearestCuratedName(profile.scheme, profile.accent));
|
||||
root.applyProfileEffects(profile);
|
||||
// Effects are the theme's own snapshot of blur, shadow and motion.
|
||||
// Restoring them for a theme that did not actually become active left
|
||||
// the desktop wearing half of a theme nobody selected.
|
||||
if (schemeAccepted && profileAccepted)
|
||||
root.applyProfileEffects(profile);
|
||||
return schemeAccepted && profileAccepted;
|
||||
}
|
||||
|
||||
@@ -126,6 +136,11 @@ Singleton {
|
||||
|
||||
// The editor's saturation slider. factor 1.0 is neutral.
|
||||
function setSaturation(factor: real): bool {
|
||||
// NaN survives the model's clamp and comes back out as a palette of
|
||||
// unreadable tokens. Reject it here, where there is still a caller to
|
||||
// tell about it.
|
||||
if (!isFinite(factor))
|
||||
return false;
|
||||
const palette = ThemeProfileModel.resaturatePalette(root.activePalette, factor);
|
||||
if (!palette)
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user