UI Toolbox 徽标UI Toolbox
支持

本页为译文。技术支持和视频教程主要使用英语,内容以英文页面为准。 英文版

主题变量

窗口和控件的外观来自 USS 变量。主题是设置这些变量的样式表。 所有样式都用 USS 完成。C# 只添加和移除类,不设置颜色。

规则

  1. Themes/dark.uss 是主题契约。它定义每一个 --tb-* 变量。
  2. 主题只覆盖 --tb-* 变量。
  3. WindowStyles.uss 只使用 --tb-* 变量。
  4. 选择器使用规范的 tb-* 类。它们不使用元素名称。

变量契约

所有变量都定义在 Assets/UIToolbox/Runtime/Resources/UIToolbox/Themes/dark.uss 的 :root 上。下面的值是深色(默认)值。

调色板

变量 深色值 用途
--tb-color-background #1e1e1e 工作区背景。
--tb-color-surface #2b2b2b 窗口和内容背景。
--tb-color-surface-alt #333333 标题栏、按钮、标签栏。
--tb-color-surface-hover #3d3d3d 悬停状态。
--tb-color-border #454545 边框。
--tb-color-text #e6e6e6 文字。
--tb-color-text-muted #b3b3b3 次要文字(tb-text-muted)。
--tb-color-text-disabled #7a7a7a 禁用的文字。
--tb-color-placeholder #909090 占位文字和搜索图标。
--tb-color-field The background 文本框的背景。仅当皮肤需要与背景不同的文本框时才设置。
--tb-color-accent #0e639c 有焦点窗口的边框和标题栏、活动标签。
--tb-color-accent-text #ffffff 强调色上的文字。
--tb-color-danger #c42b1c 关闭按钮悬停、错误外框。
--tb-color-danger-text #ffffff 危险色上的文字。
--tb-color-text-danger #ee9087 表面上的危险色文字:破坏性的菜单项、错误消息、必填标记。在主题表面上达到 4.5:1,而深色主题中的 --tb-color-danger 达不到。更改表面的皮肤设置自己的值。
--tb-color-success #3fbf77 成功通知的色条。
--tb-color-warning #e89821 警告通知的色条。
--tb-color-overlay rgba(0, 0, 0, 0.5) 对话框、消息框和其他模态覆盖层后方的暗色覆盖层。
--tb-color-drop-target rgba(255, 153, 0, 0.8) 放置目标的高亮。
--tb-color-dock-target rgba(76, 255, 76, 0.8) 停靠区的高亮。
--tb-color-preview rgba(77, 153, 255, 0.2) 吸附和拆分预览的填充。
--tb-color-preview-border rgba(77, 153, 255, 0.9) 吸附和拆分预览的边框。
--tb-color-glass-frost rgba(255, 255, 255, 0.01) 所有玻璃的磨砂:盖在模糊之上的色调。它在每个主题中都接近透明,所以模糊会显示后方的内容。设置它可给主题的玻璃着色。线性色彩空间的项目会把较小的 alpha 混合得比看起来更亮,所以要得到清透的玻璃,请保持在 0.03 以下。
--tb-color-glass var(--tb-color-glass-frost) 玻璃窗口(GlassWindowTemplate)盖在其模糊之上的色调。
--tb-color-glass-dialog var(--tb-color-glass-frost) 玻璃消息框或对话框(Glass)的色调。
--tb-color-glass-border rgba(255, 255, 255, 0.24) 玻璃窗口、消息框或对话框的边框。
--tb-color-glass-rim rgba(255, 255, 255, 0.55) GlassPanel 顶部的亮边。
--tb-color-glass-lift rgba(255, 255, 255, 0.08) 玻璃窗口的标题栏、悬停标签和标签栏上的亮层,以及玻璃消息框或对话框标题上的亮层。
--tb-color-glass-lift-strong rgba(255, 255, 255, 0.18) 有焦点的标题栏和活动标签的同一亮层。
--tb-color-glass-dark rgba(10, 12, 16, 0.45) Tint 设为 Dark 的 GlassPanel 的烟色玻璃。
--tb-color-glass-accent rgba(70, 140, 255, 0.22) Tint 设为 Accent 的 GlassPanel 的色调。
--tb-color-glass-accent-rim rgba(190, 220, 255, 0.6) Accent 面板的顶边。
--tb-color-glass-plate rgba(20, 24, 34, 0.6) 必须在明亮场景上也能读清的 HUD 面板(UnitFrame)的衬底。它是衬板,不是玻璃:浅色主题设置浅色衬板。
--tb-color-glass-text-shadow rgba(0, 0, 0, 0.6) 玻璃窗口、消息框和对话框上文字的阴影,使它在繁杂的模糊上也能读清。浅色主题设置浅色阴影。
--tb-color-hud-outline rgba(0, 0, 0, 0.8) HUD 控件(WorldMarkerLayer、CompassBar、FloatingTextLayer)文字的描边。

