add accent color and surface preferences to settings
This commit is contained in:
@@ -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) = {
|
||||
|
||||
Reference in New Issue
Block a user