theme
分层
只有 api/stable/ui_theme.txt 列出的符号受兼容性承诺约束。标有「实验性」的符号,以及类型下「实验性成员」列出的字段,任何 0.x 版本都可能有不兼容变化(docs/release.md「API 稳定性」)。
import "github.com/tangoui/tango/ui/theme"本页由
site/tools/apigen从源码注释生成(按 darwin 构建标签选文件),请勿手改。
Package theme defines the design tokens of the Tango self-drawn UI.
Three token sets are provided: AntDesign (default, Ant Design v5 / Pro), ElementPlus and Shadcn (shadcn/ui, with its base colors, radius and brand color options). All expose the same Theme struct so every component reads a single vocabulary. Visual recipes that differ between the systems (focus rings, input halos, button weight and padding, switch geometry, popup borders, card shadows, line heights) are tokens too; Flavor is left for the few structural differences. Semantic colors are derived from one base color with each system's own algorithm (see palette.go, shadcn.go), and every constructor accepts Dark() to build the dark variant.
API tiers: only the symbols listed in api/stable/ui_theme.txt are covered by the compatibility promise of docs/release.md ("API 稳定性"); every other exported symbol is Experimental and may change in any 0.x release. The API reference on the documentation site marks the experimental symbols.
常量
const (
StyleAnt = Ant
StyleElement = Element
)Style aliases name the three design systems uniformly (th.Flavor == theme.StyleShadcn reads like th.Style).
const CSSPrefix = "--tango-"CSSPrefix starts the name of every variable returned by CSSVars.
const Instant = time.NanosecondInstant is a zero-length duration for duration tokens.
实验性
变量
var (
// ZeroPx is a zero length (negative zero; it draws like 0 and resolves
// to 0).
ZeroPx = float32(math.Copysign(0, -1))
// Transparent is an invisible color distinct from the zero Color.
Transparent = Color{R: 255, G: 255, B: 255, A: 0}
// NoShadow removes a shadow (a non-nil empty slice; nil inherits).
NoShadow = []paint.Shadow{}
)Sentinels for "explicitly zero" in overrides (a plain zero inherits).
实验性 ZeroPx、NoShadow
var ShadcnBases = []string{"neutral", "zinc", "slate", "stone", "gray", "mauve", "olive", "mist", "taupe"}ShadcnBases lists the base colors Shadcn accepts. The first five keep their order; "slate" and "gray" are the legacy v3 bases.
实验性
var ShadcnColors = append([]string(nil), shadcnColorNames...)ShadcnColors lists the shadcn/ui v4 color themes ShadcnOptions.Color accepts.
实验性
函数
func AntIcons 实验性
func AntIcons() *icon.StyleAntIcons is the Ant Design icon style: @ant-design/icons Outlined icons (Filled where the built-in icon is filled).
func CSSRule
func CSSRule(selector string, vars map[string]string) stringCSSRule formats vars as one CSS rule for selector, one declaration per line sorted by name, so the output is stable:
:root {
--tango-color-primary: #1677ff;
...
}
func ContrastRatio
func ContrastRatio(fg, bg Color) float64ContrastRatio returns the WCAG contrast ratio (1..21) of fg drawn on bg. A translucent fg is composited over bg first; a translucent bg is composited over white (light themes) — pass an opaque bg for dark ones.
func ContrastReport 实验性
func ContrastReport(themes ...*Theme) stringContrastReport formats the checks of several themes grouped by status: failures, design defaults, exempt pairs, then passing pairs, after a summary line.
func ElementIcons 实验性
func ElementIcons() *icon.StyleElementIcons is the Element Plus icon style (@element-plus/icons).
func HSBAString
func HSBAString(name string, h HSVA) stringHSBAString formats h like HSBString; name is "hsb" or "hsv". Use it to keep the hue of greys, which a Color cannot carry.
func HSBString
func HSBString(c Color) stringHSBString formats c as "hsb(h, s%, b%)" (hue in whole degrees, saturation and brightness in whole percent), or "hsba(h, s%, b%, a)" with alpha rounded to two decimals when it is not opaque. HSB is the same color space as HSV; HSVString spells it "hsv(...)".
func HSVString
func HSVString(c Color) stringHSVString is HSBString with the "hsv(...)" / "hsva(...)" spelling.
func HexString
func HexString(c Color) stringHexString formats c as #rrggbb (or #rrggbbaa when not opaque), lower case; use strings.ToUpper for the #RRGGBB display form.
func LucideIcons 实验性
func LucideIcons() *icon.StyleLucideIcons is the shadcn/ui icon style: Lucide icons, and 2-unit strokes for the built-in icons Lucide has no counterpart for.
func Luma
func Luma(c Color) float64Luma is the perceived brightness of c in [0,1] (Rec. 601 weights, alpha ignored); above ~0.75 a dark mark reads better on it than a white one.
func RGBString
func RGBString(c Color) stringRGBString formats c as CSS "rgb(r, g, b)", or "rgba(r, g, b, a)" with alpha rounded to two decimals when it is not opaque.
func RelativeLuminance
func RelativeLuminance(c Color) float64RelativeLuminance is the WCAG relative luminance of an opaque color.
类型
AlertToken 实验性
type AlertToken struct {
Alias
SuccessBg Color
SuccessBorderColor Color // zero: none
SuccessIconColor Color
InfoBg Color
InfoBorderColor Color
InfoIconColor Color
WarningBg Color
WarningBorderColor Color
WarningIconColor Color
ErrorBg Color
ErrorBorderColor Color
ErrorIconColor Color
TitleColor Color `contrast:"text:InfoBg"` // zero: the status icon color (Element)
DescriptionColor Color `contrast:"text:InfoBg"` // zero: the status icon color (Element)
TitleFontSize float32 // with a description
TitleFontWeight int // with a description (zero: regular)
DescriptionFontSize float32
DefaultPaddingBlock float32
DefaultPaddingInline float32
WithDescriptionPaddingBlock float32
WithDescriptionPaddingInline float32
IconSize float32
WithDescriptionIconSize float32
IconMarginInlineEnd float32
WithDescriptionIconMarginEnd float32
TitleMarginBottom float32 // title to description
Radius float32
// WithDescriptionIconCenter centers the big icon vertically next to
// title and description (Element: el-alert is align-items: center);
// false keeps it at the top (antd).
WithDescriptionIconCenter bool
// CloseColor and CloseHoverColor color the close icon (antd
// colorIcon / colorIconHover); CloseIconSize is its size and
// CloseFontSize the size of a CloseText.
CloseColor Color
CloseHoverColor Color
CloseIconSize float32
CloseFontSize float32
// Dark effect (Element effect="dark"): the box is filled with the
// status color and text and icon are drawn in DarkTextColor (through
// Theme.TextOn, so a light fill gets dark text).
SuccessDarkBg Color
InfoDarkBg Color
WarningDarkBg Color
ErrorDarkBg Color
DarkTextColor Color
}AlertToken styles Alert. Ant and Element tint the box with the status palette; shadcn draws a bordered card with a status-colored icon.
Alias
type Alias struct {
ColorPrimary Color `ref:"color-primary"`
ColorError Color `ref:"color-error"`
ColorText Color `ref:"color-text"`
ColorBorder Color `ref:"color-border"`
ColorBgContainer Color `ref:"color-bg-container"`
BorderRadius float32 `ref:"radius"`
BorderRadiusSM float32 `ref:"radius-sm"`
BorderRadiusLG float32 `ref:"radius-lg"`
ControlHeight float32 `ref:"control-height"`
ControlHeightSM float32 `ref:"control-height-sm"`
ControlHeightLG float32 `ref:"control-height-lg"`
FontSize float32 `ref:"font-size"`
FontSizeSM float32 `ref:"font-size-sm"`
FontSizeLG float32 `ref:"font-size-lg"`
LineWidth float32 `ref:"line-width"`
}Alias is the subset of global tokens a component may override for itself (Ant: a component token overriding an alias token). Resolved tokens carry the effective values. The ref tags name the global CSS variable the field mirrors (CSSOptions.Ref).
AnchorToken 实验性
type AnchorToken struct {
Alias
LinkPaddingBlock float32 // a link is 22px plus this above and below
LinkPaddingBlockNested float32 // the same for nested links
LinkPaddingInlineStart float32 // also the indent per nesting level
LinkColor Color `contrast:"text:@Page"`
LinkHoverColor Color `contrast:"text:@Page"`
LinkActiveColor Color `contrast:"text:@Page"`
RailColor Color // track along the start edge (horizontal: the bottom line)
RailWidth float32
ShowRail bool // draw the rail by default (Element type "default" has none)
InkBarColor Color `contrast:"nontext:@Page"` // marker of the active link
InkWidth float32 // vertical marker thickness (zero: RailWidth)
InkHeight float32 // vertical marker length (zero: the link's title height)
InkRadius float32 // clamped to half the marker width
PaddingBlock float32 // above and below the vertical list
HorizontalGap float32 // between links of a horizontal anchor
Bounds float32 // a section is active once its top is this close to the line
ScrollDuration time.Duration
}AnchorToken styles Anchor.
AvatarToken 实验性
type AvatarToken struct {
Alias
ContainerSize float32
ContainerSizeSM float32
ContainerSizeLG float32
TextFontSize float32
TextFontSizeSM float32
TextFontSizeLG float32
IconFontSize float32 // icon avatar glyph size
IconFontSizeSM float32
IconFontSizeLG float32
Radius float32 // square avatar corner radius
RadiusSM float32
RadiusLG float32
// TextAutoScale shrinks text wider than the avatar minus the gap
// (antd gap); el-avatar does not scale its text.
TextAutoScale bool
GroupSpace float32
GroupOverlapping float32
GroupBorderColor Color
Bg Color
Color Color `contrast:"text:Bg"`
}AvatarToken styles Avatar.
BadgeToken 实验性
type BadgeToken struct {
Alias
IndicatorHeight float32 // count bubble
IndicatorHeightSM float32
IndicatorPaddingInline float32 // count bubble side padding (multi-character)
IndicatorPaddingInlineSM float32
DotSize float32
TextFontSize float32
TextFontSizeSM float32
TextFontWeight int // zero: regular
CountBg Color // bubble of a badge without Color
TextColor Color `contrast:"text:CountBg"`
RingColor Color // 1px ring separating the bubble from the content
StatusSize float32
StatusDefaultColor Color // Status("default") dot
StatusTextColor Color `contrast:"text:@Page"`
RibbonBg Color // ribbon without a color
RibbonColor Color `contrast:"text:RibbonBg"`
RibbonHeight float32
RibbonRadius float32
RibbonFontSize float32
}BadgeToken styles Badge and Badge.Ribbon.
BreadcrumbToken 实验性
type BreadcrumbToken struct {
Alias
IconFontSize float32 // item icons and icon separators
ItemColor Color `contrast:"text:@Page"` // links before the current page
LastItemColor Color `contrast:"text:@Page"` // the current page
LinkHoverColor Color `contrast:"text:LinkHoverBg"`
LinkHoverBg Color // zero: none
LinkFontWeight int // links before the current page (zero: regular)
LinkPaddingInline float32 // inline padding of a link (its hover background)
ItemHeight float32 // link height (zero: the line height)
ItemGap float32 // gap between items and separators
SeparatorColor Color
SeparatorMargin float32 // inline margin of a text separator
IconSeparatorMargin float32 // inline margin of an icon separator
Radius float32 // link hover background
}BreadcrumbToken styles Breadcrumb.
ButtonToken 实验性
type ButtonToken struct {
Alias
FontWeight int // label weight
PaddingInline float32 // horizontal padding, middle size
PaddingInlineSM float32
PaddingInlineLG float32
ContentFontSize float32 // label size, middle (small and large use the Alias FontSizeSM / FontSizeLG)
ContentFontSizeSM, ContentFontSizeLG float32 // nonzero overrides for those sizes
RadiusSM, RadiusLG float32 // positive overrides for those sizes
DefaultBg Color // default / outline button fill
DefaultColor Color `contrast:"text:DefaultBg"`
DefaultBorderColor Color
DefaultHoverBg Color
DefaultHoverColor Color `contrast:"text:DefaultHoverBg"`
DefaultHoverBorderColor Color
SecondaryBg Color // "secondary" variant fill
SecondaryColor Color `contrast:"text:SecondaryBg"`
SecondaryHoverBg Color
PrimaryColor Color `contrast:"text:@Primary"` // label on the primary fill
DangerBg Color // solid danger fill
DangerColor Color `contrast:"text:DangerBg"` // label on the solid danger fill
TextHoverBg Color // text (ghost) button under the pointer
LinkHoverBg Color // link button under the pointer (zero: none)
DefaultShadow []paint.Shadow
PrimaryShadow []paint.Shadow
DangerShadow []paint.Shadow
// Color "default" with the solid appearance (Ant color="default"
// variant="solid"): a dark fill in light themes, a light one in dark.
DefaultSolidBg Color
DefaultSolidHoverBg Color
DefaultSolidActiveBg Color
DefaultSolidColor Color `contrast:"text:DefaultSolidBg"`
// PresetTextContrast is the minimum contrast of a label drawn in a
// preset color (yellow, lime, gold …) against what is behind it; paler
// labels are deepened towards the text color (0: keep the preset).
PresetTextContrast float32
// GroupDividerOpacity is the opacity of the label color for the seam
// between two solid buttons of a ButtonGroup.
GroupDividerOpacity float32
// AutoInsertSpace is the default of Button.AutoInsertSpace: a space
// between the two characters of a two-Chinese-character label (Ant
// ConfigProvider button.autoInsertSpace defaults to true; Element
// auto-insert-space to false; shadcn has none). Being a bool, false
// cannot be set through Components overrides (a zero field inherits):
// turn it off for a scope with ConfigProvider
// Defaults("Button", Props{"autoInsertSpace": false}), or per button
// with ButtonW.AutoInsertSpace(false). Precedence: the method, then
// Defaults, then this token.
AutoInsertSpace bool
}ButtonToken styles Button.
CSSOptions
type CSSOptions struct {
// Components adds one variable per component token,
// --tango-<component>-<token> in kebab case (--tango-button-padding-inline,
// --tango-button-color-primary for the Alias, --tango-table-header-bg); a
// css:"name" tag on a field replaces the <token> part.
Components bool
// OnlyChanged keeps only the component variables whose value differs
// from the theme built without component overrides (empty when there are
// none), instead of several hundred.
OnlyChanged bool
// Ref writes var(--tango-…) for a component token that equals the
// global variable named by its ref tag (the Alias fields), so a page
// changing the global variable cascades to the component.
Ref bool
}CSSOptions selects what CSSVarsWith exports besides the CSSVars set.
CalendarToken 实验性
type CalendarToken struct {
Alias
FullBg Color
MiniBorderColor Color // outline of the card calendar
MiniRadius float32
HeaderBorderColor Color // divider under the card / Element header
FullCellHeight float32
MiniCellHeight float32
YearControlWidth float32 // year select of the full calendar header
YearControlWidthSM float32 // … of the card
MonthControlWidth float32
MonthControlWidthSM float32
// Full calendar cells.
ItemColor Color `contrast:"text:FullBg"`
ItemOutColor Color // days of adjacent months
ItemActiveBg Color // selected day / month
ItemActiveColor Color `contrast:"text:ItemActiveBg"` // selected day and today, their top line
ItemHoverBg Color
ItemDisabledBg Color
ItemBorderColor Color // top line of a cell (Element: grid lines)
// Card calendar days and months.
DayRadius float32
DayActiveBg Color
DayActiveColor Color `contrast:"text:DayActiveBg"`
DayHoverBg Color
DayTodayBorder Color `contrast:"nontext:FullBg"` // drawn unless DayTodayBg is set
DayTodayBg Color // zero: none
DayOutColor Color // zero: ItemOutColor
// Week numbers (Calendar.ShowWeek).
WeekColumnWidth float32
WeekNumberColor Color `contrast:"text:FullBg"`
}CalendarToken styles Calendar (the full-page grid and the card).
CardToken 实验性
type CardToken struct {
Alias
Bg Color
HeaderBg Color // zero: none
InnerHeaderBg Color // header band of an inner card (zero: none)
HeaderColor Color `contrast:"text:Bg"`
HeaderFontSize float32
HeaderFontSizeSM float32
HeaderFontWeight int // zero: regular
HeaderHeight float32 // minimum header height (zero: none)
HeaderHeightSM float32
HeaderPaddingBlock float32
HeaderPaddingBlockSM float32
HeaderPaddingInline float32
HeaderPaddingInlineSM float32
BodyPadding float32
BodyPaddingSM float32
InnerBodyPaddingBlock float32 // body block padding of an inner card (inline stays BodyPadding)
ActionsBg Color
BorderColor Color // outline and dividers
Radius float32
Shadow []paint.Shadow // "always" shadow (also a borderless Ant card)
HoverShadow []paint.Shadow // hoverable card under the pointer
HoverBorderColor Color // outline of a hoverable card under the pointer (zero: hidden)
// ShadowAlways is the default shadow mode: true "always" (Element
// el-card shadow="always", shadcn shadow-sm), false "never" (Ant,
// where only a borderless card keeps Shadow).
ShadowAlways bool
// Pro v3 Card/style.js uses independent header/body padding; small
// header uses paddingXS (8), body paddingSM (12), not antd Card padding.
ProHeaderPaddingBlock, ProHeaderPaddingInline float32
ProHeaderPaddingBlockSM, ProHeaderPaddingInlineSM float32
ProBodyPaddingBlock, ProBodyPaddingBlockSM float32
ProHoverShadow []paint.Shadow
ProHoverBorderColor Color // zero: transparent at full hover
}CardToken styles Card.
CarouselToken 实验性
type CarouselToken struct {
Alias
DotWidth float32
DotActiveWidth float32
DotHeight float32
DotRadius float32
DotGap float32
DotColor Color // on the slides
DotHoverColor Color
DotActiveColor Color
DotOutsideColor Color // DotPosition("outside"), on the page
// DotRingColor outlines the dots drawn on the slides, so the light
// dots stay visible on light slides (zero: none).
DotRingColor Color
DotOutsideActiveColor Color `contrast:"nontext:@Page"`
ArrowSize float32
ArrowBg Color // zero: none
ArrowHoverBg Color
ArrowColor Color
ArrowHoverColor Color
ArrowDisabledOpacity float32 // Loop(false): arrow at the first / last slide
Radius float32 // frame corners (not in card mode)
CardMaskColor Color // dims the side cards of Card mode
// ArrowOffset is the distance from the frame edge to an arrow
// (negative: outside the frame, as shadcn's -left-12).
ArrowOffset float32
// ArrowIconInset is the padding between an arrow's box and its icon.
ArrowIconInset float32
// DotHoverTrigger makes hovering an indicator select its slide by
// default (Element trigger="hover"); Carousel.Trigger overrides it.
DotHoverTrigger bool
}CarouselToken styles Carousel.
CascaderToken 实验性
type CascaderToken struct {
Alias
OptionHeight float32
OptionPadding float32 // inline start padding of an option
ColumnWidth float32 // minimum column width
DropdownHeight float32 // column height
OptionColor Color `contrast:"text:@Elevated"`
OptionHoverBg Color
OptionSelectedBg Color // option on the expanded path / selected leaf (zero: none)
OptionSelectedColor Color `contrast:"text:OptionSelectedBg"`
OptionSelectedFontWeight int
ColumnDividerColor Color
ExpandIconColor Color `contrast:"nontext:@Elevated"` // arrow towards the next column
}CascaderToken styles the Cascader menu columns (the trigger and the search result list follow Select).
ChatToken 实验性
type ChatToken struct {
Alias
// Bubble.
BubbleRadius float32
BubblePaddingBlock float32
BubblePaddingInl float32
BubbleMaxWidth float32 // fraction of the row a filled bubble may take (0..1)
BubbleGap float32 // avatar to bubble
AvatarSize float32
UserBg Color // filled user bubble
UserColor Color `contrast:"text:UserBg"`
AssistantBg Color // filled assistant bubble (Variant BubbleFilled)
AssistantColor Color `contrast:"text:AssistantBg"`
OutlinedBorder Color // Variant BubbleOutlined
ShadowBubble []paint.Shadow
NameColor Color `contrast:"text:@Page"` // sender name above a bubble
MetaColor Color `contrast:"text:@Page"` // footer text (time, model)
SystemBg Color // system notice pill (zero: none)
SystemColor Color `contrast:"text:SystemBg"`
CaretColor Color // typing caret at the end of a streaming bubble
DotColor Color // loading dots
AssistantAvatarBg Color
AssistantAvatarFg Color `contrast:"nontext:AssistantAvatarBg"`
ActionColor Color `contrast:"nontext:@Page"` // copy / retry / edit icons
ScrollButtonBg Color // "back to bottom" button of BubbleList
ScrollButtonBorder Color // zero: none
ScrollButtonShadow []paint.Shadow
// Sender.
SenderBg Color
SenderBorder Color
SenderFocusBorder Color
SenderRadius float32
SenderPadding float32
SenderShadow []paint.Shadow // zero: none
SendSize float32 // send / stop button
AttachmentBg Color
AttachmentBorder Color // zero: none
AttachmentRadius float32
AttachmentThumb float32 // image attachment thumbnail size
// ThoughtChain / ToolCall.
CardBg Color
CardBorder Color
CardRadius float32
CardHeaderHover Color
CodeBg Color // arguments / result blocks
LineColor Color // rail between the steps of a chain
StepTitleColor Color `contrast:"text:@Page"`
StepDescColor Color `contrast:"text:@Page"`
DurationColor Color `contrast:"text:@Page"`
PendingColor Color `contrast:"nontext:@Page"` // icon of a step that has not started
// Approval.
ApprovalBg Color
ApprovalBorder Color
ApprovalIcon Color `contrast:"nontext:ApprovalBg"`
DangerBg Color // risk "error"
DangerBorder Color
DangerIcon Color `contrast:"nontext:DangerBg"`
// Conversations.
ConvItemHeight float32
ConvItemRadius float32
ConvHoverBg Color
ConvActiveBg Color
ConvActiveColor Color `contrast:"text:ConvActiveBg"`
ConvGroupColor Color `contrast:"text:@Page"`
// Prompts.
PromptBg Color
PromptBorder Color // zero: none
PromptHoverBg Color
PromptRadius float32
PromptIconColor Color `contrast:"nontext:PromptBg"`
PromptDescColor Color `contrast:"text:PromptBg"`
}ChatToken styles the AI chat components: Bubble, BubbleList, Sender, ThoughtChain, ToolCall, Approval, Conversations and Prompts.
CheckboxToken 实验性
type CheckboxToken struct {
Alias
ControlInteractiveSize float32 // box size
Radius float32 // box corner radius
Bg Color // unchecked box fill
BorderColor Color `contrast:"nontext:@Page"`
CheckedBg Color `contrast:"nontext:@Page"`
CheckedHoverBg Color
CheckColor Color `contrast:"nontext:CheckedBg"` // the check mark
LabelFontWeight int
Shadow []paint.Shadow // unchecked box shadow (shadcn shadow-xs)
// ControlInteractiveSizeSM is the box of a small checkbox (Element
// shrinks it; the other systems keep one size).
ControlInteractiveSizeSM float32
// Bordered checkbox (Border): inline padding before the box and after
// the label, and the frame color of a checked one.
BorderedPaddingStart float32
BorderedPaddingEnd float32
BorderedCheckedColor Color `contrast:"nontext:@Page"`
// Button-style checkbox (Button / CheckboxGroupW.Buttons).
ButtonBg Color
ButtonCheckedBg Color
ButtonColor Color `contrast:"text:ButtonBg"`
ButtonCheckedColor Color `contrast:"text:ButtonCheckedBg"`
ButtonCheckedBorder Color
ButtonPaddingInline float32
ButtonPaddingInlineSM float32
}CheckboxToken styles Checkbox.
CodeBlockToken 实验性
type CodeBlockToken struct {
Alias
Bg Color
BorderColor Color // zero: none
Radius float32
CodeFontSize float32 // code text
LineHeight float32
PaddingBlock float32
PaddingInline float32
HeaderColor Color `contrast:"text:Bg"` // title / language label of the header row
HeaderBorder Color // rule under the header row (zero: none)
GutterColor Color `contrast:"text:Bg"` // line numbers
GutterBorder Color // rule between the gutter and the code (zero: none)
LineHighlightBg Color // CodeBlockW.HighlightLines
SelectionBg Color // selected text
Text Color `contrast:"text:Bg"` // plain code
Keyword Color `contrast:"text:Bg"`
String Color `contrast:"text:Bg"`
Number Color `contrast:"text:Bg"`
Comment Color `contrast:"text:Bg"`
Type Color `contrast:"text:Bg"`
Function Color `contrast:"text:Bg"`
Variable Color `contrast:"text:Bg"`
Constant Color `contrast:"text:Bg"`
Operator Color `contrast:"text:Bg"`
Punctuation Color `contrast:"text:Bg"`
Tag Color `contrast:"text:Bg"`
Attribute Color `contrast:"text:Bg"`
Property Color `contrast:"text:Bg"`
Regexp Color `contrast:"text:Bg"`
Invalid Color `contrast:"text:Bg"`
}CodeBlockToken styles CodeBlock and the code blocks of Markdown: the frame, the line-number gutter and the syntax colors a code highlighter's token kinds map to (ui.CodeTokenKind).
CollapseToken 实验性
type CollapseToken struct {
Alias
HeaderBg Color // header band (Ant: the whole group; zero: none)
HeaderColor Color `contrast:"text:HeaderBg"`
ArrowColor Color `contrast:"nontext:HeaderBg"`
ArrowSize float32
HeaderFontSize float32
HeaderFontSizeLG float32
HeaderFontWeight int // zero: regular
HeaderHeight float32 // minimum header height and label line height (zero: none)
HeaderPaddingBlock float32
HeaderPaddingInline float32
HeaderPaddingBlockSM float32
HeaderPaddingInlineSM float32
HeaderPaddingBlockLG float32
HeaderPaddingInlineLG float32
HeaderGap float32 // between arrow, label and extra
// HeaderPaddingInlineStartSM / LG pad the start of a small / large
// header that has no arrow before the label (antd headerPaddingSM
// "8 12 8 8", headerPaddingLG "16 24 16 16"; an arrow at the start
// keeps HeaderPaddingInlineSM / LG through its offset margin).
HeaderPaddingInlineStartSM float32
HeaderPaddingInlineStartLG float32
// ExpandIconEnd puts the arrow at the end of the header by default
// (Element expand-icon-position "right", shadcn AccordionTrigger).
ExpandIconEnd bool
ContentBg Color // zero: none
ContentPaddingBlock float32 // Element and shadcn: below the content only
ContentPaddingInline float32
ContentPaddingBlockSM float32
ContentPaddingInlineSM float32
ContentPaddingBlockLG float32
ContentPaddingInlineLG float32
BorderlessContentPadding float32 // above the content of a borderless / ghost group
BorderlessContentPaddingBottom float32
BorderlessContentPaddingInline float32 // borderless body inline padding (fixed, every size)
GhostContentPaddingBlock float32 // body block padding of a ghost group (inline stays ContentPaddingInline*)
BorderColor Color // frame and dividers
Radius float32
}CollapseToken styles Collapse.
Color
type Color = color.NRGBAColor is the non-premultiplied 8-bit color used throughout the UI.
func AntShades
func AntShades(c Color, dark bool, bg Color) [10]ColorAntShades implements the Ant Design color palette algorithm (@ant-design/colors generate(), MIT licensed): ten shades where index 5 is the input color. For dark themes the light shades are blended onto bg the way Ant's dark algorithm does.
func EnsureContrast
func EnsureContrast(fg, bg Color, min float64, toward ...Color) ColorEnsureContrast returns fg, or the smallest step (10% increments) from fg towards the colors in toward, in order, that reaches min contrast against bg. Themes use it to lift focus indicators that would otherwise be too faint (WCAG 1.4.11) while keeping their hue.
func Fade
func Fade(c Color, a float64) ColorFade returns c with its alpha multiplied by a.
func FromHSV
func FromHSV(h HSV) ColorFromHSV converts back to an opaque RGB color.
func FromHSVA
func FromHSVA(h HSVA) ColorFromHSVA converts back to RGB with alpha (clamped to [0,1]).
func Hex
func Hex(s string) ColorHex parses "#rgb", "#rrggbb" or "#rrggbbaa". It panics on malformed input because it is meant for literal design tokens.
func Lerp
func Lerp(a, b Color, t float32) ColorLerp interpolates every channel including alpha, t in [0,1].
func Mix
func Mix(a, b Color, weight float64) ColorMix returns the Sass/Less style mix: weight of b blended into a (weight 0 → a, 1 → b). Element Plus derives its light/dark scale this way.
func OKLCH 实验性
func OKLCH(l, c, h, alpha float64) ColorOKLCH converts an OKLCH color to sRGB: l is lightness in [0,1], c the chroma and h the hue in degrees. Channels outside the sRGB gamut are clamped. alpha is in [0,1].
func Over
func Over(fg, bg Color) ColorOver composites fg over an opaque bg and returns the opaque result.
func ParseColor
func ParseColor(s string) (Color, error)ParseColor accepts any form a user may type into a color field: hex (see ParseHex), CSS rgb()/rgba(), oklch() (see ParseOKLCH), hsb()/hsv() (see ParseHSB), plus "transparent".
func ParseHex
func ParseHex(s string) (Color, error)ParseHex is the error-returning form of Hex. It accepts 3, 4, 6 or 8 hex digits (#rgb, #rgba, #rrggbb, #rrggbbaa), with or without the '#' and surrounding spaces, in either case.
func ParseOKLCH 实验性
func ParseOKLCH(s string) (Color, error)ParseOKLCH parses CSS oklch(): "oklch(0.205 0 0)", "oklch(98.5% 0 none)", "oklch(1 0 0 / 10%)" or "oklch(1 0 0 / 0.15)". Lightness may be a number in [0,1] or a percentage; the hue may be "none".
func ParseRGB
func ParseRGB(s string) (Color, error)ParseRGB parses CSS rgb()/rgba() with comma or space separators and an optional "/ alpha"; channels are 0-255 integers, alpha 0-1 or a percent.
func RGBA
func RGBA(r, g, b uint8, a float64) ColorRGBA builds a color from CSS rgba() components (0-255 channels, 0-1 alpha).
func SyntaxColor 实验性
func SyntaxColor(hue Color, dark bool, bg Color) ColorSyntaxColor returns the shade of hue that reads as text on bg (4.5:1 when any shade does): the hue's own color, then darker shades on light backgrounds or lighter ones on dark backgrounds (dark selects Ant's dark palette blended onto bg).
ColorPickerToken 实验性
type ColorPickerToken struct {
Alias
PanelWidth float32
PanelPadding float32
PaletteHeight float32 // saturation / value square
PaletteRadius float32
BarHeight float32 // hue / alpha slider box (Element: the bar itself)
RailHeight float32 // painted rail inside the slider box
HandleSize float32 // round handle (Ant / shadcn; Element draws a bar thumb)
HandleColor Color // its ring
HandleShadow Color // its outer edge
SwatchSize float32 // preset swatches
SwatchGap float32
SwatchRadius float32
SwatchBorder Color // zero: none
SwatchActiveBorder Color // ring around the selected preset (Element)
SwatchHoverBorder Color
BorderColor Color // outline of the current-color swatch and the clear button
ClearColor Color // slash of the "no color" swatch
// Trigger.
TriggerSwatchRadius float32
TriggerSwatchBorder Color
// Gradient stop bar (ColorPickerGradient).
GradientBarHeight float32 // the slider box; its rail is RailHeight (Element: the whole box)
GradientActiveRing Color // ring around the selected stop's handle
}ColorPickerToken styles ColorPicker and ColorPickerPanel (the trigger frame uses the Input frame).
CommandToken 实验性
type CommandToken struct {
Alias
Bg Color
BorderColor Color // zero: none
Radius float32
Shadow []paint.Shadow // Shadow(): the floating look
// Search row (CommandInput wrapper): height, padding at both ends,
// the search icon and the rule under the row.
InputHeight float32
InputPaddingInline float32
InputIconSize float32
InputIconColor Color
InputBorderColor Color
ListMaxHeight float32 // default MaxHeight
ListPadding float32 // around the groups (CommandGroup p-1)
GroupTitleHeight float32
GroupTitlePadding float32 // inline padding of a heading
GroupTitleFontSize float32
GroupTitleFontWeight int
GroupTitleColor Color `contrast:"text:Bg"`
SeparatorColor Color
ItemHeight float32
ItemPaddingInline float32
ItemGap float32 // between icon and label
ItemRadius float32
ItemColor Color `contrast:"text:Bg"`
ItemActiveBg Color
ItemActiveColor Color `contrast:"text:ItemActiveBg"`
ItemIconSize float32
ItemIconColor Color
DisabledOpacity float32
ShortcutColor Color `contrast:"text:Bg"`
ShortcutFontSize float32
ShortcutLetterSpacing float32
EmptyPaddingBlock float32
EmptyColor Color `contrast:"text:Bg"`
}CommandToken styles Command (shadcn command.tsx): the palette box, the search row, group headings, items and the empty state.
Comp 实验性
type Comp uint8Comp names a component with its own tokens (its field in Components; String returns the field name).
Append-only: never reorder or insert; the zero value stays CompButton. A new component takes the next value and its token field goes at the end of Components.
const (
CompButton Comp = iota
CompInput
CompSelect
CompCheckbox
CompRadio
CompSwitch
CompSlider
CompTag
CompTabs
CompMenu
CompTable
CompCard
CompModal
CompDrawer
CompTooltip
CompPopover
CompNotification
CompMessage
CompPagination
CompSegmented
CompAvatar
CompSkeleton
CompLayout
CompTree
CompCascader
CompDatePicker
CompCalendar
CompSteps
CompTimeline
CompDescriptions
CompList
CompBadge
CompProgress
CompUpload
CompTransfer
CompCollapse
CompAlert
CompBreadcrumb
CompDropdown
CompRate
CompInputNumber
CompStatistic
CompDivider
CompTypography
CompImage
CompCarousel
CompColorPicker
CompTour
CompSplitter
CompResult
CompEmpty
CompFloatButton
CompAnchor
CompForm
CompMenubar
CompItem
CompTerminal
CompCodeBlock
CompJSONView
CompLogView
CompStatusBar
CompTitleBar
CompNotificationCenter
CompHotkeyInput
CompDock
CompChat
CompFooterToolbar
CompDiffView
CompSpin
CompPageHeader
CompCommand
CompScrollbar
)实验性
func (Comp) String 实验性
func (k Comp) String() stringString returns the component name ("Button").
Components 实验性
type Components struct {
Button ButtonToken
Input InputToken
Select SelectToken
Checkbox CheckboxToken
Radio RadioToken
Switch SwitchToken
Slider SliderToken
Tag TagToken
Tabs TabsToken
Menu MenuToken
Table TableToken
Card CardToken
Modal ModalToken
Drawer DrawerToken
Tooltip TooltipToken
Popover PopoverToken
Notification NotificationToken
Message MessageToken
Pagination PaginationToken
Segmented SegmentedToken
Avatar AvatarToken
Skeleton SkeletonToken
Layout LayoutToken
Tree TreeToken
Cascader CascaderToken
DatePicker DatePickerToken
Calendar CalendarToken
Steps StepsToken
Timeline TimelineToken
Descriptions DescriptionsToken
List ListToken
Badge BadgeToken
Progress ProgressToken
Upload UploadToken
Transfer TransferToken
Collapse CollapseToken
Alert AlertToken
Breadcrumb BreadcrumbToken
Dropdown DropdownToken
Rate RateToken
InputNumber InputNumberToken
Statistic StatisticToken
Divider DividerToken
Typography TypographyToken
Image ImageToken
Carousel CarouselToken
ColorPicker ColorPickerToken
Tour TourToken
Splitter SplitterToken
Result ResultToken
Empty EmptyToken
FloatButton FloatButtonToken
Anchor AnchorToken
Form FormToken
Menubar MenubarToken
Item ItemToken
Terminal TerminalToken
CodeBlock CodeBlockToken
JSONView JSONViewToken
LogView LogViewToken
StatusBar StatusBarToken
TitleBar TitleBarToken
NotificationCenter NotificationCenterToken
HotkeyInput HotkeyInputToken
Dock DockToken
Chat ChatToken
FooterToolbar FooterToolbarToken
DiffView DiffViewToken
Spin SpinToken
PageHeader PageHeaderToken
Command CommandToken
Scrollbar ScrollbarToken
}Components holds the token struct of every component. New components are appended at the end (see Comp).
func DialogMask 实验性
func DialogMask(c Color) ComponentsDialogMask sets the mask color and alpha for Modal (including Confirm) and Drawer. Pass it to WithComponents, Theme.Override or ConfigProvider.Components. A zero color gives a fully transparent mask. Element Plus 2.14.8's .el-overlay uses Hex("#00000080").
func (Components) Hash 实验性
func (c Components) Hash() uint64Hash returns a hash of the overrides (sentinels included), for caches of derived themes keyed by override set.
func (Components) Merge 实验性
func (c Components) Merge(o Components) ComponentsMerge returns c with the set fields of o layered on top (sentinels kept), e.g. for repeated ConfigProvider.Components calls.
ContrastCheck 实验性
type ContrastCheck struct {
Theme string // theme name ("antd", "antd-dark" …)
Token string // foreground token, e.g. "TextSecondary"
On string // background token, e.g. "BgContainer"
Use string // where the pair appears
FG Color
BG Color
Kind ContrastKind
Ratio float64
Status ContrastStatus
Spec string // published design-system variable (DesignDefault only)
// SuggestFG/SuggestBG/SuggestRatio are the colors HighContrast(theme)
// uses for this pair; set for required pairs below their minimum.
SuggestFG, SuggestBG Color
SuggestRatio float64
}ContrastCheck is one token pair of a theme and its measured ratio.
func CheckContrast 实验性
func CheckContrast(t *Theme) []ContrastCheckCheckContrast measures the text, placeholder, disabled, border and focus indicator tokens of t against the backgrounds they are drawn on and classifies each pair (Status), followed by the component token pairs (contrast struct tags) that overrides touched — every tagged pair in a HighContrast theme. Every pair is returned; ContrastFailures gives the required pairs that fail, ContrastIssues those and the design defaults.
func ContrastFailures 实验性
func ContrastFailures(t *Theme) []ContrastCheckContrastFailures returns the required pairs of t that fail and are not design-system defaults: what an audit of t must keep at zero. For a HighContrast theme every required pair below its minimum is a failure.
func ContrastIssues 实验性
func ContrastIssues(t *Theme) []ContrastCheckContrastIssues returns the required pairs of t below their minimum: failures and design defaults (exempt pairs are never issues). ui's Driver.Audit lists them; gate on ContrastFailures.
func (ContrastCheck) Pass 实验性
func (c ContrastCheck) Pass() boolPass reports whether the pair meets its requirement.
func (ContrastCheck) String 实验性
func (c ContrastCheck) String() stringContrastKind 实验性
type ContrastKind uint8ContrastKind is the WCAG requirement a token pair is held to.
Append-only: never reorder or insert; the zero value stays ContrastText.
const (
ContrastText ContrastKind = iota // body text: 4.5:1 (AA)
ContrastLargeText // ≥ 18.66px bold or 24px: 3:1
ContrastNonText // component boundaries, focus indicators, states: 3:1
// ContrastExempt pairs are measured and reported but not required:
// inactive (disabled) controls and their text (WCAG 1.4.3 "text or
// images of text that are part of an inactive user interface
// component", 1.4.11 "inactive components"), purely decorative lines
// that do not identify a control (dividers, card and table rules: the
// content inside identifies itself) and logotypes (1.4.3). Logos are
// app images, not theme tokens, so no pair checks them.
ContrastExempt
)实验性
func (ContrastKind) Min 实验性
func (k ContrastKind) Min() float64Min returns the ratio the kind requires (0 for exempt pairs).
func (ContrastKind) String 实验性
func (k ContrastKind) String() stringContrastStatus 实验性
type ContrastStatus uint8ContrastStatus classifies a measured pair for reports and audit gates.
Append-only: never reorder or insert; the zero value stays ContrastStatusPass.
const (
// ContrastStatusPass: the pair meets its minimum.
ContrastStatusPass ContrastStatus = iota
// ContrastStatusFail: a required pair (text; a non-text element that
// identifies a control, its state or keyboard focus) below its minimum
// whose colors are not the published values of the imitated design
// system. Audits fail on these.
ContrastStatusFail
// ContrastStatusDesignDefault: a required pair below its minimum whose
// colors are exactly the published values of the design system the
// theme imitates (Spec names the variable). It is reported with its
// ratio and the HighContrast replacement but is not a failure: changing
// it would make the default theme stop looking like Ant Design, Element
// Plus or shadcn/ui. Apps that need WCAG AA use HighContrast.
ContrastStatusDesignDefault
// ContrastStatusExempt: a ContrastExempt pair, reported only.
ContrastStatusExempt
)实验性
func (ContrastStatus) String 实验性
func (s ContrastStatus) String() stringDatePickerToken 实验性
type DatePickerToken struct {
Alias
CellWidth float32 // day cell box
CellHeight float32
CellInnerSize float32 // highlighted square inside a day cell
MonthCellWidth float32 // highlight of a month / quarter / year cell
MonthCellHeight float32
CellRadius float32 // cell highlight (clamped to half its height)
CellColor Color `contrast:"text:@Elevated"`
CellOutColor Color // days of adjacent months, years outside the decade
CellHoverBg Color // zero: none (the hover only recolors the text)
CellHoverColor Color // zero: unchanged
CellHoverWithRangeBg Color // hovered cell inside the selected range
CellActiveBg Color // selected cell
CellActiveColor Color `contrast:"text:CellActiveBg"`
CellActiveFontWeight int // zero: regular
CellRangeBg Color // strip behind the cells of a range
CellRangeColor Color // zero: unchanged
CellRangePreviewBg Color // hover preview of a range (zero: none)
CellRangeHoverBorder Color // dashed outline of the preview
CellTodayBorder Color `contrast:"nontext:@Elevated"` // zero: none
CellTodayBg Color // zero: none
CellTodayColor Color // zero: unchanged
CellTodayFontWeight int // zero: regular
CellDisabledBg Color // zero: none
CellDisabledColor Color
WeekColor Color // weekday headers (zero: the text color)
WeekFontSize float32
WeekNumberColor Color // week numbers of the week picker
HeaderHeight float32
HeaderColor Color `contrast:"text:@Elevated"` // clickable year / month titles
HeaderHoverColor Color // zero: unchanged
HeaderHoverBg Color // zero: none
HeaderBorderColor Color // divider under the header (zero: none)
// Header arrows stopped by MinDate / MaxDate: drawn at
// NavDisabledOpacity, or in NavDisabledColor when that is set.
NavDisabledOpacity float64 // unitless ratio
NavDisabledColor Color
PanelPaddingInline float32 // around the cell grid
PanelBg Color
PanelRadius float32 // popup panel
PanelShadow []paint.Shadow
PanelBorderColor Color // outline of a bordered inline panel
SplitColor Color // footer, preset and panel dividers
PresetsWidth float32
FooterHeight float32
PresetColor Color `contrast:"text:@Elevated"`
PresetHoverColor Color // zero: unchanged
PresetHoverBg Color // zero: none
TimeColumnWidth float32
TimeColumnHeight float32
TimeCellHeight float32
TimeCellFontSize float32
TimeCellRadius float32
TimeCellColor Color `contrast:"text:@Elevated"`
TimeCellHoverBg Color
TimeCellActiveBg Color // zero: none
TimeCellActiveColor Color `contrast:"text:TimeCellActiveBg"`
TimeCellActiveFontWeight int // zero: regular
TimeCellDisabledBg Color // selected disabled option (zero: none)
TimeCellDisabledColor Color
}DatePickerToken styles the date and time pickers: DatePicker, DatePickerPanel, RangePicker, DateTimePicker, TimePicker, TimePanel, TimeRangePicker and TimeSelect (their trigger fields use the Input frame).
DescriptionsToken 实验性
type DescriptionsToken struct {
Alias
LabelBg Color // label cells of a bordered list
// LabelColor and ContentColor color a borderless list only (antd
// labelColor / contentColor). After 0.1.0 a bordered list reads
// BorderedLabelColor and BorderedContentColor instead (antd: bordered
// labels are colorTextSecondary whatever labelColor says); an override
// of LabelColor alone no longer changes bordered labels.
LabelColor Color `contrast:"text:@Page"` // borderless label
ContentColor Color `contrast:"text:@Page"` // borderless content
BorderedLabelColor Color `contrast:"text:LabelBg"` // bordered label cell
BorderedContentColor Color `contrast:"text:@Page"` // bordered content cell
TitleColor Color `contrast:"text:@Page"`
TitleFontSize float32
TitleFontSizeSM float32
TitleMarginBottom float32 // Large
TitleMarginBottomMD float32
TitleMarginBottomSM float32
BorderColor Color // bordered outline and cell rules
Radius float32 // bordered outline (zero: square)
ItemPaddingBottom float32 // borderless rows, Large (the last row has none)
ItemPaddingBottomMD float32
ItemPaddingBottomSM float32
ItemPaddingEnd float32 // borderless cells except the last of a row
// VerticalLabelPaddingBottom* pad the label row of a borderless
// vertical list (antd: the item padding; Element 8 / 6 / 4).
VerticalLabelPaddingBottom float32
VerticalLabelPaddingBottomMD float32
VerticalLabelPaddingBottomSM float32
ShowColon bool // borderless labels end with the locale colon (antd colon; Element has none)
ColonMarginInlineStart float32 // before the colon (antd colonMarginLeft)
LabelMarginInlineEnd float32 // borderless label (and colon) to content
LabelMarginInlineEndSM float32
CellPaddingBlock float32 // bordered cells, Large (Ant "default")
CellPaddingInline float32
CellPaddingBlockMD float32 // Middle
CellPaddingInlineMD float32
CellPaddingBlockSM float32 // Small
CellPaddingInlineSM float32
// DefaultMiddle makes an unsized list use the Middle bucket (Element's
// default size); otherwise it uses Large (antd's "default").
DefaultMiddle bool
}DescriptionsToken styles Descriptions.
Size buckets follow Tango's ControlSize: Large is antd "default" and Element "large", Middle is antd "middle" and Element "default", Small is "small" in both.
DiffViewToken 实验性
type DiffViewToken struct {
Alias
InsertedLineBg Color // diffEditor.insertedLineBackground
InsertedTextBg Color // diffEditor.insertedTextBackground, over InsertedLineBg
RemovedLineBg Color // diffEditor.removedLineBackground
RemovedTextBg Color // diffEditor.removedTextBackground, over RemovedLineBg
OverviewInserted Color // diffEditorOverview.insertedForeground
OverviewRemoved Color // diffEditorOverview.removedForeground
DiagonalFill Color // diffEditor.diagonalFill: stripes of the padding
RegionBg Color // the bar of a folded region (diffEditor.unchangedRegionBackground)
RegionColor Color `contrast:"text:RegionBg"` // its "N hidden lines" (unchangedRegionForeground)
LinkColor Color `contrast:"text:RegionBg"` // its "show more" buttons and the hunk actions
LinkHoverColor Color `contrast:"text:RegionBg"`
}DiffViewToken styles the diff editor (ui/editor/diffview): the backgrounds of inserted and removed lines and characters, the merged overview ruler's marks, the diagonal fill of the alignment padding and the bar of a folded unchanged region. The diff view uses them when the editor theme does not set the matching Monaco colors itself (diffEditor.*, diffEditorOverview.*), see docs/specs/diff-view.md 3.11. They derive from the global tokens only, so dark themes need nothing of their own.
DividerToken 实验性
type DividerToken struct {
Alias
Color Color // the rule (Alias LineWidth thick)
TextColor Color `contrast:"text:@Page"`
PlainTextColor Color `contrast:"text:@Page"`
TextFontSize float32 // titled divider (Plain: the Alias FontSize)
TextFontWeight int // titled divider (Plain: regular)
TextPaddingInline float32 // title to the rule on each side
OrientationMargin float32 // start / end titles: the short rule, a fraction of the width
MarginBlock float32 // above and below a plain rule
TextMarginBlock float32 // above and below a titled divider
MarginBlockSM float32 // Size(Small)
MarginBlockMD float32 // Size(Middle)
VerticalMarginInline float32 // VDivider
VerticalHeight float32 // VDivider (zero: the height of the row)
}DividerToken styles Divider and VDivider.
DockToken 实验性
type DockToken struct {
Alias
Bg Color // behind the groups (shows in the split bars)
GroupBg Color // content area of a group
HeaderBg Color // tab strip of a group (zero: none)
HeaderBorder Color // line under the tab strip (zero: none; Ant and Element card tabs draw their own)
ActiveBorder Color `contrast:"nontext:HeaderBg"` // top edge of the focused group's strip (zero: none)
GutterSize float32 // hit size of a split bar (the gap between groups)
MinPaneSize float32 // smallest size a split bar leaves to a group
DropBg Color // drop preview fill
DropBorder Color `contrast:"nontext:@Page"` // drop preview outline and tab insertion mark
DropRadius float32
GhostBg Color // dragged tab following the pointer
GhostText Color `contrast:"text:GhostBg"`
GhostRadius float32
EmptyText Color `contrast:"text:GroupBg"` // hint of an empty group
ActionBoxSize float32 // header buttons (split, maximize)
}DockToken styles Dock (docking layout of tab groups). The split bars reuse the Splitter tokens; the tab strip of each group is a Tabs bar and reads the Tabs tokens.
DrawerToken 实验性
type DrawerToken struct {
Alias
Bg Color
TitleColor Color `contrast:"text:Bg"`
TitleFontSize float32
TitleFontWeight int // zero: regular
HeaderPaddingTop float32
HeaderPaddingBottom float32
HeaderPaddingInline float32
HeaderBorderColor Color // divider under the header (zero: none)
Padding float32 // body padding
BodyPaddingTop float32
FooterPaddingTop float32
FooterPaddingBlock float32 // bottom padding of the footer
FooterPaddingInline float32
FooterBorderColor Color // divider above the footer (zero: none)
CloseIconColor Color // zero: the icon button default
BorderColor Color // edge facing the page (zero: none)
MaskBg Color // mask color including opacity
Shadow []paint.Shadow
ResizeHandleSize float32 // Resizable: hit width of the edge handle
ResizeLineColor Color `contrast:"nontext:Bg" spec:"dragger hover: antd 6.7 drawer/style colorPrimary opacity .2; el-drawer primary"` // Resizable: edge line under the pointer / while dragging
ResizeLineSize float32
// ResizeLineActiveColor colors the edge while dragging (zero:
// ResizeLineColor).
ResizeLineActiveColor Color `contrast:"nontext:Bg" spec:"dragger dragging: antd 6.7 drawer/style colorPrimary opacity .3; el-drawer primary"`
// Default size: Size, or SizeRatio of the window extent when Size is
// zero; both set: the smaller (shadcn w-3/4 sm:max-w-sm).
Size float32
SizeRatio float64
// CloseAtEnd puts the close button after the title and extra
// (closable.placement "end"); false: before the title (Ant "start").
CloseAtEnd bool
CloseBtnSize float32
CloseIconSize float32
HeaderGap float32 // between close button, title and extra
}DrawerToken styles Drawer (shadcn: Sheet).
DropdownToken 实验性
type DropdownToken struct {
Alias
PopupBg Color
PopupBorderColor Color // zero: none
PopupRadius float32
PopupShadow []paint.Shadow
PaddingBlock float32 // panel padding
PaddingInline float32
ItemHeight float32
ItemPaddingInline float32
ItemBorderRadius float32
ItemColor Color `contrast:"text:PopupBg"`
ItemHoverBg Color // zero: none
ItemHoverColor Color `contrast:"text:ItemHoverBg"`
ItemSelectedBg Color // zero: none
ItemSelectedColor Color `contrast:"text:ItemSelectedBg"`
ItemIconColor Color // zero: the label color
IconSize float32
DangerColor Color `contrast:"text:PopupBg"`
DangerHoverBg Color // zero: the regular hover
DangerHoverColor Color `contrast:"text:DangerHoverBg"`
SubmenuArrowColor Color `contrast:"nontext:PopupBg"`
GroupTitleHeight float32
GroupTitleFontSize float32
GroupTitleFontWeight int
GroupTitleColor Color `contrast:"text:PopupBg"`
DividerColor Color
// Shortcut column (MenuItem.Shortcut): drawn at the item's inline end
// in its own color and size, at least ShortcutGap after the label.
// ShortcutLetterSpacing adds tracking after every glyph (CSS
// letter-spacing; shadcn tracking-widest).
ShortcutColor Color `contrast:"text:PopupBg"`
ShortcutFontSize float32
ShortcutLetterSpacing float32
ShortcutGap float32
// Submenu chevron: size and distance from the item's inline end.
SubmenuArrowSize float32
SubmenuArrowInset float32
// Checkable items (Dropdown Check / Radio, Menubar): the indicator
// column at the item's inline start (IndicatorWidth wide; labels of
// the panel move past it), a check mark IndicatorSize large or a radio
// dot half of it.
IndicatorColor Color `contrast:"nontext:PopupBg"`
IndicatorSize float32
IndicatorWidth float32
// Hover trigger timing (Ant mouseEnterDelay / mouseLeaveDelay,
// Element show-timeout / hide-timeout) and the gap between the
// trigger and the panel (Ant offset marginXXS, shadcn sideOffset).
MouseEnterDelay time.Duration
MouseLeaveDelay time.Duration
PopupOffset float32
}DropdownToken styles Dropdown menus and the pop-out panels they share with Menu.
EmptyPicture 实验性
type EmptyPicture intEmptyPicture is the default picture of Empty (EmptyToken.Picture). Append-only: never reorder or insert.
const (
// EmptyPictureAnt is Ant's open box (Simple: the tray).
EmptyPictureAnt EmptyPicture = iota
// EmptyPictureElement is Element Plus's illustration (Simple still
// draws the Ant tray).
EmptyPictureElement
)实验性
EmptyToken 实验性
type EmptyToken struct {
Alias
ImageHeight float32 // default picture (Element: its illustration)
ImageHeightSM float32 // Simple picture
DescriptionColor Color `contrast:"text:@Page"`
DescriptionColorSM Color `contrast:"text:@Page"` // Simple
SimpleFill Color // Simple tray
SimpleLine Color // Simple tray outline
SimpleShadow Color // Simple ground ellipse
Picture EmptyPicture // default illustration when MediaBg is zero
MediaBg Color // shadcn icon tile (zero: the picture is an illustration)
MediaColor Color `contrast:"nontext:MediaBg"` // its icon
MediaRadius float32
TitleFontSize float32 // Title (shadcn EmptyTitle)
TitleFontWeight int // zero: regular
TitleColor Color `contrast:"text:@Page"`
PaddingBlock float32 // around the default (not Simple) empty state
PaddingInline float32
DescriptionMarginTop float32 // picture to the title / description
FooterMarginTop float32 // description to the Body actions
}EmptyToken styles Empty. The default pictures take their colors from Theme.Illustration.
Flavor
type Flavor intFlavor names the design system a theme imitates.
Append-only: never reorder or insert; the zero value stays Ant.
const (
Ant Flavor = iota
Element
// StyleShadcn is the shadcn/ui look (Shadcn constructor). Components
// branch on it only for structural differences that tokens cannot
// express (segmented tabs, Sonner toasts); colors, focus rings, heights
// and shadows come from tokens.
StyleShadcn
)func (Flavor) String
func (f Flavor) String() stringString returns "antd", "element-plus" or "shadcn".
FloatButtonToken 实验性
type FloatButtonToken struct {
Alias
Size float32 // button width and height
DescriptionHeight float32 // height of a button with a description
IconSize float32
DescriptionIconSize float32 // icon of a button with a description
DescriptionFontSize float32
Bg Color
Color Color `contrast:"text:Bg"` // icon and description
HoverBg Color // tint over the button under the pointer
PrimaryBg Color
PrimaryHoverBg Color
PrimaryColor Color `contrast:"text:PrimaryBg"`
Radius float32 // square shape
InnerRadius float32 // hover tint of a member of a square group
Shadow []paint.Shadow
GroupShadow []paint.Shadow // square group card
GroupSplitColor Color // lines between the members of a square group
GroupGap float32 // between the members of a round group
GroupPadding float32 // inside a square group card
// BackTop defaults: antd FloatButton.BackTop visibilityHeight 400 at
// insetInlineEnd 24 / insetBlockEnd 48 with VerticalAlignTop; el-backtop
// visibility-height 200, right 40, bottom 40 with a caret.
BackTopVisibilityHeight float32
BackTopRight float32
BackTopBottom float32
BackTopCaret bool // caret-up icon instead of the bar-and-arrow
}FloatButtonToken styles FloatButton, FloatButtonGroup and BackTop.
FooterToolbarToken 实验性
type FooterToolbarToken struct {
Alias
Bg Color // background in flow (slightly translucent)
FrostedBg Color // background over the blurred page while pinned
BlurRadius float32 // backdrop blur under FrostedBg (logical px; ZeroPx: never frosted)
MinHeight, PaddingInline float32 // Pro form/components/FooterToolbar/style.js
}FooterToolbarToken styles the Pro FooterToolbar (ui.FooterToolbar): the bar's surface. Pinned to the bottom (Sticky) over content that scrolls under it, the bar is frosted — a backdrop blur (paint.BackdropBlur) of BlurRadius under the translucent FrostedBg, like Ant Design Pro's FooterToolbar and shadcn/ui's sticky bars (bg-background/60 with backdrop-blur). In flow it draws Bg. When pinned, ui.FooterToolbar uses FrostedBg + BlurRadius when supported; HighContrast themes and renderers without backdrop blur use the opaque theme.BgContainer fallback.
FormToken 实验性
type FormToken struct {
Alias
LabelColor Color `contrast:"text:@Page"`
LabelErrorColor Color // label of an item with an error (zero: unchanged)
LabelFontSize float32
LabelFontWeight int // zero: regular
LabelHeight float32 // horizontal / inline label row
LabelColonMarginInlineEnd float32 // between an end-aligned label and the control
LabelRequiredMarkColor Color `contrast:"text:@Page"`
LabelTooltipColor Color // the label's help icon
LabelOptionalColor Color `contrast:"text:@Page"` // Form.RequiredMarkOptional suffix
VerticalLabelHeight float32 // label line of vertical forms
VerticalLabelPadding float32 // under a vertical label
ItemMarginBottom float32 // between items without a message
InlineItemMarginBottom float32
ErrorColor Color `contrast:"text:@Page"`
WarningColor Color
HelpColor Color `contrast:"text:@Page"` // help text and Extra
MessageFontSize float32 // help, error and Extra lines (zero: the text default)
MessageLineHeight float32 // zero: the text default
ExtraMarginTop float32
// Pro v3 form/layouts/LoginForm/style.js (2026-11-15).
LoginLogoGap float32
LoginTitleFontWeight int
LoginDescriptionMarginBottom float32
}FormToken styles Form items: labels, required marks and the messages under the controls.
Gradient 实验性
type Gradient struct {
Angle float64
Stops []GradientStop
}Gradient is a linear gradient value (ColorPickerGradient). Angle is the direction in degrees as in CSS linear-gradient: 0 points toward the top, 90 toward the right, 180 toward the bottom. Stops are the color stops in any order (Sorted orders them by Offset). The zero Gradient (no stops) means "no color".
func ParseGradient 实验性
func ParseGradient(s string) (Gradient, error)ParseGradient parses a CSS linear-gradient: an optional direction ("<n>deg", "<n>turn", "<n>rad" or "to top|right|bottom|left"; default "to bottom" = 180deg) and at least two stops "<color> [<n>%]", the color in any ParseColor form. Stops without a position are spread evenly between their positioned neighbours, as in CSS.
func (Gradient) At 实验性
func (g Gradient) At(t float64) ColorAt returns the color of the gradient at offset t in [0,1] (channels, alpha included, interpolated linearly between the surrounding stops; the zero Color without stops).
func (Gradient) CSS 实验性
func (g Gradient) CSS() stringCSS formats g as a CSS linear-gradient, e.g. "linear-gradient(90deg, #1677ff 0%, #722ed1 100%)"; "" without stops.
func (Gradient) IsZero 实验性
func (g Gradient) IsZero() boolIsZero reports a gradient without stops.
func (Gradient) Sorted 实验性
func (g Gradient) Sorted() GradientSorted returns a copy of g whose stops are ordered by Offset (stable, offsets clamped to [0,1]).
GradientStop 实验性
type GradientStop struct {
Offset float64
Color Color
}GradientStop is one color stop of a Gradient: Offset runs from 0 (the start of the gradient line) to 1 (its end).
HSV
type HSV struct{ H, S, V float64 }HSV is hue [0,360), saturation and value [0,1].
func ToHSV
func ToHSV(c Color) HSVToHSV converts an RGB color (alpha ignored), matching tinycolor2.
HSVA
type HSVA struct{ H, S, V, A float64 }HSVA is HSV plus alpha in [0,1], the model color pickers edit.
func ParseHSB
func ParseHSB(s string) (HSVA, error)ParseHSB parses hsb()/hsba()/hsv()/hsva() text: hue in degrees (an optional "deg" suffix), saturation and brightness in percent (the "%" is optional; 0-100), alpha 0-1 or a percent; comma or space separators and an optional "/ alpha".
func ToHSVA
func ToHSVA(c Color) HSVAToHSVA converts c, keeping its alpha.
HotkeyInputToken 实验性
type HotkeyInputToken struct {
Alias
MinWidth float32
PaddingInline float32
KeyGap float32 // between key caps
PlaceholderColor Color `contrast:"text:@Page"`
RecordingColor Color `contrast:"text:@Page"` // the prompt while recording
ClearIconSize float32
ClearColor Color `contrast:"nontext:@Page"`
MessageFontSize float32 // conflict message under the field
MessageColor Color `contrast:"text:@Page"`
}HotkeyInputToken styles HotkeyInput, the shortcut recorder: an input frame (Input token colors) holding key caps.
Illustration 实验性
type Illustration struct {
// Ant "presented" empty box.
Ground, Back, Front, Edge, Inner Color
// Simple empty outline.
Line Color
// Element empty picture: three fills from dark to light and the ink.
Fill1, Fill2, Fill3, Ink Color
// Result pictures: soft and mid tints of the primary color.
Soft, Mid Color
}Illustration holds the colors of the Empty / Result pictures.
ImageToken 实验性
type ImageToken struct {
Alias
PlaceholderBg Color // loading / failed box
PlaceholderColor Color // its icon (Element: text)
PreviewMaskBg Color // hover mask of a previewable image
PreviewMaskColor Color // "preview" label on the mask
PreviewBg Color // preview backdrop
PreviewOperationSize float32
PreviewOperationIconSize float32
PreviewOperationBg Color // round close / prev / next buttons
PreviewOperationHoverBg Color // layered on hover (zero: none)
PreviewOperationColor Color // toolbar actions
PreviewOperationHoverColor Color
PreviewOperationDisabledColor Color
PreviewToolbarBg Color
PreviewSplitColor Color // Element toolbar separators
// Round close / prev / next buttons: icon colors and distance from the
// window edges.
PreviewSwitchColor Color
PreviewSwitchHoverColor Color
PreviewCloseOffset float32 // close button from the top and inline-end edges
PreviewSwitchOffset float32 // prev / next from the inline edges
// Toolbar (Ant layout): action box size, gap between actions, inline
// padding of the bar.
PreviewActionSize float32
PreviewActionGap float32
PreviewActionsPadding float32
// Group counter ("2 / 5"): distance from the bottom edge and color.
PreviewProgressBottom float32
PreviewProgressColor Color
// Behaviour defaults of the preview (ImageW methods override them):
// zoom bounds and step, backdrop click closes, group wraps around,
// group counter shown.
PreviewMinScale float32
PreviewMaxScale float32
PreviewScaleStep float32
PreviewMaskClosable bool
PreviewInfinite bool
PreviewShowProgress bool
// PreviewDblClickZoom makes a double click zoom one step or reset
// (rc-image); Element's viewer has no double-click action.
PreviewDblClickZoom bool
}ImageToken styles Image and its preview.
InputNumberToken 实验性
type InputNumberToken struct {
Alias
ControlWidth float32 // default width
HandleWidth float32 // stacked step buttons at the inline end
HandleFontSize float32 // their arrow icons
HandleColor Color `contrast:"nontext:@Page"`
HandleHoverColor Color
HandleBg Color // resting background (zero: none)
HandleHoverBg Color // zero: none
HandleDisabledColor Color // at a limit or disabled
HandleBorderColor Color // dividers of the step buttons
// ControlsPosition("sides") / Mode("spinner"): − and + buttons at
// both ends. SideHandleBg zero: transparent (antd spinner actions).
SideHandleBg Color
SideHandleColor Color `contrast:"nontext:SideHandleBg"`
SideHandleHoverColor Color
SideHandleFontSize float32
// SideHandleWidth* is the width of each side button per size; zero:
// as wide as the control is high (Element).
SideHandleWidth float32
SideHandleWidthSM float32
SideHandleWidthLG float32
// HideControlsInactive is 1 when a disabled or read-only field leaves
// out its step buttons (antd), 0 when it keeps them, inactive
// (Element). An int, so it is also a CSS variable.
HideControlsInactive int
}InputNumberToken styles InputNumber (its frame, text and placeholder use the Input token).
InputToken 实验性
type InputToken struct {
Alias
PaddingInline float32
PaddingInlineSM float32
PaddingInlineLG float32
InputFontSize float32
InputFontSizeSM float32
InputFontSizeLG float32
Bg Color // resting field fill
ActiveBg Color // focused field fill
HoverBg Color
ActiveBorderColor Color `contrast:"nontext:ActiveBg"` // focused field border (the focus indicator)
HoverBorderColor Color
PlaceholderColor Color `contrast:"text:ActiveBg"`
ContentColor Color
ControlRadius float32 // positive: radius used at every size
AddonBg Color
AddonColor Color `contrast:"text:AddonBg"`
// Focus halo (Ant activeShadow): color, width and gap; zero color: none.
ActiveShadowColor Color
ActiveShadowWidth float32
ActiveShadowOffset float32
ErrorActiveShadowColor Color
WarningActiveShadowColor Color
Shadow []paint.Shadow // resting field shadow (shadcn shadow-xs)
// TextAreaMinHeight is the smallest TextArea frame (shadcn min-h-16);
// zero: the rows decide.
TextAreaMinHeight float32
}InputToken styles Input and the input-like controls (InputNumber, TextArea, pickers' fields).
ItemToken 实验性
type ItemToken struct {
Alias
Radius float32
PaddingBlock float32 // default size
PaddingInline float32
PaddingBlockSM float32 // small size
PaddingInlineSM float32
Gap float32 // between media, content and actions
GapSM float32
ContentGap float32 // title to description
TitleFontSize float32
TitleFontWeight int // zero: regular
TitleColor Color `contrast:"text:@Page"`
DescriptionColor Color `contrast:"text:@Page"`
DescriptionSize float32
BorderColor Color // outline variant
MutedBg Color // muted variant
HoverBg Color // clickable item under the pointer (zero: none)
MediaIconBox float32
MediaIconSize float32
MediaIconRadius float32
MediaIconBg Color // zero: none
MediaIconBorder Color // zero: none
MediaIconColor Color `contrast:"nontext:MediaIconBg"`
ActionsGap float32
GroupSeparator Color // rule between the items of a separated group
GroupSeparatorInset float32 // vertical space around the rule
}ItemToken styles Item and ItemGroup.
JSONViewToken 实验性
type JSONViewToken struct {
Alias
RowHeight float32
Indent float32 // per nesting level
ValueFontSize float32
KeyColor Color `contrast:"text:@Page"` // object keys and array indexes
StringColor Color `contrast:"text:@Page"`
NumberColor Color `contrast:"text:@Page"`
BoolColor Color `contrast:"text:@Page"`
NullColor Color `contrast:"text:@Page"`
OtherColor Color `contrast:"text:@Page"` // values of ValueOther (functions, pointers …)
MetaColor Color `contrast:"text:@Page"` // item counts, types, group ranges
PunctColor Color `contrast:"text:@Page"` // ":" and brackets
SwitcherColor Color `contrast:"nontext:@Page"`
RowHoverBg Color
RowSelectedBg Color
MatchBg Color // search match
MatchCurrentBg Color // the match the navigation is on
MatchCurrentBorder Color // outline of the current match
Radius float32 // row highlight
}JSONViewToken styles JSONView: the rows of the value tree, the value colors by type and the search highlight.
LayoutToken 实验性
type LayoutToken struct {
Alias
BodyBg Color // zero: none
HeaderBg Color // zero: none
HeaderColor Color `contrast:"text:HeaderBg"`
HeaderHeight float32
HeaderPaddingInline float32
FooterBg Color
FooterPadding float32 // block (vertical) padding
FooterPaddingInline float32
SiderBg Color // dark sider
LightSiderBg Color
SiderWidth float32
// SiderCollapsedWidth is the collapsed Sider width. Difference from
// antd 6.7: Layout.Sider collapsedWidth defaults to 80
// (antd/es/layout/Sider.js); Tango's Ant theme keeps 64 because
// ProLayout collapses the same Sider to 64 (Pro v6). Recorded in
// docs/design-baseline.md.
SiderCollapsedWidth float32
TriggerBg Color
TriggerColor Color `contrast:"text:TriggerBg"`
TriggerHeight float32
LightTriggerBg Color
LightTriggerColor Color `contrast:"text:LightTriggerBg"`
ZeroTriggerWidth float32
ZeroTriggerHeight float32
ProHeaderBg Color
ProHeaderHeight float32
// Pro v3 layout/ProLayout.js, TopNavHeader/style.js and provider
// typing/layoutToken.js. Separate from the basic Layout regions.
ProSiderWidth, ProMixSiderWidth float32
ProHeaderTitleFontSize, ProLogoSize, ProLogoTitleGap float32
ProTopNavPaddingInline, ProMenuPadding float32
ProFixedWidth float32
PagePaddingInline, PagePaddingBlock float32
PageHeaderPaddingTop, PageHeaderPaddingBottom float32
PageBg, PageFixedBg Color
DefaultFooterLinkGap, DefaultFooterPaddingInline float32
DefaultFooterMarginTop, DefaultFooterMarginBottom float32
}LayoutToken styles Layout and ProLayout chrome (header, sider, footer). The Header* and Footer* fields are the Layout regions; ProHeader* the ProLayout header bar.
ListToken 实验性
type ListToken struct {
Alias
HeaderBg Color // zero: none
FooterBg Color // zero: none
SplitColor Color // rules between items, header and footer
BorderColor Color // bordered outline
Radius float32
HeaderPaddingBlock float32 // header and footer (a bordered small / large list uses the item padding)
ItemPaddingBlock float32 // Middle
ItemPaddingBlockSM float32
ItemPaddingBlockLG float32
ItemPaddingInline float32 // Middle, bordered lists only
ItemPaddingInlineSM float32 // Small, with or without a border
ItemPaddingInlineLG float32 // Large, with or without a border
EmptyTextPadding float32
AvatarMarginInlineEnd float32 // ListItemMeta avatar to text
TitleColor Color `contrast:"text:@Page"`
TitleFontWeight int // zero: regular
TitleMarginBottom float32 // title to description
DescriptionColor Color `contrast:"text:@Page"`
ActionsMarginInlineStart float32 // ListActions
ActionsSplitColor Color // bars between actions
// ActionsGap separates actions (antd li padding 0 paddingXS); the bar
// sits in the middle and the last action keeps half a gap after it.
ActionsGap float32
PaginationMarginTop float32 // pager under the list
GridItemMarginBottom float32 // space under every grid row (antd grid item marginBlockEnd; gutter is horizontal only)
// Bordered lists keep the pager inside the outline with this margin.
PaginationMarginBlockBordered float32
PaginationMarginInlineBordered float32
// Vertical item layout (List.ItemLayout("vertical")).
VerticalMetaMarginBottom float32 // under ListItemMeta
VerticalTitleFontSize float32
VerticalTitleMarginBottom float32
VerticalActionsMarginTop float32
VerticalActionsGap float32 // between actions (bar in the middle)
VerticalExtraMarginInlineStart float32 // List.ItemExtra
// Listy (antd 6.7 es/listy/style).
ListyItemPaddingBlock float32
ListyItemPaddingInline float32
ListyItemHoverBg Color
ListySplitColor Color
ListyGroupHeaderPaddingBlock float32
ListyGroupHeaderBg Color // over BgContainer
ListyGroupHeaderColor Color `contrast:"text:@Page"`
ListyGroupHeaderFontWeight int
}ListToken styles List (and ListItemMeta / ListActions) and Listy.
LogViewToken 实验性
type LogViewToken struct {
Alias
Bg Color
BorderColor Color // zero: none
Radius float32
LineFontSize float32
LineHeight float32
PaddingInline float32
Text Color `contrast:"text:Bg"`
GutterColor Color `contrast:"text:Bg"` // line numbers
ErrorColor Color `contrast:"text:Bg"` // lines of level error / fatal
WarnColor Color `contrast:"text:Bg"`
DebugColor Color `contrast:"text:Bg"` // debug / trace lines
SelectionBg Color
MatchBg Color
MatchCurrentBg Color
MatchCurrentBorder Color // outline of the current match
ToolbarGap float32
Black Color
Red Color
Green Color
Yellow Color
Blue Color
Magenta Color
Cyan Color
White Color
BrightBlack Color
BrightRed Color
BrightGreen Color
BrightYellow Color
BrightBlue Color
BrightMagenta Color
BrightCyan Color
BrightWhite Color
}LogViewToken styles LogView: the frame, the monospace lines, the level colors of lines without colors of their own, the search highlight and the 16 ANSI colors (SGR 30–37 / 90–97). The ANSI colors are derived for the background, so they read on light and dark themes alike.
MenuToken 实验性
type MenuToken struct {
Alias
ItemHeight float32
ItemBorderRadius float32
ItemMarginInline float32
IconSize float32
ItemBg Color
SubMenuItemBg Color // open inline submenu (zero: none)
ItemColor Color `contrast:"text:ItemBg"`
ItemHoverBg Color // zero: none
ItemHoverColor Color
ItemSelectedBg Color // zero: none
ItemSelectedColor Color `contrast:"text:ItemSelectedBg"`
// Inline / vertical layout. CollapsedWidth is the width of an
// inline-collapsed menu (icons only), CollapsedIconSize its icon size.
// ItemMarginBlock separates items; SubMenuItemHeight is the height of
// the items of an open inline submenu (zero: ItemHeight; shadcn
// SidebarMenuSubButton h-7).
// InlineIndent is the indent per level (Ant inlineIndent, Element
// --el-menu-level-padding).
CollapsedWidth float32
CollapsedIconSize float32
ItemMarginBlock float32
SubMenuItemHeight float32
InlineIndent float32
// ItemContentInset, when non-zero, is the start inset of every inline
// item's content instead of the per-level indent (shadcn: nesting
// comes from the submenu guide). IconGap separates icon and label;
// ItemSelectedFontWeight is the label weight of the selected item
// (zero: regular).
ItemContentInset float32
IconGap float32
ItemSelectedFontWeight int
// SubMenuGuideInset, when non-zero, hangs open inline submenus off a
// guide line SubMenuGuideInset from the menu's start edge (shadcn
// SidebarMenuSub border-l); their items start SubMenuItemInset from
// the edge (and end as far from the other edge), the column is padded
// SubMenuPaddingBlock above and below.
SubMenuGuideInset float32
SubMenuItemInset float32
SubMenuPaddingBlock float32
SubMenuGuideColor Color
// GroupTitleNested indents the title of a nested group with its level.
GroupTitleNested bool
// Group titles (Ant type="group", shadcn SidebarGroupLabel).
GroupTitleHeight float32
GroupTitleFontSize float32
GroupTitleFontWeight int
GroupTitleColor Color `contrast:"text:ItemBg"`
GroupTitlePaddingInline float32
// Danger items (MenuItem.Danger; Ant dangerItemColor,
// dangerItemSelectedBg).
DangerItemColor Color `contrast:"text:ItemBg"`
DangerItemSelectedBg Color // zero: none
// Dark menu counterparts (antd darkDangerItemColor,
// darkDangerItemSelectedBg, darkGroupTitleColor).
DarkDangerItemColor Color `contrast:"text:DarkItemBg"`
DarkDangerItemSelectedBg Color // zero: none
DarkGroupTitleColor Color `contrast:"text:DarkItemBg"`
// Extra column (MenuItem.Shortcut shown as Ant's item extra).
ExtraColor Color `contrast:"text:ItemBg"`
ExtraFontSize float32
// Pop-out submenu timing (Ant subMenuOpenDelay / subMenuCloseDelay,
// Element show-timeout / hide-timeout, Radix NavigationMenu
// delayDuration / close timer) and gap to the parent item
// (PopupOffset: vertical and collapsed; HorizontalPopupOffset:
// under a horizontal bar).
SubMenuOpenDelay time.Duration
SubMenuCloseDelay time.Duration
PopupOffset float32
HorizontalPopupOffset float32
// Horizontal bar (shadcn NavigationMenu triggers). HorizontalActiveBar*
// is the underline of the active item (zero height: none), inset by
// HorizontalActiveBarInset from both ends; HorizontalItemHoverBg /
// HorizontalItemOpenBg / HorizontalItemSelectedBg fill the item (pill
// of HorizontalItemRadius, zero: none); HorizontalArrowSize is the
// submenu chevron (zero: none), turned over while open.
HorizontalHeight float32
HorizontalItemPaddingInline float32
HorizontalItemGap float32
HorizontalItemRadius float32
HorizontalFontWeight int
HorizontalItemHoverBg Color
HorizontalItemOpenBg Color
HorizontalItemSelectedBg Color
HorizontalActiveBarHeight float32
HorizontalActiveBarInset float32
HorizontalArrowSize float32
HorizontalArrowGap float32 // between label and chevron
HorizontalArrowTurn bool // turn the chevron over while open
HorizontalBg Color // bar background (zero: ItemBg)
HorizontalBorderColor Color // rule under a light bar (zero: none)
// DarkTheme reports whether Dark() (Defaults theme "dark") switches
// to the Dark* colors; false ignores it (shadcn: a single Sidebar look
// that follows the light / dark theme).
DarkTheme bool
DarkItemBg Color
DarkSubMenuItemBg Color // zero: none
DarkItemColor Color `contrast:"text:DarkItemBg"`
DarkItemHoverBg Color // zero: none
DarkItemHoverColor Color // text of a hovered dark item
DarkItemSelectedBg Color // zero: none
DarkItemSelectedColor Color `contrast:"text:DarkItemSelectedBg"`
PopupBg Color
PopupBorderColor Color // zero: none
PopupRadius float32
PopupShadow []paint.Shadow
PopupPaddingBlock float32 // panel padding
PopupPaddingInline float32
PopupItemHeight float32
PopupItemPaddingInline float32
PopupItemBorderRadius float32
PopupItemColor Color `contrast:"text:PopupBg"`
PopupItemHoverBg Color // zero: none
PopupItemHoverColor Color `contrast:"text:PopupItemHoverBg"`
PopupItemSelectedBg Color // zero: none
PopupItemSelectedColor Color `contrast:"text:PopupItemSelectedBg"`
PopupItemIconColor Color // zero: the label color
PopupIconSize float32
PopupDangerColor Color `contrast:"text:PopupBg"`
PopupDangerHoverBg Color // zero: the regular hover
PopupDangerHoverColor Color `contrast:"text:PopupDangerHoverBg"`
PopupArrowColor Color `contrast:"nontext:PopupBg"` // submenu chevron
PopupArrowSize float32
PopupArrowInset float32 // chevron distance from the item's inline end
PopupGroupTitleHeight float32
PopupGroupTitleFontSize float32
PopupGroupTitleFontWeight int
PopupGroupTitleColor Color `contrast:"text:PopupBg"`
PopupDividerColor Color
// Shortcut column of pop-out submenu items (see DropdownToken).
PopupShortcutColor Color `contrast:"text:PopupBg"`
PopupShortcutFontSize float32
PopupShortcutLetterSpacing float32
PopupShortcutGap float32
}MenuToken styles Menu and the ProLayout navigation. The Dark* fields color the dark sider (and the pop-out submenus of a dark Menu). The Popup* fields style the pop-out submenus of a light Menu (vertical, horizontal, collapsed); they default to the Dropdown look but are the Menu's own, so a Dropdown override does not reach them.
MenubarToken 实验性
type MenubarToken struct {
Alias
Bg Color // bar background (zero: none)
BorderColor Color // outline of the bar (zero: none)
DividerColor Color // rule under the bar (zero: none)
Radius float32 // bar corners
Shadow []paint.Shadow // bar shadow (nil: none)
Height float32 // bar height
PaddingInline float32 // bar padding at both ends
Gap float32 // between triggers
TriggerHeight float32
TriggerPaddingInline float32
TriggerRadius float32
TriggerFontSize float32
TriggerFontWeight int // zero: regular
TriggerColor Color `contrast:"text:Bg"`
TriggerHoverBg Color // zero: none
TriggerHoverColor Color `contrast:"text:TriggerHoverBg"`
TriggerOpenBg Color // trigger of the open menu (zero: none)
TriggerOpenColor Color `contrast:"text:TriggerOpenBg"`
// TriggerFocusBg fills a keyboard-focused trigger instead of the
// focus ring (shadcn focus:bg-accent; zero: the theme focus ring).
TriggerFocusBg Color
TriggerFocusColor Color `contrast:"text:TriggerFocusBg"`
// Drop-down panels: least width, gap under the trigger (shadcn
// sideOffset) and shift along the bar towards the inline start when
// negative (shadcn alignOffset).
PopupMinWidth float32
PopupOffset float32
PopupAlignOffset float32
// Checkable items in the panels: the indicator column at the item's
// inline start (IndicatorWidth wide, labels of the panel move past it).
IndicatorColor Color `contrast:"nontext:@Elevated"`
IndicatorSize float32 // check mark size; the radio dot is half of it
IndicatorWidth float32
}MenubarToken styles Menubar: the bar and its top-level triggers. The drop-down panels are the Dropdown panels of the same theme (Dropdown token); the Indicator* fields add the check mark and radio dot of checkable items there.
MessageToken 实验性
type MessageToken struct {
Alias
ContentBg Color // zero: the status tint (Element)
Color Color `contrast:"text:ContentBg"` // zero: the status color (Element)
PaddingBlock float32
PaddingInline float32
Width float32 // zero: fit the content
Radius float32
BorderColor Color // zero: none (Element: the status border)
Shadow []paint.Shadow
// Top is the default distance from the window edge to the stack
// (MessageRef.Offset overrides it); MarginInline the distance from
// the side for the start / end placements.
Top float32
MarginInline float32
// Gap is the space between stacked messages (antd notification
// list gap = margin 16; EP GAP 16). Sonner stacks keep their own.
Gap float32
CloseColor Color // close button of ShowClose
// ContentFontSize is the message text size (zero: the theme font size;
// shadcn Sonner 13px).
ContentFontSize float32
// Plain style (Element plain): neutral background, only the icon
// in the status color.
PlainBg Color
PlainColor Color `contrast:"text:PlainBg"`
PlainBorderColor Color // zero: none
PlainShadow []paint.Shadow
}MessageToken styles Message (shadcn: Sonner toasts).
ModalToken 实验性
type ModalToken struct {
Alias
ContentBg Color
HeaderBg Color // zero: none
FooterBg Color // zero: none
TitleColor Color `contrast:"text:ContentBg"`
TitleFontSize float32
TitleFontWeight int // zero: regular
TitleLineHeight float32 // zero: the theme line height of TitleFontSize
Padding float32 // inline padding of the panel
PaddingBlock float32
HeaderMarginBottom float32
FooterMarginTop float32
CloseIconColor Color // zero: the icon button default
Radius float32
BorderColor Color // zero: none
MaskBg Color // mask color including opacity
Shadow []paint.Shadow
// Default placement and size (Modal.Width / Top / Centered override).
Width float32 // default width
WidthRatio float64 // nonzero: at least this share of the window width (Element 50%)
Top float32 // distance from the window top
TopRatio float64 // nonzero: Top is this share of the window height (Element 15vh)
Centered bool // centered vertically by default (shadcn)
// Close button: box and glyph size, distance from the panel's top and
// inline-end edges (absolutely placed over the header).
CloseBtnSize float32
CloseIconSize float32
CloseInsetTop float32
CloseInsetEnd float32
// CloseNoHoverBg: no fill under the close button on hover (Element
// headerbtn background transparent, shadcn); CloseHoverColor, when
// set, is the glyph color on hover (Element primary, shadcn
// opacity-100).
CloseNoHoverBg bool
CloseHoverColor Color
// Confirm / MessageBox / Prompt.
ConfirmWidth float32
ConfirmBtnsMarginTop float32 // Ant body: buttons below the text
}ModalToken styles Modal and the Confirm / MessageBox dialogs.
NotificationCenterToken 实验性
type NotificationCenterToken struct {
Alias
TriggerSize float32 // square trigger button
TriggerIconSize float32
PanelWidth float32
PanelMaxHeight float32 // the list scrolls beyond it
HeaderPaddingBlock float32
HeaderPaddingInline float32
HeaderFontSize float32
HeaderFontWeight int // zero: regular
HeaderColor Color `contrast:"text:@Elevated"`
HeaderBorder Color // rule under the header (zero: none)
GroupFontSize float32
GroupColor Color `contrast:"text:@Elevated"`
GroupPaddingBlock float32
ItemPaddingBlock float32
ItemPaddingInline float32
ItemGap float32 // icon to text
ItemHoverBg Color // zero: none
ItemUnreadBg Color // unread items (zero: none)
ItemDivider Color // between items (zero: none)
IconSize float32
TitleFontSize float32
TitleColor Color `contrast:"text:@Elevated"`
UnreadFontWeight int // title weight of unread items
BodyColor Color `contrast:"text:@Elevated"`
TimeFontSize float32
TimeColor Color `contrast:"text:@Elevated"`
UnreadDot Color `contrast:"nontext:@Elevated"`
UnreadDotSize float32
ActionsGap float32
}NotificationCenterToken styles NotificationCenter: the bell trigger with its unread badge and the panel listing the notifications.
NotificationToken 实验性
type NotificationToken struct {
Alias
Bg Color
TitleColor Color `contrast:"text:Bg"`
DescriptionColor Color `contrast:"text:Bg"`
TitleFontSize float32
TitleFontWeight int // zero: regular
TitleLineHeight float32 // zero: the theme line height of TitleFontSize
Width float32
Padding float32 // inline padding (end side)
PaddingInlineStart float32
PaddingBlock float32
Radius float32
BorderColor Color // zero: none
Shadow []paint.Shadow
// DescriptionFontSize and DescriptionLineHeight size the description
// (zero: the theme font size / line height).
DescriptionFontSize float32
DescriptionLineHeight float32
// TitleMarginBottom is the space between title and description,
// IconGap the space between status icon and text, ActionsMarginTop
// the space above Actions.
TitleMarginBottom float32
IconGap float32
ActionsMarginTop float32
// MarginEdge is the distance from the window edges to the cards and
// Gap the space between cards.
MarginEdge float32
Gap float32
// CloseColor colors the close icon; CloseGap is the space between
// text and close button (antd: the title keeps paddingLG 24 from the
// 22px button's end edge, so 2).
CloseColor Color
CloseGap float32
// ProgressColorStart and ProgressColor are the ends of the
// ShowProgress bar gradient (equal: solid), ProgressRail its track
// (zero: none); ProgressInset keeps the bar off the card's rounded
// corners.
ProgressColorStart Color
ProgressColor Color
ProgressRail Color
ProgressInset float32
ProgressHeight float32
// ProgressStatusColor colors the bar with the card's status (EP
// el-progress status) instead of ProgressColor.
ProgressStatusColor bool
}NotificationToken styles Notification (shadcn: Sonner toasts).
Option
type Option func(*options)Option tweaks a theme while it is being constructed.
func Compact
func Compact() OptionCompact reduces control heights (Ant's compact algorithm, simplified).
func Dark
func Dark() OptionDark selects the dark algorithm.
func ElementPlusControls 实验性
func ElementPlusControls() OptionElementPlusControls opts an ElementPlus theme into the Element Plus 2.14.8 control refinements. Other theme constructors ignore this option.
func WithComponents 实验性
func WithComponents(c Components) OptionWithComponents sets component token overrides. Repeated options layer: later non-zero fields win. Array fields merge element by element; a zero element inherits. It is also accepted by Shadcn.
func WithPrimary
func WithPrimary(c Color) OptionWithPrimary overrides the brand color; all derived shades follow.
PageHeaderToken 实验性
type PageHeaderToken struct {
Alias
PaddingBlock float32 // top / bottom padding
PaddingInline float32
PaddingTopBreadcrumb float32 // top padding with a breadcrumb
BreadcrumbGap float32 // breadcrumb to heading
BackGap float32 // back button (or Element divider) to the title
BackIconSize float32
BackIconGap float32 // Element: back arrow to its label
BackColor Color `contrast:"text:@Page"`
TitleFontSize float32
TitleLineHeight float32
TitleFontWeight int // zero: regular
TitleColor Color `contrast:"text:@Page"`
TitleMarginEnd float32 // after the title, subtitle and avatar
SubTitleFontSize float32
SubTitleColor Color `contrast:"text:@Page"`
ContentMarginTop float32
ContentPaddingTop float32
ContentBorderColor Color // line above the content (zero: none)
FooterMarginTop float32
Bg Color // Bordered (ghost=false) background
BorderColor Color // Bordered bottom line (zero: none)
HeadingMarginBlock float32 // above and below the title row (Pro heading-left / extra)
}PageHeaderToken styles PageHeader (Pro Components v3 layout/components/PageHeader, EP page-header).
PaginationToken 实验性
type PaginationToken struct {
Alias
ItemSize float32
ItemSizeSM float32
ItemSizeLG float32 // Size(Large)
ItemSpacing float32 // between the buttons (Ant marginXS)
ItemSpacingSM float32
ItemSpacingLG float32
TotalMarginEnd float32 // extra space after the total text
QuickJumperInputWidth float32 // "go to" box
QuickJumperInputWidthSM float32
ItemBg Color // inactive page (zero: none)
ItemColor Color `contrast:"text:@Page"`
ItemHoverBg Color // zero: none
ItemHoverColor Color
ItemActiveBg Color // zero: none
ItemActiveColor Color `contrast:"text:@Page"`
ItemActiveBorderColor Color // zero: none
ItemActiveColorHover Color // hovered current page (zero: ItemActiveColor)
ItemActiveBorderHover Color // hovered current page outline (zero: ItemActiveBorderColor)
EllipsisColor Color // the ••• of the jump buttons
JumpHoverArrow bool // hovering a ••• jump shows a double chevron
JumpArrowColor Color // that chevron
ItemActiveBgDisabled Color // zero: none
ItemInputBg Color
ItemLinkBg Color
ItemFilledBg Color
ItemFilledColor Color `contrast:"text:ItemFilledBg"`
ItemFilledActiveBg Color
ItemFilledActiveColor Color `contrast:"text:ItemFilledActiveBg"`
Background bool // filled buttons by default (Element background)
PagerCount int // page buttons at most (Element pager-count; 0: Ant's window)
// PageSizesByTen gives the size changer 10/20/30/40/50/100 (Element
// page-sizes) instead of 10/20/50/100 (rc-pagination Options.js).
PageSizesByTen bool
}PaginationToken styles Pagination. The Item* colors are the plain pager (Ant's default; Element without background, shadcn's ghost / outline links); the ItemFilled* colors are the background style (Element's default, Background(true)).
Palette
type Palette struct {
Base Color // colorPrimary / --el-color-primary
Hover Color // pointer over a solid control
Active Color // pressed
Bg Color // lightest tint: selected rows, alert background
BgHover Color // tint under the pointer
Border Color // tinted border (alert, plain button)
BorderHover Color
TextHover Color
Text Color
TextActive Color
// Shades is the full 10-step scale (Ant: color-1..color-10; Element:
// light-9,8,7,5,3, base, dark-2 padded with darker steps).
Shades [10]Color
}Palette is a semantic color with its derived interaction shades. Field names follow Ant Design's map tokens (colorXxxBg, colorXxxHover, ...).
func AntPalette
func AntPalette(c Color, dark bool, bg Color) PaletteAntPalette maps the 10-step scale onto semantic tokens exactly like antd v5 genColorMapToken.
func ElementPalette
func ElementPalette(c Color, dark bool, bg Color) PaletteElementPalette follows Element Plus: light-N = mix(white, c, N*10%), dark-2 = mix(black, c, 20%). In dark mode the "white" is the page bg.
PopoverToken 实验性
type PopoverToken struct {
Alias
Bg Color
TitleColor Color `contrast:"text:Bg"`
Color Color `contrast:"text:Bg"`
TitleFontSize float32
TitleFontWeight int // zero: regular
TitleMarginBottom float32
TitleMinWidth float32
InnerPadding float32
Radius float32
BorderColor Color // zero: none
Shadow []paint.Shadow
Width float32 // default panel width (zero: fits the content)
MouseEnterDelay time.Duration // hover trigger: delay before opening
MouseLeaveDelay time.Duration // hover trigger: delay before closing
// Popconfirm defaults (Popconfirm.Placement / Width / CancelType
// override).
PopconfirmBottom bool // placement "bottom" (Element) instead of "top"
PopconfirmWidth float32 // zero: fits the content
PopconfirmCancelText bool // cancel button of type "text" (Element)
// Arrow: Popover and Popconfirm show an arrow by default (shadcn has
// none). Offset / OffsetNoArrow: panel distance from the trigger with
// and without the arrow.
Arrow bool
Offset float32
OffsetNoArrow float32
}PopoverToken styles Popover and Popconfirm.
ProgressToken 实验性
type ProgressToken struct {
Alias
DefaultColor Color `contrast:"nontext:@Page"` // bar without status or Color
RemainingColor Color // rail (zero: the bar color at 20% over the page, shadcn bg-primary/20)
SuccessColor Color
ExceptionColor Color
WarningColor Color
TextColor Color `contrast:"text:@Page"` // percentage of lines and circles
InnerTextColor Color // TextInside label on the bar
LineHeight float32
LineHeightSM float32
InnerLineHeight float32 // TextInside bar
StepsHeight float32
StepsWidth float32 // one step segment
StepsWidthSM float32
StepsGap float32
CircleSize float32 // circle / dashboard diameter
CircleSizeSM float32
CircleStrokeWidth float32 // zero: 6% of the diameter
InnerFontSize float32
// ShowInfo makes a line bar show its percentage unless HideInfo is
// called; false shows only the bar unless ShowInfo is (shadcn).
ShowInfo bool
}ProgressToken styles Progress.
RadioToken 实验性
type RadioToken struct {
Alias
RadioSize float32
// DotSize is the diameter of the centre dot of a checked radio.
DotSize float32
// DotColor marks a checked radio: the dot (shadcn) or the filled
// circle around a background-colored dot (Ant, Element).
DotColor Color `contrast:"nontext:@Page"`
// DotHoverColor is DotColor under the pointer (antd: a hovered checked
// radio fills with colorPrimaryHover).
DotHoverColor Color
// DotInnerColor is the centre dot on the DotColor fill of a checked
// radio (Ant, Element; antd radioColor colorWhite, Element
// --el-color-white); shadcn draws a DotColor dot instead.
DotInnerColor Color
BorderColor Color `contrast:"nontext:@Page"`
ButtonBg Color
ButtonCheckedBg Color
ButtonColor Color `contrast:"text:ButtonBg"`
ButtonCheckedColor Color `contrast:"text:ButtonCheckedBg"`
ButtonPaddingInline float32
ButtonPaddingInlineSM float32
ButtonSolidCheckedBg Color
ButtonSolidCheckedColor Color `contrast:"text:ButtonSolidCheckedBg"`
// Bordered radio (Border): inline padding before the circle and after
// the label, and the frame color of a checked one.
BorderedPaddingStart float32
BorderedPaddingEnd float32
BorderedCheckedColor Color `contrast:"nontext:@Page"`
}RadioToken styles Radio and the button-style radio group.
RateToken 实验性
type RateToken struct {
Alias
StarColor Color `contrast:"nontext:@Page"` // filled stars
StarBg Color `contrast:"nontext:@Page"` // empty stars
StarBgDisabled Color // empty stars of a disabled rate
StarOutlineColor Color // draws empty stars as outlines in this color (zero: filled StarBg)
StarSize float32
StarSizeSM float32 // Rate.Small
StarSizeLG float32 // Rate.Large
StarGap float32
StarHoverScale float32 // scale of the hovered star (1: none)
Height float32 // zero: the star size + 2, at least 22
HeightSM float32 // Rate.Small (zero: from the star size)
HeightLG float32 // Rate.Large (zero: from the star size)
TextColor Color `contrast:"text:@Page"` // texts after the stars
ScoreColor Color // score after the stars (zero: the star color)
TextColorDisabled Color // texts and score of a disabled rate (zero: unchanged)
}RateToken styles Rate.
ResultToken 实验性
type ResultToken struct {
Alias
IconFontSize float32 // status icon
IconMarginBottom float32
SuccessIconColor Color
InfoIconColor Color
WarningIconColor Color
ErrorIconColor Color
IconGlyphColor Color // mark inside the status circle
TitleFontSize float32
TitleLineHeight float32
TitleColor Color `contrast:"text:@Page"`
SubtitleFontSize float32
SubtitleColor Color `contrast:"text:@Page"`
SubtitleMarginTop float32
SubtitleLineHeight float32 // zero: the theme line height
ExtraMargin float32 // above the actions
PaddingBlock float32
PaddingInline float32
ContentBg Color // Body panel (zero: none)
ContentRadius float32
}ResultToken styles Result.
ScrollbarToken 实验性
type ScrollbarToken struct {
Alias
// TrackInset insets both ends of the track. Zero uses Tango's edge strip.
TrackInset float32
// Thickness and ThumbRadius are logical pixels.
Thickness, ThumbRadius float32
MinThumbLength float32
Thumb, ThumbHover Color
}ScrollbarToken styles the overlay scrollbars used by a scroll container.
SegmentedToken 实验性
type SegmentedToken struct {
Alias
TrackBg Color
TrackPadding float32
ItemColor Color `contrast:"text:TrackBg"`
ItemHoverColor Color
ItemHoverBg Color
ItemActiveBg Color
// ItemSelectedBorder optionally outlines the selected item.
ItemSelectedBorder Color
// FocusOutlineColor overrides the Element Plus keyboard focus outline.
FocusOutlineColor Color
ItemSelectedBg Color
ItemSelectedColor Color `contrast:"text:ItemSelectedBg"`
ItemSelectedShadow []paint.Shadow // the sliding thumb
ItemFontWeight int
ItemPaddingInline float32 // middle and large
ItemPaddingInlineSM float32
}SegmentedToken styles Segmented.
SelectToken 实验性
type SelectToken struct {
Alias
SelectorBg Color
ContentColor Color
ControlRadius float32 // positive: radius used at every size
InputSizing bool // use Input's size-dependent text metrics
ActiveBorderColor Color `contrast:"nontext:SelectorBg"`
HoverBorderColor Color
ActiveOutlineColor Color // focus halo (zero: none)
OptionActiveBg Color // option under the pointer / keyboard cursor
OptionSelectedBg Color
OptionSelectedColor Color `contrast:"text:OptionSelectedBg"`
OptionSelectedFontWeight int
OptionHeight float32
OptionFontSize float32
OptionPadding float32 // horizontal option padding
MultipleItemBg Color // tag of a multiple select
MultipleItemColor Color `contrast:"text:MultipleItemBg"`
MultipleItemHeight float32 // middle size
MultipleItemHeightSM float32
MultipleItemHeightLG float32
ClearBg Color
PopupBg Color
PopupBorderColor Color // panel outline (zero: none)
PopupRadius float32
PopupShadow []paint.Shadow
LoadingColor Color // text of the loading row (remote search)
LoadingIconColor Color // spinner of the loading row
}SelectToken styles Select and the selector family (Cascader, TreeSelect, AutoComplete panels).
ShadcnArg
type ShadcnArg interface {
// contains filtered or unexported methods
}ShadcnArg is accepted by Shadcn: a ShadcnOptions value or a generic Option (Dark, WithPrimary, Compact).
ShadcnOptions
type ShadcnOptions struct {
// Base is the shadcn/ui v4 base color: "neutral" (default), "stone",
// "zinc", "mauve", "olive", "mist" or "taupe". "slate" and "gray" left
// shadcn/ui in v4 and keep their v3 colors.
Base string
// Radius is shadcn's --radius in px (default 10, i.e. 0.625rem). Cards
// use Radius+4, dialogs Radius, buttons and inputs Radius-2, small
// parts Radius-4.
Radius float32
// Primary replaces the near-black (near-white in dark mode) primary
// with a brand color; the focus ring follows it.
Primary Color
Dark bool
Compact bool
// Color layers a shadcn/ui v4 color theme ("blue", "amber" …, see
// ShadcnColors) over the base: primary, secondary, charts and the
// sidebar primary. Unknown names are ignored; Primary wins over it.
Color string
}ShadcnOptions configures Shadcn.
ShadcnVars
type ShadcnVars struct {
Background, Foreground Color
Card, CardForeground Color
Popover, PopoverForeground Color
Primary, PrimaryForeground Color
Secondary, SecondaryForeground Color
Muted, MutedForeground Color
Accent, AccentForeground Color
Destructive, DestructiveForeground Color
Border, Input, Ring Color
Chart [5]Color
Sidebar, SidebarForeground Color
SidebarPrimary, SidebarPrimaryForeground Color
SidebarAccent, SidebarAccentForeground Color
SidebarBorder, SidebarRing Color
Radius float32 // px
Options ShadcnOptions
}ShadcnVars are the values of shadcn/ui's CSS variables for a theme.
func (*ShadcnVars) Vars
func (s *ShadcnVars) Vars(hsl bool) map[string]stringVars returns shadcn/ui's own CSS variables (--background, --foreground, --card, --popover, --primary, --secondary, --muted, --accent, --destructive with their -foreground pairs, --border, --input, --ring, --chart-1 … --chart-5, --sidebar-*, --radius). Colors are CSS colors ("#rrggbb"), the Tailwind v4 convention (var(--primary)); with hsl true they are bare HSL channels ("240 5.9% 10%") for Tailwind v3 projects that write hsl(var(--primary)). CSSVars includes the first form for shadcn themes, so a WebView page using shadcn/ui shares the self-drawn theme.
SkeletonToken 实验性
type SkeletonToken struct {
Alias
BlockRadius float32
GradientFromColor Color
GradientToColor Color
IconColor Color // picture placeholder icon
TitleHeight float32
ParagraphLiHeight float32
ParagraphMarginTop float32 // title to the first paragraph line
ParagraphMarginTopAvatar float32 // the same next to an avatar
ParagraphGap float32 // between paragraph lines
TitleMarginTopAvatar float32 // title offset next to an avatar
AvatarSize float32 // the avatar of Skeleton.Avatar (antd size "large")
// Pulse animates Active blocks by fading them to half opacity and
// back (shadcn animate-pulse) instead of the sweeping highlight band.
Pulse bool
}SkeletonToken styles Skeleton.
SliderToken 实验性
type SliderToken struct {
Alias
RailSize float32
RailBg Color
RailHoverBg Color
TrackBg Color `contrast:"nontext:@Page"`
TrackHoverBg Color
TrackBgDisabled Color
HandleSize float32
HandleSizeHover float32
HandleLineWidth float32
HandleLineWidthHover float32
HandleColor Color `contrast:"nontext:@Page"` // handle ring
HandleActiveColor Color
HandleColorDisabled Color
HandleBg Color
// HandleActiveOutlineColor is the halo around a focused (Ant) or
// hovered / focused (shadcn) handle; zero: none.
HandleActiveOutlineColor Color `zero:"none"`
// HandleActiveOutlineWidth is the width of that halo outside the
// handle (antd outline 6px, shadcn ring-4).
HandleActiveOutlineWidth float32
DotSize float32
DotBorderColor Color // step / mark dot ring off the filled part
}SliderToken styles Slider.
SpinIndicator 实验性
type SpinIndicator intSpinIndicator is the kind of indicator Spin draws (SpinToken.Indicator). Append-only: never reorder or insert.
const (
// SpinDots is antd's four rotating dots.
SpinDots SpinIndicator = iota
// SpinCircular is Element Plus's rotating circular arc (v-loading).
SpinCircular
// SpinIcon spins the theme's Loading icon (shadcn Spinner:
// lucide Loader2).
SpinIcon
)实验性
SpinToken 实验性
type SpinToken struct {
Alias
// Indicator is SpinDots, SpinCircular or SpinIcon.
Indicator SpinIndicator
// DotSize, DotSizeSM and DotSizeLG are the indicator sizes of the
// middle, small and large Spin (antd dotSize / dotSizeSM /
// dotSizeLG; EP --el-loading-spinner-size).
DotSize float32
DotSizeSM float32
DotSizeLG float32
// FullscreenDotSize is the indicator size of a fullscreen loading
// (EP --el-loading-fullscreen-spinner-size; zero: the size of the
// spin).
FullscreenDotSize float32
// Color is the indicator (and description) color.
Color Color
// DescriptionGap is the space between indicator and description.
DescriptionGap float32
DescriptionFontSize float32
// ContainerOpacity is the opacity of content wrapped by a spinning
// Spin / Loading; MaskBg covers it.
ContainerOpacity float64
MaskBg Color
// FullscreenMaskBg and FullscreenColor are the backdrop and the
// indicator color of a fullscreen loading.
FullscreenMaskBg Color
FullscreenColor Color
// ProgressStrokeRatio is the width of the Percent ring as a fraction
// of the indicator size (antd viewSize / 5).
ProgressStrokeRatio float64
}SpinToken styles Spin and Loading (antd es/spin/style, EP loading, shadcn spinner.tsx).
SplitterToken 实验性
type SplitterToken struct {
Alias
SplitTriggerSize float32 // hit width of a bar (the space between panes)
SplitBarSize float32 // thickness of the drag handle (spinner)
SplitBarDraggableSize float32 // length of the drag handle
BarColor Color // the line between panes
BarLineSize float32 // its thickness
BarHoverColor Color // the line under the pointer (zero: BarColor)
BarActiveColor Color // the line while dragging (zero: BarHoverColor)
HandleColor Color // drag handle shown at rest (zero: only on hover)
HandleHoverColor Color `contrast:"nontext:@Page"` // drag handle under the pointer
HandleActiveColor Color `contrast:"nontext:@Page"` // drag handle while dragging
CollapseBg Color // collapse arrow buttons
CollapseHoverBg Color
CollapseColor Color `contrast:"nontext:CollapseBg"`
CollapseRadius float32
CollapseWidth float32 // across the bar
CollapseHeight float32 // along the bar
PreviewColor Color `contrast:"nontext:@Page"` // Lazy mode: the line showing where the bar will land
PreviewSize float32 // its thickness
// WithHandle grip box (shadcn ResizableHandle withHandle).
GripWidth float32 // across the bar
GripHeight float32 // along the bar
GripRadius float32
GripBg Color
GripBorder Color
GripColor Color
GripIconSize float32
}SplitterToken styles Splitter.
StatisticToken 实验性
type StatisticToken struct {
Alias
TitleFontSize float32
TitleFontWeight int // zero: regular
TitleColor Color `contrast:"text:@Page"`
TitleMarginBottom float32
ContentFontSize float32
ContentLineHeight float32
ContentFontWeight int // zero: regular
ContentColor Color `contrast:"text:@Page"`
AffixFontSize float32 // prefix and suffix
}StatisticToken styles Statistic (StatisticCard shares its sizes).
StatusBarToken 实验性
type StatusBarToken struct {
Alias
Height float32
Bg Color // bar background
BorderColor Color // rule above the bar (zero: none)
PaddingInline float32
Gap float32 // between items of one side
ItemPaddingInline float32
ItemGap float32 // icon, text, badge and progress inside an item
ItemRadius float32
ItemFontSize float32
ItemColor Color `contrast:"text:Bg"`
ItemHoverBg Color // zero: none
ItemHoverColor Color `contrast:"text:Bg"`
ItemActiveBg Color // pressed item (zero: none)
IconSize float32
BadgeHeight float32
BadgeFontSize float32
BadgeBg Color
BadgeColor Color `contrast:"text:BadgeBg"`
ProgressWidth float32 // the bar of a determinate progress item
ProgressHeight float32
ProgressTrack Color
ProgressColor Color `contrast:"nontext:ProgressTrack"`
}StatusBarToken styles StatusBar and its StatusBarItem entries: a compact strip at the bottom of a workbench window.
StepsToken 实验性
type StepsToken struct {
Alias
IconSize float32 // icon circle, default size
IconSizeSM float32
NavIconSize float32 // icon circle of the navigation type
NavIconSizeSM float32
IconFontSize float32 // step number
IconFontSizeSM float32
NavIconFontSize float32
NavIconFontSizeSM float32
DotSize float32
DotCurrentSize float32
TitleFontSize float32
TitleFontSizeSM float32
NavTitleFontSize float32
NavTitleFontSizeSM float32
DescriptionFontSize float32
DescriptionMaxWidth float32 // horizontal steps with labels beside the icon
TailWidth float32 // connector thickness
DotTailWidth float32 // connector of horizontal dot steps
ProcessIconBg Color
ProcessIconColor Color `contrast:"text:ProcessIconBg"`
ProcessIconBorderColor Color // zero: none
ProcessTitleColor Color `contrast:"text:@Page"`
ProcessDescriptionColor Color `contrast:"text:@Page"`
FinishIconBg Color
FinishIconColor Color `contrast:"nontext:FinishIconBg"`
FinishIconBorderColor Color // zero: none
FinishTitleColor Color `contrast:"text:@Page"`
FinishDescriptionColor Color `contrast:"text:@Page"`
WaitIconBg Color
WaitIconColor Color `contrast:"text:WaitIconBg"`
WaitIconBorderColor Color // zero: none
WaitTitleColor Color `contrast:"text:@Page"`
WaitDescriptionColor Color `contrast:"text:@Page"`
ErrorIconBg Color
ErrorIconColor Color `contrast:"nontext:ErrorIconBg"`
ErrorIconBorderColor Color // zero: none
ErrorTitleColor Color `contrast:"text:@Page"`
ErrorDescriptionColor Color `contrast:"text:@Page"`
SuccessIconBg Color
SuccessIconColor Color `contrast:"nontext:SuccessIconBg"`
SuccessIconBorderColor Color // zero: none
SuccessTitleColor Color `contrast:"text:@Page"`
SuccessDescriptionColor Color `contrast:"text:@Page"`
TailColor Color // connector after a waiting / current / failed step
FinishTailColor Color
SuccessTailColor Color
// Dots and custom icons (Ant and shadcn; Element uses the icon colors).
DotActiveColor Color `contrast:"nontext:@Page"` // current and finished steps
DotErrorColor Color `contrast:"nontext:@Page"`
DotWaitColor Color
HoverColor Color `contrast:"text:@Page"` // clickable step under the pointer
HoverIconBorderColor Color // outline of a waiting step's icon under the pointer
HoverIconBg Color // icon fill of a waiting / finished step under the pointer (zero: unchanged)
// Variant("outlined"): rings in the status color.
OutlinedIconBg Color // icon fill
OutlinedActiveIconBg Color // icon fill of the current step
OutlinedHoverColor Color // ring and glyph of a hovered waiting / finished step
OutlinedErrorHoverColor Color // ring and glyph of a hovered failed step
SubTitleColor Color `contrast:"text:@Page"`
ProgressColor Color // percent ring of the current step
ProgressTrailColor Color
NavArrowColor Color // chevron between navigation steps
NavInkBarColor Color // underline of the current navigation step (zero: none)
NavBg Color // navigation strip (zero: none)
NavRadius float32
// Inline type: a compact row of small dots with the titles under them.
InlineDotSize float32
InlineDotCurrentSize float32
InlineTitleFontSize float32
InlinePaddingX float32 // inside each step, beside the title
InlinePaddingY float32
InlineHoverBg Color // clickable step under the pointer
InlineRadius float32 // hover background
// Panel type: arrow-shaped panels in a row.
PanelBg Color `contrast:"nontext:@Page"` // waiting and finished steps
PanelActiveBg Color // the current step
PanelErrorBg Color // a failed step
PanelHoverBg Color // clickable step under the pointer
PanelArrowWidth float32 // depth of the arrow point and notch
PanelGap float32 // gap between two panels
PanelPaddingX float32
PanelPaddingY float32
PanelRadius float32 // outer corners of the row
PanelIconSize float32
}StepsToken styles Steps. Per status (Process, Finish, Wait, Error and Success, the "success" finish status) it holds the icon fill, the icon glyph / number color, the icon outline (zero: none), the title and the description colors.
SwitchToken 实验性
type SwitchToken struct {
Alias
TrackHeight float32
TrackHeightSM float32
TrackMinWidth float32
TrackMinWidthSM float32
TrackPadding float32 // gap between track and thumb, middle size
HandleSize float32
HandleSizeSM float32
// Large size (Switch.Large / Size(Large)).
TrackHeightLG float32
TrackMinWidthLG float32
HandleSizeLG float32
// InnerFontSize is the inline prompt text (Texts) inside the track;
// InnerFontSizeLG the same for the large size.
InnerFontSize float32
InnerFontSizeLG float32
// LabelGap separates the outer labels (OuterTexts) from the track;
// LabelFontSize is their font size.
LabelGap float32
LabelFontSize float32
HandleBg Color // thumb when on
HandleOffBg Color // thumb when off
OnBg Color `contrast:"nontext:@Page"` // track when on
OnHoverBg Color
OffBg Color `contrast:"nontext:@Page"` // track when off (its boundary)
OffHoverBg Color
TrackShadow []paint.Shadow // shadcn shadow-xs
HandleShadow []paint.Shadow
}SwitchToken styles Switch.
TableToken 实验性
type TableToken struct {
Alias
HeaderBg Color
HeaderColor Color `contrast:"text:HeaderBg"`
HeaderFontWeight int
HeaderSortActiveBg Color // header of the sorted sortable column (zero: none)
HeaderSortHoverBg Color // header of a hovered sortable column (zero: HeaderSortActiveBg)
HeaderSplitColor Color // short separator between leaf header cells (zero: none)
HeaderBorderRadius float32 // top corners of the header (and the bordered frame)
// HeaderGroupBg is the background of every header cell of a grouped
// (multi-row) header: Element's thead.is-group tint.
HeaderGroupBg Color
BodySortBg Color // body cells of the sorted column (zero: none)
RowHoverBg Color
RowSelectedBg Color // zero: selected rows are not tinted (Element)
RowSelectedHoverBg Color // zero: RowSelectedBg
RowCurrentBg Color // HighlightCurrentRow
RowStripedBg Color // every other row of a Striped table
RowExpandedBg Color // the expanded detail panel, over BgContainer (zero: none)
CellColor Color `contrast:"text:@Page"` // text of plain body cells
BorderColor Color // row lines, cell borders and the outer border
// BottomRadius rounds the bottom corners of a bordered table (antd
// rounds only the top: radius.js); zero: square.
BottomRadius float32
FooterBg Color // summary cells
FooterColor Color `contrast:"text:FooterBg"`
FooterFontWeight int // summary text
// FooterAreaBg / FooterAreaColor style the Footer area below the
// table (antd footerBg colorFillAlter on colorBgContainer, footerColor
// colorTextHeading); shadcn uses it for TableCaption
// (text-muted-foreground). Zero bg: none.
FooterAreaBg Color
FooterAreaColor Color `contrast:"text:FooterAreaBg"`
SorterIdleColor Color // sorter / filter icon when inactive
SorterHoverColor Color // inactive sorter while its header is hovered
// Sorter caret geometry: width and height of each triangle and the
// gap between the up and down carets.
SorterArrowWidth float32
SorterArrowHeight float32
SorterGap float32
// Filter trigger in the header: icon size, idle / hover colors, hover
// background and corner radius; FilterArrow draws Element's arrow
// instead of Ant's funnel.
FilterIconSize float32
FilterIdleColor Color
FilterHoverColor Color
FilterHoverBg Color // zero: none
FilterRadius float32
FilterArrow bool // can only be turned on through Components (false inherits)
FilterDropdownBg Color
FilterDropdownRadius float32
FilterDropdownBorder Color // zero: none (the shadow outlines it)
// Expand / tree toggle. Ant's is a bordered plus/minus box:
// ExpandIconSize is its CSS box, drawn scaled by ExpandIconScale;
// ExpandIconArrow draws Element's rotating arrow instead.
ExpandIconSize float32
ExpandIconScale float32
ExpandIconRadius float32
ExpandIconBg Color
ExpandIconBorder Color
ExpandIconColor Color
ExpandIconHoverColor Color
ExpandIconArrow bool // can only be turned on through Components (false inherits)
// Expanded panel padding (zero: the cell paddings).
ExpandedPaddingBlock float32
ExpandedPaddingInline float32
// IndentSize is the default tree indent per level (antd
// expandable.indentSize 15, EP el-table indent 16).
IndentSize float32
// SelectionPaddingInline is the inline padding of selection cells
// (antd selection.js paddingXS 8; EP .el-table-column--selection .cell
// 14px); the checkbox is centred.
SelectionPaddingInline float32
// Column widths of the selection and expand columns.
SelectionColumnWidth float32
ExpandColumnWidth float32
// SelectionBorderedExtra widens the selection column of a bordered
// table (antd selection.js: + 2 × paddingXS = 16; Element and shadcn
// 0).
SelectionBorderedExtra float32
// SorterTooltip shows the next sort action over a sortable header
// unless ShowSorterTooltip(false) (antd showSorterTooltip default
// true; Element Plus has none).
SorterTooltip bool
// Scroll thumbs of a bounded table (opacity included).
StickyScrollBarBg Color
StickyScrollBarHoverBg Color
StickyScrollBarSize float32
FixedShadowAlpha float64
CellFontSize float32
CellFontSizeMD float32 // Middle size
CellFontSizeSM float32 // Small size
CellLineHeight float32 // line box of cell text
// Cell paddings per size: the plain fields are the default (Ant
// "large") density, MD the Middle size and SM the Small size. Element's
// default density is MD; its Large size uses the plain fields.
CellPaddingBlock float32
CellPaddingInline float32
CellPaddingBlockMD float32
CellPaddingInlineMD float32
CellPaddingBlockSM float32
CellPaddingInlineSM float32
// Fixed row and header heights of a Virtual table (EP el-table-v2
// row-height / header-height); zero: from the paddings.
VirtualRowHeight float32
VirtualHeaderHeight float32
}TableToken styles Table.
Sources (docs/specs/align/2-table-look.md): antd@6.7.0 es/table/style/index.js prepareComponentToken and the style parts (sorter.js, filter.js, expand.js, bordered.js, radius.js, sticky.js); element-plus@2.14.8 theme-chalk/src/table.scss, table-column.scss and common/var.scss $table / $table-padding / $table-cell-padding; shadcn new-york-v4 ui/table.tsx.
TabsToken 实验性
type TabsToken struct {
Alias
CardBg Color // inactive card tab
CardHeight float32
HeaderBg Color // header strip of card tabs (zero: none)
InkBarColor Color `contrast:"nontext:@Page"`
ItemColor Color `contrast:"text:@Page"`
ItemHoverColor Color
ItemSelectedColor Color `contrast:"text:@Page"`
ItemActiveColor Color
TitleFontSize float32
TitleFontSizeSM float32
TitleFontSizeLG float32
HorizontalItemGutter float32
HorizontalItemPadding float32 // vertical padding of a horizontal tab
TitleFontWeight int
LineTrimOuter bool // keep line tab labels at the bar edges
LineBorderWidth float32 // positive override for the baseline thickness
// Sizes (antd cardHeightSM / cardHeightLG, horizontalItemPaddingSM /
// LG, the inline part of cardPadding / cardPaddingSM).
CardHeightSM float32
CardHeightLG float32
HorizontalItemPaddingSM float32
HorizontalItemPaddingLG float32
CardPaddingH float32 // inline padding of a card tab (middle and large)
CardPaddingHSM float32 // … of a small card tab
// ItemSelectedBg and ItemSelectedBorder paint the active trigger of
// the shadcn segmented list (zero border: none).
ItemSelectedBg Color
ItemSelectedBorder Color
// SegmentedList draws the default bar as a segmented track (the
// shadcn TabsList); Variant("line") then switches to line tabs.
// Without it the default bar is already line tabs, so "line" changes
// nothing.
SegmentedList bool
}TabsToken styles Tabs.
TagToken 实验性
type TagToken struct {
Alias
DefaultBg Color // tag without a color
DefaultColor Color `contrast:"text:DefaultBg"`
BorderColor Color // default tag outline (zero: none)
SolidTextColor Color // label on solid preset colors
CloseIconColor Color // zero: the label color
FontWeight int
Radius float32
Height float32
HeightSM float32
HeightLG float32
PaddingInline float32
PaddingInlineSM float32
PaddingInlineLG float32
// Outlined makes "outlined" the default variant (Element's light
// effect: tinted with a border); otherwise tags are "filled" (antd 6
// default, border transparent).
Outlined bool
// DisabledBg, DisabledColor and DisabledBorderColor style a disabled
// tag (antd colorBgContainerDisabled / colorTextDisabled; the border
// of an outlined disabled tag).
DisabledBg Color
DisabledColor Color
DisabledBorderColor Color
// SolidBg is a solid tag without a color (antd colorBgSolid:
// colorTextBase at 100%, 95% in dark mode).
SolidBg Color
// DestructiveBg is the shadcn destructive badge (Color("destructive")):
// bg-destructive, dark:bg-destructive/60 like the destructive button.
DestructiveBg Color
// PlainColor and PlainBorderColor are the label and outline of a tag
// without a color under Effect("plain") (Ant colorText, Element
// primary, shadcn foreground; the theme's plain border).
PlainColor Color `contrast:"text:@Page"`
PlainBorderColor Color
}TagToken styles Tag. The label uses the Alias FontSizeSM (FontSize for large tags outside Element).
TerminalToken 实验性
type TerminalToken struct {
Alias
Background Color // default background (SGR 49)
Foreground Color `contrast:"text:Background"` // default foreground (SGR 39)
Cursor Color `contrast:"nontext:Background"`
CursorText Color `contrast:"text:Cursor"` // the character under a block cursor
Selection Color // selected cells
// Palette holds the 16 ANSI colors (0–7 normal, 8–15 bright); indexed
// colors 16–255 follow the xterm formula. The xterm.js values below
// 4.5:1 on Background are design defaults; HighContrast lifts them.
Palette [16]Color `contrast:"text:Background" spec:"xterm.js default ANSI palette"`
ScrollbarThumb Color // the overlay scrollback scrollbar
ContentFontSize float32 // monospace font size of the cells
}TerminalToken styles the terminal component (ui/terminal). Background, Foreground, Cursor, CursorText, Selection and Palette are the default color scheme; an app can replace them per view with a terminal.Scheme.
Theme
type Theme struct {
Name string
Flavor Flavor
Dark bool
// HighContrast is set on themes built by the HighContrast function.
HighContrast bool
// Icons restyles the icons components draw: the design system's own
// icons in place of the built-in set (AntIcons, ElementIcons,
// LucideIcons) and its stroke width. Nil draws the built-in icons.
// It applies to every icon drawn in the theme's scope, including the
// app's own icon.Icon uses of built-in icons.
Icons *icon.Style
Primary, Success, Warning, Error, Info Palette
// Neutral text.
Text Color // colorText
TextHeading Color
TextSecondary Color
TextTertiary Color
TextQuaternary Color // placeholder / disabled text
TextDisabled Color
TextOnPrimary Color // text on solid colored controls
TextLink Color
TextLinkHover Color
TextLinkActive Color
// Borders and fills.
Border Color // colorBorder (inputs, default buttons)
BorderHover Color // input border under the pointer
BorderSecondary Color // colorBorderSecondary (cards, tables, dividers)
Split Color
Fill Color // strongest neutral fill
FillSecondary Color
FillTertiary Color
FillQuaternary Color
FillAlter Color // table header / zebra rows
// Backgrounds.
BgContainer Color
BgElevated Color // popovers, dropdowns, modals
BgLayout Color
BgSpotlight Color // tooltip background
BgMask Color
BgContainerDisabled Color
BgTextHover Color
BgTextActive Color
// Selection inside menus, selects, trees.
ItemHoverBg Color
ItemSelectedBg Color
ItemSelected Color // text color of selected item
// Focus ring: Ant draws an outer shadow, Element a tinted border,
// shadcn a ring separated from the control by an offset gap.
ControlOutline Color // focused input halo (zero: none)
ControlOutlineWidth float32 // halo width
ControlOutlineOffset float32 // gap between the control edge and the halo (0: halo touches the border)
ControlOutlineError Color // halo of a focused input in error status
ControlOutlineWarning Color // halo of a focused input in warning status
ControlFocusBorder Color // border of a focused input
FocusRing Color // :focus-visible outline of small controls (icon buttons, tags)
FocusOutline Color // :focus-visible ring of buttons, checkboxes, switches
FocusRingWidth float32 // width of the FocusOutline ring
FocusRingOffset float32 // gap between the control and the FocusOutline ring
// Text on special surfaces.
TextOnSpotlight Color // tooltip text on BgSpotlight
TextOnSolid Color // text on solid success/warning/error fills (badges, danger buttons)
// Buttons.
ButtonFontWeight int // label weight (400 regular, 500 medium)
// Horizontal padding, middle size.
//
// Deprecated: use Components.Button.PaddingInline (the field remains the source of the derived default).
ButtonPaddingH float32
// Deprecated: use Components.Button.PaddingInlineSM and Components.Button.PaddingInlineLG (the field remains the source of the derived default).
ButtonPaddingHSM, ButtonPaddingHLG float32
SecondaryBg, SecondaryText Color // "secondary" button / neutral filled controls
SecondaryBgHover Color
// Checkbox / radio label weight.
//
// Deprecated: use Components.Checkbox.LabelFontWeight (the field remains the source of the derived default).
LabelFontWeight int
// Switch thumb.
//
// Deprecated: use Components.Switch.HandleBg (the field remains the source of the derived default).
SwitchHandle Color
// Switch track when off.
//
// Deprecated: use Components.Switch.OffBg (the field remains the source of the derived default).
SwitchOffBg Color
// Deprecated: use Components.Switch.OffHoverBg (the field remains the source of the derived default).
SwitchOffBgHover Color
// Middle-size track height (width follows the design system)
//
// Deprecated: use Components.Switch.TrackHeight (the field remains the source of the derived default).
SwitchHeight float32
// Deprecated: use Components.Switch.TrackMinWidth (the field remains the source of the derived default).
SwitchWidth float32
// Deprecated: use Components.Checkbox.ControlInteractiveSize / Components.Radio.RadioSize (the field remains the source of the derived default).
CheckboxSize float32
CheckboxRadius float32
// Data-entry surfaces (shad2a). ControlBg fills inputs, selects, outline
// buttons and unchecked boxes (shadcn dark: input/30); ControlBgHover is
// the outline button under the pointer. ButtonDangerBg is the solid
// danger button (shadcn dark: destructive/60). SwitchHandleOff is the
// thumb of an off switch (shadcn dark: foreground). RateStar /
// RateStarEmpty color the Rate stars.
ControlBg, ControlBgHover Color
// Deprecated: use Components.Button.DangerBg (the field remains the source of the derived default).
ButtonDangerBg Color
// Deprecated: use Components.Switch.HandleOffBg (the field remains the source of the derived default).
SwitchHandleOff Color
// Deprecated: use Components.Rate.StarColor and Components.Rate.StarBg (the field remains the source of the derived default).
RateStar, RateStarEmpty Color
// Deprecated: use Components.Slider.RailSize (the field remains the source of the derived default).
SliderRailHeight float32
// Cards and overlays.
CardBorder Color // card outline (zero: none)
CardShadow []paint.Shadow
// Card corner radius (zero: the design system default, RadiusLG / Element Radius)
//
// Deprecated: use Components.Card.Radius (the field remains the source of the derived default).
CardRadius float32
PopupBorder Color // dropdown / popover / select panel outline (zero: none)
// Dialog outline (zero: none)
//
// Deprecated: use Components.Modal.BorderColor / Components.Drawer.BorderColor (the field remains the source of the derived default).
ModalBorder Color
TooltipShadow []paint.Shadow // small floating tips (FloatButton, Slider)
// Deprecated: use Components.Table.HeaderColor (the field remains the source of the derived default).
TableHeaderText Color
// Deprecated: use Components.Table.HeaderFontWeight (the field remains the source of the derived default).
TableHeaderWeight int
// Sorter / filter icon when inactive.
//
// Deprecated: use Components.Table.SorterIdleColor (the field remains the source of the derived default).
TableSorterIdle Color
// Opacity of the shadow beside fixed columns.
//
// Deprecated: use Components.Table.FixedShadowAlpha (the field remains the source of the derived default).
TableFixedShadowAlpha float64
// Body cells of the sorted column (zero: no column tint)
//
// Deprecated: use Components.Table.BodySortBg (the field remains the source of the derived default).
TableSortedBg Color
// Header cell of the sorted / hovered sortable column (zero: none)
//
// Deprecated: use Components.Table.HeaderSortActiveBg (the field remains the source of the derived default).
TableHeaderActiveBg Color
// Badge status="default" dot.
//
// Deprecated: use Components.Badge.StatusDefaultColor (the field remains the source of the derived default).
StatusDefault Color
// Deprecated: use Components.Avatar.Bg (the field remains the source of the derived default).
AvatarBg Color
// Deprecated: use Components.Avatar.Color (the field remains the source of the derived default).
AvatarText Color
// Deprecated: use Components.Skeleton.GradientFromColor (the field remains the source of the derived default).
SkeletonBg Color
// Deprecated: use Components.Skeleton.GradientToColor (the field remains the source of the derived default).
SkeletonHighlight Color
// Picture placeholder icon of Skeleton.Image.
//
// Deprecated: use Components.Skeleton.IconColor (the field remains the source of the derived default).
SkeletonIcon Color
// Input addon / Compact addon background.
//
// Deprecated: use Components.Input.AddonBg (the field remains the source of the derived default).
AddonBg Color
// Deprecated: use Components.Input.AddonColor (the field remains the source of the derived default).
AddonText Color
// Text over MarkBg (zero: keep the span color)
//
// Deprecated: use Components.Typography.MarkColor (the field remains the source of the derived default).
MarkText Color
// Typography Mark highlight.
//
// Deprecated: use Components.Typography.MarkBg (the field remains the source of the derived default).
MarkBg Color
Illustration Illustration
// LineHeights maps a font size to its line height in px; nil uses
// Ant's rule (size + 8, rounded to even). shadcn uses Tailwind's
// leading (14 → 20).
LineHeights map[float32]float32
// Shadcn holds the shadcn/ui CSS variable values and the options the
// theme was built with; nil for the other design systems.
Shadcn *ShadcnVars
// Geometry.
Radius, RadiusSM, RadiusLG, RadiusXS float32
ControlHeight float32
ControlHeightSM float32
ControlHeightLG float32
ControlPaddingH float32 // horizontal padding inside inputs/buttons
ControlPaddingHSM float32
LineWidth float32
// Typography (logical px).
// FontFamily is an optional comma-separated list of preferred UI font
// families (e.g. "Inter, PingFang SC, sans-serif"). Empty keeps the
// platform defaults. Explicit monospace text uses its own font chain.
FontFamily string
FontSize, FontSizeSM, FontSizeLG, FontSizeXL float32
Heading [5]float32 // h1..h5
LineHeight float32 // ratio: 22/14 for Ant
FontWeightStrong int
// Spacing scale.
PaddingXXS, PaddingXS, PaddingSM, Padding, PaddingMD, PaddingLG, PaddingXL float32
MarginXS, MarginSM, Margin, MarginMD, MarginLG, MarginXL float32
// Shadows.
Shadow []paint.Shadow // boxShadow: dropdowns, popovers
ShadowSecondary []paint.Shadow // modals, message, notification
ShadowTertiary []paint.Shadow // cards
ButtonShadow []paint.Shadow
InputShadow []paint.Shadow // inputs and selects (shadcn shadow-xs)
// Deprecated: use Components.Button.PrimaryShadow (the field remains the source of the derived default).
PrimaryShadow []paint.Shadow
// Deprecated: use Components.Button.DangerShadow (the field remains the source of the derived default).
DangerShadow []paint.Shadow
// Motion.
DurationFast, DurationMid, DurationSlow time.Duration
// Deprecated: use Components.Layout.ProHeaderBg (the field remains the source of the derived default).
HeaderBg Color
// Deprecated: use Components.Layout.ProHeaderHeight (the field remains the source of the derived default).
HeaderHeight float32
SiderBg Color // dark sider
SiderLightBg Color
// Deprecated: use Components.Layout.SiderWidth (the field remains the source of the derived default).
SiderWidth float32
SiderCollapsed float32
SiderText Color // menu text on dark sider
SiderTextActive Color
// Deprecated: use Components.Menu.DarkSubMenuItemBg / Components.Layout.TriggerBg (the field remains the source of the derived default of Components.Menu.DarkSubMenuItemBg, and of Layout.TriggerBg except in the light Ant theme, which uses antd's #002140).
SiderSubmenuBg Color
SiderItemHoverBg Color
// Deprecated: use Components.Menu.ItemHeight (the field remains the source of the derived default).
MenuItemHeight float32
// Deprecated: use Components.Table.HeaderBg (the field remains the source of the derived default).
TableHeaderBg Color
// Deprecated: use Components.Table.RowHoverBg (the field remains the source of the derived default).
TableRowHoverBg Color
// Deprecated: use Components.Table.CellPaddingBlock (the field remains the source of the derived default).
TablePaddingV float32
// Deprecated: use Components.Table.CellPaddingInline (the field remains the source of the derived default).
TablePaddingH float32
// Segmented control.
SegmentedBg Color // track behind the items
SegmentedSelectedBg Color // sliding thumb under the selected item
// Tabs.
// Header strip of a border-card Tabs (Element fill-color-light)
//
// Deprecated: use Components.Tabs.HeaderBg (the field remains the source of the derived default).
TabsHeaderBg Color
// Components holds the resolved component tokens (components.go).
Components Components
// contains filtered or unexported fields
}Theme is the complete token set read by components.
只有部分成员是稳定的:未标「实验性」的方法和下列以外的字段受兼容性承诺约束。
实验性 实验性成员:Icons、ItemHoverBg、ItemSelectedBg、ItemSelected、ButtonFontWeight、ButtonPaddingH、ButtonPaddingHSM、ButtonPaddingHLG、SecondaryBg、SecondaryText、SecondaryBgHover、LabelFontWeight、SwitchHandle、SwitchOffBg、SwitchOffBgHover、SwitchHeight、SwitchWidth、CheckboxSize、CheckboxRadius、ButtonDangerBg、SwitchHandleOff、RateStar、RateStarEmpty、SliderRailHeight、CardBorder、CardShadow、CardRadius、PopupBorder、ModalBorder、TooltipShadow、TableHeaderText、TableHeaderWeight、TableSorterIdle、TableFixedShadowAlpha、TableSortedBg、TableHeaderActiveBg、StatusDefault、AvatarBg、AvatarText、SkeletonBg、SkeletonHighlight、SkeletonIcon、AddonBg、AddonText、MarkText、MarkBg、Illustration、LineHeights、FontFamily、ButtonShadow、InputShadow、PrimaryShadow、DangerShadow、HeaderBg、HeaderHeight、SiderBg、SiderLightBg、SiderWidth、SiderCollapsed、SiderText、SiderTextActive、SiderSubmenuBg、SiderItemHoverBg、MenuItemHeight、TableHeaderBg、TableRowHoverBg、TablePaddingV、TablePaddingH、SegmentedBg、SegmentedSelectedBg、TabsHeaderBg、Components
func AntDesign
func AntDesign(opts ...Option) *ThemeAntDesign returns the Ant Design v5 token set.
func BuiltinThemes
func BuiltinThemes() []*ThemeBuiltinThemes returns the six built-in themes checked by the contrast tests: Ant Design, Element Plus and shadcn/ui, light and dark.
func ElementPlus
func ElementPlus(opts ...Option) *ThemeElementPlus returns the Element Plus token set.
func HighContrast
func HighContrast(th *Theme) *ThemeHighContrast returns a copy of th in which every required contrast pair of CheckContrast meets WCAG 2.2 AA — text 4.5:1, large text and the non-text parts that identify a control, its state or focus 3:1 — including the design-system defaults the stock themes keep (placeholder and tertiary text, links, input borders, switch tracks, primary and danger fills). Use it when the system asks for increased contrast (docs/accessibility.md, "Increase contrast"); it works on any theme, including WithPrimary and ShadcnOptions variants and app overrides.
The style is kept: geometry, typography, shadows, focus-ring shapes and hues do not change. Each color below its minimum moves the shortest distance (2% steps) towards the theme's own text color, then towards black (white on dark themes), so Ant Design stays Ant blue on white, Element stays Element and shadcn stays neutral — only with darker (in dark mode lighter) ink, borders and fills. A solid fill (Primary, Error) moves as a whole palette (hover and pressed shades follow) and keeps its label color when some shade satisfies both the label and the fill's own contrast on the page. In dark themes the danger color is both text on the page and the fill under a white label, and no red is light enough for one and dark enough for the other; the label then switches to the page's dark ink (TextOnSolid), the usual dark high-contrast arrangement.
Component tokens (Theme.Components) are processed after the global ones, overrides included: colors copied from a moved palette follow it, every field with a contrast tag reaches its minimum (components_contrast.go) and the Alias themes of Theme.For go through HighContrast too.
Exempt pairs (disabled controls, decorative rules) are left alone. The result has HighContrast set and reports label it "<style>-hc".
func Shadcn
func Shadcn(args ...ShadcnArg) *ThemeShadcn returns a shadcn/ui token set. Without arguments it is the light "neutral" theme with a 0.5rem radius; pass ShadcnOptions to pick another base color, radius or brand color, and Dark() (or ShadcnOptions.Dark) for the dark variant:
theme.Shadcn()
theme.Shadcn(theme.Dark())
theme.Shadcn(theme.ShadcnOptions{Base: "zinc", Radius: 8})
theme.Shadcn(theme.ShadcnOptions{Primary: theme.Hex("#2563eb")}, theme.Dark())
Colors follow the published shadcn/ui variables (background, foreground, primary, secondary, muted, accent, destructive, border, input, ring, chart-1..5); th.Shadcn keeps them and CSSVars exports them under the same names.
func (*Theme) ButtonPalette 实验性
func (t *Theme) ButtonPalette(c Color) PaletteButtonPalette derives the interaction palette (hover, active, tints) of an arbitrary button color with t's design-system algorithm, as Button does for the preset and hex colors of Button.Color.
func (*Theme) CSS
func (t *Theme) CSS() stringCSS returns the variables of CSSVars as a ":root" rule.
func (*Theme) CSSVars
func (t *Theme) CSSVars() map[string]stringCSSVars exports the main tokens as CSS custom properties, so a WebView page of the same application can reuse the colors and metrics of the self-drawn UI:
--tango-color-primary, --tango-color-primary-hover, -active, -bg,
-bg-hover, -border, -border-hover, -text, -text-hover, -text-active,
-1 … -10 (also success, warning, error, info)
--tango-color-text, -text-heading, -text-secondary, -text-tertiary,
-text-quaternary, -text-disabled, -text-on-primary
--tango-color-link, -link-hover, -link-active
--tango-color-border, -border-hover, -border-secondary, -split,
-focus-ring
--tango-color-fill, -fill-secondary, -fill-tertiary, -fill-quaternary,
-fill-alter
--tango-color-bg-container, -bg-elevated, -bg-layout, -bg-spotlight,
-bg-mask, -bg-container-disabled, -bg-text-hover, -bg-text-active
--tango-radius, -radius-xs, -radius-sm, -radius-lg (px)
--tango-font-size, -font-size-sm, -lg, -xl, -font-size-heading-1 … -5
--tango-line-height (unitless), --tango-font-weight-strong
--tango-control-height, -sm, -lg, --tango-control-padding-h, -sm,
--tango-line-width
--tango-padding-xxs … -xl, --tango-margin-xs … -xl
--tango-shadow, -shadow-secondary, -shadow-tertiary (box-shadow)
--tango-motion-duration-fast, -mid, -slow (seconds)
--tango-color-scheme ("light" / "dark")
Shadcn themes add shadcn/ui's own names (--background, --primary, --ring, --chart-1 …, --radius; see ShadcnVars.Vars).
Opaque colors are "#rrggbb", translucent ones "rgba(r, g, b, a)". Lengths are logical px (CSS px).
func (*Theme) CSSVarsWith
func (t *Theme) CSSVarsWith(o CSSOptions) map[string]stringCSSVarsWith is CSSVars plus the component tokens selected by o. Component variables are opt-in: CSSVars itself never includes them.
func (*Theme) ColorOf
func (t *Theme) ColorOf(status string) PaletteColorOf returns the palette for a status name ("primary", "success", "warning", "error"/"danger", "info"); unknown names give Primary.
func (*Theme) For 实验性
func (t *Theme) For(k Comp) *ThemeFor returns the theme a component reads: t with the component's Alias applied, or t itself (no allocation) when the component has none.
func (*Theme) LineHeightFor
func (t *Theme) LineHeightFor(size float32) float32LineHeightFor returns the theme-appropriate line height in px for a font size.
func (*Theme) Override 实验性
func (t *Theme) Override(c Components) *ThemeOverride returns a copy of t with c layered over its component overrides and every component token re-derived (scoped themes of ConfigProvider). A HighContrast theme stays high-contrast. t is not modified.
func (*Theme) Overrides 实验性
func (t *Theme) Overrides() ComponentsOverrides returns the component overrides t was built with.
func (*Theme) TextOn
func (t *Theme) TextOn(bg, onDark Color) ColorTextOn returns the color for text or marks drawn on a solid fill bg: onDark (the usual white of solid controls, e.g. TextOnSolid or a component's text token) unless bg is light (Luma above 0.75, such as shadcn's near-white primary in dark mode), where a dark color reads better — the theme's Text when it is dark, else BgContainer (dark themes, whose Text is light).
func (*Theme) UsesElementPlusControls 实验性
func (t *Theme) UsesElementPlusControls() boolUsesElementPlusControls reports whether the Element Plus component refinements are enabled.
TimelineToken 实验性
type TimelineToken struct {
Alias
TailColor Color // the axis between two dots
TailWidth float32 // axis thickness
DotBg Color // fill inside hollow dots and the ring cutting the axis
DotColor Color `contrast:"nontext:DotBg"` // dot of an item without Color
DotSize float32 // dot diameter; also the width of the axis column
DotSizeLG float32 // Element large / icon dot
DotBorderWidth float32 // ring of a hollow dot
DotOffsetTop float32 // dot top inside the item's first line
IconDotSize float32 // DotIcon size (Element: the icon sits in a DotSizeLG dot)
PendingColor Color // spinner of the pending item
ItemPaddingBottom float32 // space under every item but the last
ContentGap float32 // axis to content / label
ContentColor Color `contrast:"text:@Page"`
LabelColor Color `contrast:"text:@Page"` // Ant label on the opposite side
TimeColor Color `contrast:"text:@Page"` // timestamp
TimeFontSize float32
DotOutlined bool // Variant "" draws a ring (Ant); otherwise a filled dot
BusyTailDashed bool // the axis next to a Pending / Loading item is dotted (Ant, shadcn)
// Horizontal timelines (Timeline.Horizontal).
HorizontalGap float32 // axis to the content / label above and below
HorizontalItemPadding float32 // inline padding of every event's texts
}TimelineToken styles Timeline.
TitleBarToken 实验性
type TitleBarToken struct {
Alias
Height float32
Bg Color // bar background
BorderColor Color // rule under the bar (zero: none)
PaddingInline float32
Gap float32 // between icon, menu, center and tools
IconSize float32 // app icon
TitleFontSize float32
TitleFontWeight int // zero: regular
TitleColor Color `contrast:"text:Bg"`
TitleInactiveColor Color // title while the window is not focused
// SystemInset is the room left at the bar's start for window buttons
// the platform draws itself (macOS traffic lights over a hidden title
// bar).
SystemInset float32
// Windows / Linux caption buttons at the bar's end.
ControlWidth float32
ControlIconSize float32
ControlColor Color `contrast:"text:Bg"`
ControlHoverBg Color
ControlActiveBg Color
CloseHoverBg Color
CloseHoverColor Color `contrast:"text:CloseHoverBg"`
CloseActiveBg Color
ControlInactive Color // glyphs while the window is not focused
// macOS-style traffic lights drawn by WindowControls (when the platform
// does not draw them). The colors are the macOS system values.
TrafficSize float32
TrafficGap float32
TrafficInset float32 // from the bar's start to the first light
TrafficClose Color
TrafficMinimize Color
TrafficZoom Color
TrafficInactive Color // all three while the window is not focused
TrafficBorder Color // hairline around each light (zero: none)
TrafficGlyph Color // symbols shown while the pointer is over the group
}TitleBarToken styles TitleBar (the self-drawn title bar of a frameless window) and WindowControls (its minimize / maximize / close buttons).
TooltipToken 实验性
type TooltipToken struct {
Alias
Bg Color
Color Color `contrast:"text:Bg"`
ContentFontSize float32
MaxWidth float32
PaddingBlock float32
PaddingInline float32
MinHeight float32
Radius float32
Shadow []paint.Shadow
Offset float32 // bubble distance from the trigger with the arrow
MouseEnterDelay time.Duration // default hover delay before showing
MouseLeaveDelay time.Duration // default delay before hiding
}TooltipToken styles Tooltip.
TourToken 实验性
type TourToken struct {
Alias
Width float32
PanelPadding float32
Radius float32
Shadow []paint.Shadow
Bg Color
TitleColor Color `contrast:"text:Bg"`
DescriptionColor Color `contrast:"text:Bg"` // description, close button, step counter
TitleFontSize float32
TitleFontWeight int // zero: regular
CounterFontSize float32 // "1 / 3" step counter (Element)
PrimaryBg Color // panel of the primary type
PrimaryColor Color `contrast:"text:PrimaryBg"`
PrimaryDescriptionColor Color `contrast:"text:PrimaryBg"`
IndicatorSize float32 // step dots
IndicatorGap float32
IndicatorColor Color
IndicatorActiveColor Color `contrast:"nontext:Bg"`
PrimaryIndicatorColor Color
PrimaryIndicatorActiveColor Color `contrast:"nontext:PrimaryBg"`
CloseBtnSize float32
CloseIconSize float32
MaskColor Color
HoleRadius float32 // corners of the hole around the target (gap.radius)
// FitContent: Width is a maximum and the panel shrinks to its
// content (antd max-width: fit-content); false: a fixed width.
FitContent bool
HeaderMarginBottom float32 // title row to description
FooterMarginTop float32 // description to indicators / buttons
}TourToken styles Tour.
TransferToken 实验性
type TransferToken struct {
Alias
ListWidth float32
ListHeight float32
ListBorderRadius float32
ListBg Color
ListShadow []paint.Shadow
BorderColor Color `contrast:"nontext:@Page"` // list outline
HeaderHeight float32
HeaderBg Color // zero: none
DividerColor Color // under the header, above the pager
ItemHeight float32
ItemPaddingInline float32 // start of the checkbox
ItemBorderRadius float32
ItemColor Color `contrast:"text:ListBg"`
ItemHoverColor Color // zero: unchanged
ItemHoverBg Color // zero: none
ItemSelectedBg Color // checked item (zero: none)
ItemSelectedHoverBg Color // checked item under the pointer (zero: none)
}TransferToken styles the Transfer lists.
TreeToken 实验性
type TreeToken struct {
Alias
TitleHeight float32 // row height
NodeGap float32 // space under each row
DropdownNodeHeight float32 // TreeSelect panel row height
IndentSize float32 // indent per level
SwitcherSize float32 // width of the expand switcher column
NodeBorderRadius float32 // title highlight (Element fills the whole row, square)
TitleColor Color `contrast:"text:@Page"`
NodeHoverBg Color
NodeSelectedBg Color
NodeSelectedColor Color `contrast:"text:NodeSelectedBg"`
NodeSelectedFontWeight int // title weight of the selected node
SwitcherColor Color `contrast:"nontext:@Page"` // expand caret / chevron
LineColor Color // ShowLine connectors
SearchHighlightColor Color `contrast:"text:SearchHighlightBg"` // Tree.Search match (zero: the title color)
SearchHighlightBg Color // mark behind the match (zero: none)
FilterHighlightColor Color `contrast:"text:@Page"` // VirtualTree.Filter match
DropIndicatorColor Color `contrast:"nontext:@Page"`
DraggingNodeBg Color // title of the node being dragged
// VirtualIndentSize is VirtualTree's indent per level (Element
// el-tree-v2 indent 16, el-tree 18).
VirtualIndentSize float32
SwitcherIconSize float32 // Tree.SwitcherIcon (antd .switcher-icon fontSize 10)
// ShowEmptyText shows Locale.NoData when the tree has no rows
// (Element el-tree__empty-block; antd renders nothing).
ShowEmptyText bool
EmptyTextColor Color `contrast:"text:@Page"`
}TreeToken styles Tree and VirtualTree, and the tree rows of the TreeSelect panel (its trigger follows Select).
TypographyToken 实验性
type TypographyToken struct {
Alias
MarkBg Color // Label.Mark highlight
MarkColor Color `contrast:"text:MarkBg"` // zero: keep the text color
HighlightBg Color // RichText Mark tint (follows the theme's lightness)
HighlightColor Color `contrast:"text:HighlightBg"` // zero: keep the span color
CodeBg Color
CodeBorderColor Color // zero: none
CodeRadius float32
LinkColor Color `contrast:"text:@Page"`
LinkHoverColor Color `contrast:"text:@Page"`
LinkActiveColor Color `contrast:"text:@Page"`
// LinkTextColor, LinkTextHoverColor and LinkTextActiveColor are the
// Link component's own colors at rest, under the pointer and pressed
// (zero: LinkColor / LinkHoverColor / LinkActiveColor). Only Element
// sets them: el-link defaults to regular text, while other links
// (Paragraph expand, copy / edit icons) keep the link color.
LinkTextColor Color `contrast:"text:@Page"`
LinkTextHoverColor Color `contrast:"text:@Page"`
LinkTextActiveColor Color `contrast:"text:@Page"`
LinkFontWeight int // Link text weight
LinkUnderline float32 // Link underline at rest (zero: none)
// LinkHoverUnderline is the Link underline under the pointer (zero:
// none).
LinkHoverUnderline float32
CopyIconColor Color `contrast:"nontext:@Page"`
EditIconColor Color `contrast:"nontext:@Page"`
ActionHoverColor Color // copy / edit icon under the pointer
CopiedIconColor Color // the check shown after copying
}TypographyToken styles the Typography decorations of Text / Link: Code, Mark, links, the copy / edit actions, and the RichText highlight.
UploadToken 实验性
type UploadToken struct {
Alias
TipColor Color `contrast:"text:@Page"`
// Text list.
ItemHeight float32 // row height (the progress bar adds below it)
ItemRadius float32
ItemColor Color `contrast:"text:@Page"`
ItemIconColor Color
ItemHoverBg Color
ItemHoverColor Color // zero: unchanged
ItemBorderColor Color // zero: none
ActionsColor Color `contrast:"nontext:@Page"` // remove button
ErrorColor Color `contrast:"text:@Page"` // failed file, its retry button
ErrorHoverColor Color
SuccessColor Color // done mark / ribbon (zero: none)
ProgressColor Color // filled part of the upload progress bar
ProgressTrailColor Color
// Picture list (listType picture): bordered rows with a thumbnail.
PictureItemHeight float32
PictureThumbSize float32
PictureItemPadding float32
PictureItemRadius float32
PictureItemBorderColor Color `contrast:"nontext:@Page"`
// Picture cards.
PictureCardSize float32
CardRadius float32 // picture cards, card trigger and dragger
PictureCardBg Color
PictureCardBorder Color
PictureCardInnerBg Color // behind a missing thumbnail
MaskBg Color // hover mask over a card
MaskColor Color `contrast:"nontext:MaskBg"` // its action icons
// Card trigger and dragger (dashed outlines).
TriggerBg Color // zero: none
TriggerHoverBg Color // zero: unchanged
TriggerBorderColor Color
TriggerHoverBorderColor Color
TriggerColor Color `contrast:"text:@Page"`
DraggerHeight float32
DraggerBg Color // zero: none
DraggerHoverBg Color // zero: unchanged
DraggerBorderColor Color
DraggerHoverBorderColor Color
DraggerDragBorderColor Color // while files are dragged over
DraggerIconColor Color
DraggerTitleColor Color `contrast:"text:@Page"`
DraggerHintColor Color
DisabledBg Color // zero: none
}UploadToken styles Upload: the file list, picture cards and the dragger.