feat: use system theme
This commit is contained in:
@@ -7,9 +7,9 @@ resolver = "2"
|
||||
coop = { path = "crates/*" }
|
||||
|
||||
# UI
|
||||
gpui = { git = "https://github.com/huacnlee/zed.git", branch = "export-platform-window" }
|
||||
components = { package = "ui", git = "https://github.com/longbridgeapp/gpui-component" }
|
||||
reqwest_client = { git = "https://github.com/huacnlee/zed.git", branch = "export-platform-window" }
|
||||
gpui = { git = "https://github.com/zed-industries/zed" }
|
||||
reqwest_client = { git = "https://github.com/zed-industries/zed" }
|
||||
components = { package = "ui", git = "https://github.com/lumehq/gpui-component" }
|
||||
|
||||
# Nostr
|
||||
nostr-relay-builder = { git = "https://github.com/rust-nostr/nostr" }
|
||||
|
||||
@@ -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