Files
Unlucky-Launcher/crates/app/ui/components/label.slint
T
AskaEth bc41dfcf7d
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
Guards / core 零 UI 守门 (push) Canceled after 0s
Guards / 文件行数 ≤400 守门 (push) Canceled after 0s
Guards / 依赖许可与来源(cargo-deny) (push) Canceled after 0s
Unlucky Launcher v0.0.1-alpha
Rust 原生单文件 Minecraft 启动器:CLI 完整可用(install/launch/accounts/java/diagnose/agent),
MCP server 接入外部 Agent 工具,GUI 开发中。
2026-10-31 21:54:10 +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;
}