Files
Unlucky-Launcher/crates/app/ui/components/label.slint
T
AskaEth 8a8e5ca0c0
CI / runtime smoke (macos arm64, probe) (push) Skipped
CI / fmt (rustfmt --check) (push) Canceled after 0s
CI / clippy (ubuntu-latest) (push) Canceled after 0s
CI / clippy (windows-latest) (push) Canceled after 0s
CI / test (ubuntu-latest) (push) Canceled after 0s
CI / test (windows-latest) (push) Canceled after 0s
CI / build release (ubuntu-latest) (push) Canceled after 0s
CI / build release (windows-latest) (push) Canceled after 0s
CI / runtime smoke (ubuntu x64, xvfb) (push) Canceled after 0s
Guards / core 零 UI 守门 (push) Canceled after 0s
Guards / presenter 零 UI 守门 (push) Canceled after 0s
Guards / design 零第三方依赖守门 (push) Canceled after 0s
Guards / unsafe 落点守门(集合必须恰好一个文件) (push) Canceled after 0s
Guards / 文件行数 ≤400 守门 (push) Canceled after 0s
Guards / 依赖许可与来源(cargo-deny) (push) Canceled after 0s
Unlucky Launcher v0.2.0
首个 iced + Material 3 Expressive 版本的源码快照。
完整历史与日常提交在 dev 分支;main 只放阶段性快照。
2026-11-05 14:22:11 +08:00

35 lines
1.2 KiB
Plaintext

// 排版角色封装:所有文字都走 UiText,不在页面里散落 font-size/font-family 字面量。
// 角色 → 字号/字重/默认前景色由 tokens.slint 的 ramp 决定;外部赋值可覆盖(例如强调色标题)。
import { Theme } from "../theme/tokens.slint";
export enum TextRole {
display,
title,
subtitle,
body,
bodyStrong,
caption,
mono,
monoSmall,
}
export component UiText inherits Text {
in property <TextRole> role: TextRole.body;
color: role == TextRole.caption ? Theme.fg-secondary : Theme.fg-primary;
font-family: (role == TextRole.mono || role == TextRole.monoSmall)
? Theme.font-family-mono
: Theme.font-family;
font-size: (role == TextRole.display) ? Theme.font-size-display
: (role == TextRole.title) ? Theme.font-size-title
: (role == TextRole.subtitle) ? Theme.font-size-subtitle
: (role == TextRole.caption || role == TextRole.monoSmall) ? Theme.font-size-caption
: Theme.font-size-body;
font-weight: (role == TextRole.bodyStrong || role == TextRole.title || role == TextRole.display)
? 600
: 400;
vertical-alignment: center;
wrap: no-wrap;
overflow: elide;
}