ltk/widget/text_edit/
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
38
39
40
41
42
43
// SPDX-License-Identifier: LGPL-2.1-only
// Copyright (C) 2026 Liberux Labs, S. L. <info@liberux.net>

use crate::types::Color;

pub fn bg()           -> Color { crate::theme::palette().surface_alt }
pub fn border()       -> Color { crate::theme::palette().divider }
pub fn text()         -> Color { crate::theme::palette().text_primary }
pub fn placeholder()  -> Color { crate::theme::palette().text_secondary }
pub fn focus_border() -> Color { crate::theme::palette().text_primary }
pub fn cursor()       -> Color { crate::theme::palette().text_primary }
/// Selection highlight — accent colour at low opacity so the text
/// underneath stays readable.
pub fn selection() -> Color
{
	let a = crate::theme::palette().accent;
	Color::rgba( a.r, a.g, a.b, 0.35 )
}

pub const BORDER_W:       f32 = 1.5;
pub const FOCUS_BORDER_W: f32 = 2.0;
pub const HEIGHT:         f32 = 48.0;
pub const RADIUS:         f32 = 100.0;
pub const FONT_SIZE:      f32 = 16.0;
pub const PAD_H:          f32 = 20.0;
/// Vertical padding inside multiline boxes — the single-line variant
/// centres the text vertically in `HEIGHT`, so it doesn't need this.
pub const PAD_V_MULTI:    f32 = 12.0;
/// Line height multiplier on top of [`FONT_SIZE`] when laying out
/// multiline content. 1.4 leaves enough room above and below each
/// line that adjacent rows do not visually crowd each other.
pub const LINE_H_MULT:    f32 = 1.4;
/// Default visible row count for a [`super::TextEdit`] in multiline mode.
pub const ROWS_DEFAULT:   u32 = 5;
/// Corner radius applied to multiline boxes — the pill shape used by
/// the single-line variant looks wrong at multi-row heights.
pub const RADIUS_MULTI:   f32 = 12.0;
/// Side length, in logical pixels, of the
/// [`super::TextEdit::password_toggle`] eye icon.
pub const PASSWORD_TOGGLE_SIZE: f32 = 20.0;
/// Extra horizontal slop on each side of the eye icon's hit zone
/// to make the toggle finger-friendly even on touch panels.
pub const PASSWORD_TOGGLE_SLOP: f32 = 4.0;