feat: use system theme
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
use asset::Assets;
|
||||
use client::NostrClient;
|
||||
use components::theme::{Theme, ThemeColor, ThemeMode};
|
||||
use constants::{APP_NAME, KEYRING_SERVICE};
|
||||
use gpui::*;
|
||||
use keyring::Entry;
|
||||
@@ -34,13 +33,7 @@ async fn main() {
|
||||
// Initialize components
|
||||
components::init(cx);
|
||||
|
||||
// Set custom theme
|
||||
let mut theme = Theme::from(ThemeColor::dark());
|
||||
// Set dark mode by default
|
||||
theme.mode = ThemeMode::Dark;
|
||||
|
||||
// Set app state
|
||||
cx.set_global(theme);
|
||||
// Set global state
|
||||
cx.set_global(nostr);
|
||||
cx.set_global(app_state);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use components::theme::ActiveTheme;
|
||||
use components::theme::{ActiveTheme, Theme};
|
||||
use gpui::*;
|
||||
|
||||
use super::{chat_space::ChatSpace, onboarding::Onboarding};
|
||||
@@ -11,8 +11,15 @@ pub struct AppView {
|
||||
|
||||
impl AppView {
|
||||
pub fn new(cx: &mut ViewContext<'_, Self>) -> AppView {
|
||||
// Sync theme with system
|
||||
cx.observe_window_appearance(|_, cx| {
|
||||
Theme::sync_system_appearance(cx);
|
||||
})
|
||||
.detach();
|
||||
|
||||
// Onboarding
|
||||
let onboarding = cx.new_view(Onboarding::new);
|
||||
|
||||
// Chat Space
|
||||
let chat_space = cx.new_view(ChatSpace::new);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user