forge
Explore
Log in

Don't you dare go Hollow

Switched-on toggles draw in your own hue

Browse files at this commit

aa7ff93078c6fe03ab9869800d21fb3918a2e9feAhmet Kaan GümüşParent: c991329
  • feat
    • switched-on toggles draw in your own hue
Show full message
✨ feat: switched-on toggles draw in your own hue
crates/client/src/gui.rsmodified+1 -0
@@ -656,6 +656,7 @@ impl Yumush {
656656 self.request_user_avatar(&user, cx);
657657 self.chat.muted = mutes::load(user.id);
658658 style::remember(&[&user]);
659+ style::remember_me(user.id);
659660 self.user = Some(user);
660661 self.change_page(Route::Chat, window, cx);
661662 self.load_communities(window, cx);
crates/client/src/gui/parts.rsmodified+1 -1
@@ -148,7 +148,7 @@ pub fn toggle(
148148 flip: impl Fn(&mut Window, &mut App) + 'static,
149149 ) -> Stateful<Div> {
150150 let (bar, knob, left) = if on {
151- (t.hue(common::model::Hue::Amber), t.paper(), 20.)
151+ (t.hue(super::style::my_hue()), t.paper(), 20.)
152152 } else {
153153 (t.faint(), t.faint(), 0.)
154154 };
crates/client/src/gui/style.rsmodified+9 -0
@@ -113,6 +113,15 @@ thread_local! {
113113 static CHOSEN: RefCell<HashMap<Id, Hue>> = RefCell::default();
114114 static AVATAR: RefCell<HashMap<Id, Id>> = RefCell::default();
115115 static PICTURED: RefCell<HashMap<Id, Hue>> = RefCell::default();
116+ static ME: std::cell::Cell<Option<Id>> = const { std::cell::Cell::new(None) };
117+}
118+
119+pub fn remember_me(id: Id) {
120+ ME.set(Some(id));
121+}
122+
123+pub fn my_hue() -> Hue {
124+ ME.get().map(hue_of).unwrap_or(Hue::Amber)
116125 }
117126
118127 pub fn remember(users: &[&User]) {