ltk/widget/list_item/
theme.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// SPDX-License-Identifier: LGPL-2.1-only
// Copyright (C) 2026 Liberux Labs, S. L. <info@liberux.net>

use crate::types::Color;
pub fn label_color()    -> Color { crate::theme::palette().text_primary }
pub fn subtitle_color() -> Color { crate::theme::palette().text_secondary }
pub fn trailing_color() -> Color { crate::theme::palette().text_secondary }
/// Alpha-only overlay tuned for the active mode (white on dark, navy on light).
pub fn hover_bg() -> Color
{
	let p = crate::theme::palette();
	Color { r: p.text_primary.r, g: p.text_primary.g, b: p.text_primary.b, a: 0.06 }
}
pub fn press_bg() -> Color
{
	let p = crate::theme::palette();
	Color { r: p.text_primary.r, g: p.text_primary.g, b: p.text_primary.b, a: 0.12 }
}
/// Solid dark surface for the [`ListItem::selected`](super::ListItem::selected) state.
/// `palette.text_primary` happens to be the right colour for both
/// modes (navy on light, white on dark) so the white-on-dark contrast
/// pattern flips into a navy-on-white contrast in dark mode without
/// needing a separate slot.
pub fn selected_bg() -> Color { crate::theme::palette().text_primary }
pub fn focus_color() -> Color { crate::theme::palette().accent }
pub const LABEL_SIZE:    f32 = 16.0;
pub const SUBTITLE_SIZE: f32 = 13.0;
pub const TRAILING_SIZE: f32 = 14.0;
pub const HEIGHT:        f32 = 56.0;
pub const HEIGHT_SUB:    f32 = 68.0;
pub const PAD_H:         f32 = 16.0;
pub const RADIUS:        f32 = 12.0;
pub const FOCUS_W:       f32 = 2.0;
/// Visible side of the optional leading icon (square).
pub const ICON_SIZE:     f32 = 24.0;
/// Gap between the leading icon's right edge and the label baseline.
pub const ICON_GAP:      f32 = 12.0;