add accent color and surface preferences to settings

This commit is contained in:
2026-10-08 08:56:57 +07:00
parent f4b435b160
commit 02b9cc238f
4 changed files with 254 additions and 70 deletions
+28
View File
@@ -318,6 +318,34 @@ impl AppSettings {
self.apply_theme(Some(window), cx);
}
/// Set the accent color override and re-resolve the theme
pub fn apply_accent(
&mut self,
selection: AccentSelection,
window: &mut Window,
cx: &mut Context<Self>,
) {
self.inner.update(cx, |this, cx| {
this.accent_selection = selection;
cx.notify();
});
self.apply_theme(Some(window), cx);
}
/// Set the surface treatment preference
pub fn apply_surface(
&mut self,
preference: SurfacePreference,
window: &mut Window,
cx: &mut Context<Self>,
) {
self.inner.update(cx, |this, cx| {
this.surface_preference = preference;
cx.notify();
});
self.apply_theme(Some(window), cx);
}
/// Apply theme
pub fn apply_theme(&mut self, window: Option<&mut Window>, cx: &mut Context<Self>) {
let (selection, accent, surface, appearance) = {