pub struct ChatWidgetStyle {Show 21 fields
pub background: Color,
pub border: Border,
pub header_background: Color,
pub user_background: Color,
pub assistant_background: Color,
pub tool_background: Color,
pub error_background: Color,
pub text: TextStyle,
pub muted: TextStyle,
pub role_text: TextStyle,
pub input: TextInputStyle,
pub radius: Radius,
pub header_radius: f32,
pub message_radius: f32,
pub inline_button_radius: f32,
pub padding: f32,
pub gap: f32,
pub message_gap: f32,
pub height: f32,
pub width: f32,
pub compact: bool,
}Expand description
Colors, typography, radii, spacing, and preferred size of a ChatWidget.
Numeric geometry is expressed in logical pixels. Self::from_theme uses a
520 x 260 preferred size, 8-pixel outer padding/gap, a 6-pixel message gap,
and non-compact rendering.
§Examples
use ailloli_ui_widgets::controls::ChatWidgetStyle;
let style = ChatWidgetStyle::default();
assert_eq!((style.width, style.height), (520.0, 260.0));
assert!(!style.compact);Fields§
§background: ColorRoot background color.
border: BorderRoot border widths and colors.
header_background: ColorHeader and inline-action background color.
user_background: ColorBackground used for user messages.
assistant_background: ColorBackground used for assistant messages.
tool_background: ColorBackground used for system and tool messages.
error_background: ColorBackground used for error-kind or failed messages.
text: TextStyleMessage-body and header text style.
muted: TextStyleEmpty-state and inline-action text style.
role_text: TextStyleMessage role, kind, and status text style.
input: TextInputStyleComposer input and container style.
radius: RadiusRoot corner radii in logical pixels.
header_radius: f32Header corner radius in logical pixels.
message_radius: f32Message-bubble corner radius in logical pixels.
Composer and inline-action corner radius in logical pixels.
padding: f32Root inner padding in logical pixels.
gap: f32Vertical gap between header, transcript, and composer in logical pixels.
message_gap: f32Vertical gap between message bubbles in logical pixels.
height: f32Preferred widget height in logical pixels.
width: f32Preferred widget width in logical pixels.
compact: boolWhether compact header, bubble padding, and density are rendered.
Implementations§
Source§impl ChatWidgetStyle
impl ChatWidgetStyle
Sourcepub fn from_theme(theme: Theme) -> Self
pub fn from_theme(theme: Theme) -> Self
Creates the default chat style from theme.
Palette-derived text and border colors coexist with deliberately dark fixed transcript surfaces. No dimension is scaled or validated.
§Examples
use ailloli_ui_core::Theme;
use ailloli_ui_widgets::controls::ChatWidgetStyle;
let style = ChatWidgetStyle::from_theme(Theme::default());
assert_eq!(style.padding, 8.0);
assert_eq!(style.message_gap, 6.0);Sourcepub fn compact(self) -> Self
pub fn compact(self) -> Self
Applies the predefined compact density and preferred height.
This sets compact, padding, both gaps, and height, while preserving the
width and all colors. By contrast, ChatWidget::compact changes only
the rendering flag on an already configured widget style.
§Examples
use ailloli_ui_widgets::controls::ChatWidgetStyle;
let style = ChatWidgetStyle::default().compact();
assert_eq!((style.padding, style.gap, style.message_gap), (6.0, 6.0, 4.0));
assert_eq!((style.width, style.height, style.compact), (520.0, 190.0, true));Trait Implementations§
Source§impl Clone for ChatWidgetStyle
impl Clone for ChatWidgetStyle
Source§fn clone(&self) -> ChatWidgetStyle
fn clone(&self) -> ChatWidgetStyle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ChatWidgetStyle
impl Debug for ChatWidgetStyle
Auto Trait Implementations§
impl Freeze for ChatWidgetStyle
impl RefUnwindSafe for ChatWidgetStyle
impl Send for ChatWidgetStyle
impl Sync for ChatWidgetStyle
impl Unpin for ChatWidgetStyle
impl UnwindSafe for ChatWidgetStyle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.