图表颜色

PieChart、Graph、SankeyChart、Timeline 和 Treemap 按顺序,把下面这些颜色中的下一个给没有自己颜色的系列、扇区、节点、轨道或项目。light 和 toolbox-light 主题为 2、3、6、7 和 8 设置更深的值,使每种颜色在它们的浅色背景上保持 3:1 的对比度。PieChart.Palette 保存深色值,样式表没有设置变量时作为后备。

变量 深色值 用途
--tb-chart-1 #3b82c4 第一个系列(蓝色)。
--tb-chart-2 #f28c33 第二个系列(橙色)。
--tb-chart-3 #2ea16e 第三个系列(绿色)。
--tb-chart-4 #d6424d 第四个系列(红色)。
--tb-chart-5 #8c5cb8 第五个系列(紫色)。
--tb-chart-6 #f2c740 第六个系列(黄色)。
--tb-chart-7 #40b3c7 第七个系列(青色)。
--tb-chart-8 #999999 第八个系列(灰色)。
--tb-chart-text #ffffff 绘制在图表颜色上的标签:PieChart 扇区、Treemap 方块和 Timeline 项目。

要只更改某一个图表的颜色,请在它上面设置 --tb-chart-color-1 到 --tb-chart-color-8:

.sales-chart {
    --tb-chart-color-1: #1b9e77;
    --tb-chart-color-2: #d95f02;
}

物品颜色

ItemSlot 和 InventoryGrid 用物品稀有度的颜色绘制物品的边框,异形的 InventoryGrid 会标出被持有物品覆盖的单元格。

变量 深色值 用途
--tb-rarity-common rgb(157, 157, 157) Common 物品的边框(tb-item-slot--common)。
--tb-rarity-uncommon rgb(30, 200, 60) Uncommon 物品的边框。
--tb-rarity-rare rgb(0, 112, 221) Rare 物品的边框。
--tb-rarity-epic rgb(163, 53, 238) Epic 物品的边框。
--tb-rarity-legendary rgb(255, 128, 0) Legendary 物品的边框。
--tb-color-fits rgba(30, 200, 60, 0.35) 被持有物品覆盖、且有空间的单元格(tb-inventory-grid__cell--fits)。
--tb-color-blocked rgba(220, 50, 50, 0.35) 被持有物品覆盖、但没有空间的单元格(tb-inventory-grid__cell--blocked)。

间距、圆角、字体、边框、尺寸

变量 深色值
--tb-spacing-xs 2px
--tb-spacing-sm 4px
--tb-spacing-md 8px
--tb-spacing-lg 16px
--tb-radius-sm 3px
--tb-radius-md 6px
--tb-font-size-xs 9px
--tb-font-size-sm 11px
--tb-font-size 13px
--tb-font-size-lg 15px
--tb-border-width 1px
--tb-border-width-thick 2px
--tb-size-title-bar 26px
--tb-size-button 20px

动画

变量 深色值
--tb-animation-duration-fast 150ms
--tb-animation-duration-normal 300ms
--tb-animation-duration-slow 450ms
--tb-animation-easing-entrance ease-out
--tb-animation-easing-exit ease-in
--tb-animation-easing-default ease-out

光标

每个变量保存 url("...") x y:光标纹理及其热点。默认值指向 Resources/UIToolbox/Cursors/default。见光标。

变量 使用者
--tb-cursor-arrow 禁用的按钮
--tb-cursor-link 按钮、标签、菜单项
--tb-cursor-text 文本字段
--tb-cursor-resize-h、--tb-cursor-resize-v 窗口边缘、分隔条
--tb-cursor-resize-nwse、--tb-cursor-resize-nesw 窗口角
--tb-cursor-grab 抽屉手柄、滑块手柄
--tb-cursor-move、--tb-cursor-busy、--tb-cursor-not-allowed 你自己的规则

窗口最小化后的高度,是其标题栏测得的高度。如果你更改 --tb-size-title-bar,最小化的窗口会随之变化。