Apply theme to chat messages

Nathan Sobo and Max Brunsfeld created

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>

Change summary

zed/assets/themes/_base.toml |  3 +++
zed/src/chat_panel.rs        | 17 +++++++----------
zed/src/theme.rs             | 12 ++++++++++++
3 files changed, 22 insertions(+), 10 deletions(-)

Detailed changes

zed/assets/themes/_base.toml 🔗

@@ -22,6 +22,9 @@ color = "$text.2"
 [workspace.active_sidebar_icon]
 color = "$text.0"
 
+[chat_panel.message]
+text = "$text.0"
+
 [selector]
 background = "$surface.2"
 text = "$text.0"

zed/src/chat_panel.rs 🔗

@@ -116,16 +116,13 @@ impl ChatPanel {
 
     fn render_message(&self, message: &ChannelMessage) -> ElementBox {
         let settings = self.settings.borrow();
-        Flex::column()
-            .with_child(
-                Label::new(
-                    message.body.clone(),
-                    settings.ui_font_family,
-                    settings.ui_font_size,
-                )
-                .boxed(),
-            )
-            .boxed()
+        Label::new(
+            message.body.clone(),
+            settings.ui_font_family,
+            settings.ui_font_size,
+        )
+        .with_style(&settings.theme.chat_panel.message.label)
+        .boxed()
     }
 
     fn render_input_box(&self) -> ElementBox {

zed/src/theme.rs 🔗

@@ -20,6 +20,7 @@ pub struct Theme {
     #[serde(default)]
     pub name: String,
     pub workspace: Workspace,
+    pub chat_panel: ChatPanel,
     pub selector: Selector,
     pub editor: Editor,
     #[serde(deserialize_with = "deserialize_syntax_theme")]
@@ -52,6 +53,17 @@ pub struct SidebarIcon {
     pub color: Color,
 }
 
+#[derive(Debug, Default, Deserialize)]
+pub struct ChatPanel {
+    pub message: ChatMessage,
+}
+
+#[derive(Debug, Default, Deserialize)]
+pub struct ChatMessage {
+    #[serde(flatten)]
+    pub label: LabelStyle,
+}
+
 #[derive(Debug, Default, Deserialize)]
 pub struct Selector {
     #[serde(flatten)]