feat: add user-configurable theme settings

This commit is contained in:
2026-10-24 09:15:12 +07:00
parent 30da985ac1
commit 8f35ae92b7
10 changed files with 397 additions and 171 deletions
+36 -2
View File
@@ -1,4 +1,5 @@
use gpui::{App, Div, IntoElement, ParentElement, SharedString, Styled, div};
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::{ActiveTheme, h_flex, v_flex};
/// A settings row: the label and description on the left, the control on the right.
@@ -9,14 +10,15 @@ pub fn settings_row(
cx: &App,
) -> Div {
h_flex()
.gap_3()
.w_full()
.gap_4()
.items_center()
.justify_between()
.child(
v_flex()
.flex_1()
.min_w_0()
.child(div().text_sm().child(label.into()))
.child(div().text_sm().font_semibold().child(label.into()))
.child(
div()
.text_xs()
@@ -24,5 +26,37 @@ pub fn settings_row(
.child(description.into()),
),
)
.child(
h_flex()
.w_40()
.flex_shrink_0()
.justify_end()
.items_center()
.child(control),
)
}
/// A full-width settings block with the label and description in one header.
pub fn settings_block(
label: impl Into<SharedString>,
description: impl Into<SharedString>,
control: impl IntoElement,
cx: &App,
) -> impl IntoElement {
v_flex()
.w_full()
.gap_3()
.child(
v_flex()
.w_full()
.child(div().text_sm().font_semibold().child(label.into()))
.child(
div()
.text_xs()
.text_color(cx.theme().muted_foreground)
.truncate()
.child(description.into()),
),
)
.child(control)
}