| @@ -34,6 +34,21 @@ pub fn default_theme() -> Theme { |
| 34 | title: Stylable::with_modifiers(StyleModifier::BOLD), |
34 | title: Stylable::with_modifiers(StyleModifier::BOLD), |
| 35 | ..Default::default() |
35 | ..Default::default() |
| 36 | }, |
36 | }, |
| |
37 | completion: ThemeCompletion { |
| |
38 | default: Stylable { |
| |
39 | color: Some(Color::Reset), |
| |
40 | background: Some(Color::Reset), |
| |
41 | modifiers: vec![ |
| |
42 | ModifierChange::Remove(StyleModifier::all()), |
| |
43 | ModifierChange::Insert(StyleModifier::REVERSED), |
| |
44 | ], |
| |
45 | }, |
| |
46 | selected: Stylable { |
| |
47 | color: Some(Color::Yellow), |
| |
48 | background: Some(Color::Black), |
| |
49 | modifiers: vec![ModifierChange::Remove(StyleModifier::REVERSED)], |
| |
50 | }, |
| |
51 | }, |
| 37 | timeline: ThemeTimeline { |
52 | timeline: ThemeTimeline { |
| 38 | date: Stylable::with_modifiers(StyleModifier::BOLD), |
53 | date: Stylable::with_modifiers(StyleModifier::BOLD), |
| 39 | unread_marker: Stylable::with_modifiers(StyleModifier::DIM), |
54 | unread_marker: Stylable::with_modifiers(StyleModifier::DIM), |
| @@ -241,6 +256,10 @@ pub struct Theme { |
| 241 | /// Configuration for styling windows. |
256 | /// Configuration for styling windows. |
| 242 | #[serde(default)] |
257 | #[serde(default)] |
| 243 | windows: ThemeWindows, |
258 | windows: ThemeWindows, |
| |
259 | |
| |
260 | /// Configuration for the completion menu. |
| |
261 | #[serde(default)] |
| |
262 | completion: ThemeCompletion, |
| 244 | } |
263 | } |
| 245 | |
264 | |
| 246 | impl Theme { |
265 | impl Theme { |
| @@ -256,6 +275,7 @@ impl Theme { |
| 256 | rooms: self.rooms.merge(other.rooms), |
275 | rooms: self.rooms.merge(other.rooms), |
| 257 | users: self.users.merge(other.users), |
276 | users: self.users.merge(other.users), |
| 258 | windows: self.windows.merge(other.windows), |
277 | windows: self.windows.merge(other.windows), |
| |
278 | completion: self.completion.merge(other.completion), |
| 259 | } |
279 | } |
| 260 | } |
280 | } |
| 261 | |
281 | |
| @@ -273,6 +293,7 @@ impl Theme { |
| 273 | tabs: self.tabs.values(base), |
293 | tabs: self.tabs.values(base), |
| 274 | users: self.users.values(base), |
294 | users: self.users.values(base), |
| 275 | windows: self.windows.values(base), |
295 | windows: self.windows.values(base), |
| |
296 | completion: self.completion.values(base), |
| 276 | } |
297 | } |
| 277 | } |
298 | } |
| 278 | } |
299 | } |
| @@ -308,6 +329,9 @@ pub struct ThemeValues { |
| 308 | |
329 | |
| 309 | /// Styling for rendering windows. |
330 | /// Styling for rendering windows. |
| 310 | pub windows: ThemeWindowsValues, |
331 | pub windows: ThemeWindowsValues, |
| |
332 | |
| |
333 | /// Styling for the completion menu. |
| |
334 | pub completion: ThemeCompletionValues, |
| 311 | } |
335 | } |
| 312 | |
336 | |
| 313 | #[derive(Clone, Debug, Default, Deserialize)] |
337 | #[derive(Clone, Debug, Default, Deserialize)] |
| @@ -644,6 +668,37 @@ pub struct ThemeTimelineValues { |
| 644 | pub unread_marker: Style, |
668 | pub unread_marker: Style, |
| 645 | } |
669 | } |
| 646 | |
670 | |
| |
671 | #[derive(Clone, Debug, Default, Deserialize)] |
| |
672 | struct ThemeCompletion { |
| |
673 | #[serde(default)] |
| |
674 | default: Stylable, |
| |
675 | |
| |
676 | #[serde(default)] |
| |
677 | selected: Stylable, |
| |
678 | } |
| |
679 | |
| |
680 | impl ThemeCompletion { |
| |
681 | fn merge(self, other: Self) -> Self { |
| |
682 | Self { |
| |
683 | default: self.default.merge(other.default), |
| |
684 | selected: self.selected.merge(other.selected), |
| |
685 | } |
| |
686 | } |
| |
687 | |
| |
688 | fn values(self, base: Style) -> ThemeCompletionValues { |
| |
689 | let default = base.patch(self.default); |
| |
690 | let selected = default.patch(self.selected); |
| |
691 | |
| |
692 | ThemeCompletionValues { default, selected } |
| |
693 | } |
| |
694 | } |
| |
695 | |
| |
696 | #[derive(Clone, Debug, Default)] |
| |
697 | pub struct ThemeCompletionValues { |
| |
698 | pub default: Style, |
| |
699 | pub selected: Style, |
| |
700 | } |
| |
701 | |
| 647 | #[derive(Clone, Debug, Default, Deserialize)] |
702 | #[derive(Clone, Debug, Default, Deserialize)] |
| 648 | struct ThemeWindows { |
703 | struct ThemeWindows { |
| 649 | #[serde(default)] |
704 | #[serde(default)] |