主题令牌 Theme
DearOreUI 组件库的主题令牌系统,对齐原版 OreUI 的
menus-theme-*.css/gameplay-theme-*.css设计变量。组件渲染器消费这些令牌,观感与原版一致。
颜色令牌
对齐原版 --colors*(menus-theme :root):
| 令牌 | 默认值 | 说明 |
|---|---|---|
colorPrimary | #3c8527 | 主色(绿色) |
colorSecondary | #d0d1d4 | 次色 |
colorDestructive | #ca3636 | 危险色(红色) |
colorText | #ffffff | 文本色 |
colorMuted | #b1b2b5 | 弱化文本色 |
colorDisabled | #d0d1d4 | 禁用色 |
colorPanel | rgba(0,0,0,0.72) | 面板背景 |
字体令牌
对齐原版 --fonts*:
| 令牌 | 默认值 | 用途 |
|---|---|---|
fontHeading | Minecraft Ten v2 | 标题 |
fontSubheading | Minecraft Five v2 | 副标题 |
fontUi | Minecraft Seven v2 | UI 文本 |
fontBody | Noto Sans | 正文 |
字号刻度
对齐原版 --fontSizes0..7:
| 索引 | 名称 | 像素 |
|---|---|---|
| 0 | Tiny | 10px |
| 1 | Small | 14px |
| 2 | Medium | 16px |
| 3 | Large | 20px |
| 4 | XLarge | 24px |
| 5 | Heading | 32px |
| 6 | Display | 48px |
| 7 | Giant | 64px |
间距 / 行高 / 字距
| 刻度 | 值 |
|---|---|
行高 lineHeights[0..5] | 20 / 24 / 28 / 40 / 60 / 80 px |
字距 letterSpacings[0..1] | 4 / 8 px |
间距 spaces[0..7] | 4 / 8 / 12 / 16 / 20 / 24 / 32 / 64 px |
纹理覆盖表
ThemeTokens::textures 是语义纹理键(<family>.<variant>.<state>)到 TextureSpec 的覆盖表。默认为空:渲染器回退到 VanillaAssets::texture(key) 查找原版纹理。
// Mod 覆盖某个纹理(设计 3.5)
ThemeTokens theme = defaultThemeTokens();
theme.textures["pressable.primary.default"] = TextureSpec{...};渲染链路
ThemeTokens(颜色 / 字体 / 字号 / 纹理覆盖)
│ ComponentRenderer 消费
▼
border-image: url(<resolved>) <slice>; ← 9-slice 纹理
border-width: <width>; border-image-outset: <outset>;
▼
cohtml::View::ExecuteScript → 真实 OreUI 页面渲染