Skip to content

Commit 43d45f4

Browse files
committed
feat(theme): 菜单项高亮背景圆角 + 翻页页码/箭头颜色可配
复盘主题能力时补两处缺口(schema/resolve 早已就绪,仅渲染层未消费): - 菜单项 hover 高亮背景接通 views.menu.item.border.radius(hover 可单独覆盖), 不再恒为直角矩形(viewbox_menu.go) - 翻页页码与启用态箭头颜色接通 views.footer_bar.color(FooterBar.TextColor), 未配则零回归(页码=PreeditBar.TextColor、启用箭头=Index.BgColor、禁用箭头暗色) 均默认零回归(主题不配即维持原观感)。
1 parent 64f7d38 commit 43d45f4

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

wind_input/internal/ui/viewbox_build_vertical.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,26 @@ func (r *Renderer) buildPager(
2323
return nil, nil, nil
2424
}
2525

26-
pageFS := r.resolvedViews.FooterBar.FontSize // 页码/翻页字号 = base + views.footer_bar.font_size 偏移(无派生魔法)
27-
arrowSz := maxF(8*scale, pageFS*0.65) // chevron 视觉尺寸按字号比例(绘制内禀几何,非主题字号配置)
26+
fb := r.resolvedViews.FooterBar
27+
pageFS := fb.FontSize // 页码/翻页字号 = base + views.footer_bar.font_size 偏移(无派生魔法)
28+
arrowSz := maxF(8*scale, pageFS*0.65) // chevron 视觉尺寸按字号比例(绘制内禀几何,非主题字号配置)
2829
arrowW := int(arrowSz + 6*scale*2 + 0.5)
2930
lineW := 1.5 * scale
3031
canUp := page > 1
3132
canDown := page < absTotal
3233

34+
// 翻页颜色可配(views.footer_bar.color):页码 + 启用态箭头取 FooterBar.TextColor,
35+
// 未配则零回归(页码=PreeditBar.TextColor、启用箭头=Index.BgColor);禁用箭头恒为暗色(PreeditBar.TextColor)。
36+
pageColor := r.resolvedViews.PreeditBar.TextColor
37+
if fb.TextColor != nil {
38+
pageColor = fb.TextColor
39+
}
40+
3341
mkBtn := func(glyph GlyphKind, enabled, hovered bool) *View {
3442
clr := r.resolvedViews.Index.BgColor
43+
if fb.TextColor != nil {
44+
clr = fb.TextColor
45+
}
3546
if !enabled {
3647
clr = r.resolvedViews.PreeditBar.TextColor
3748
}
@@ -55,7 +66,7 @@ func (r *Renderer) buildPager(
5566
}
5667
children = append(children, &View{
5768
Text: txt,
58-
TextStyle: TextStyle{FontSize: pageFS, Color: r.resolvedViews.PreeditBar.TextColor},
69+
TextStyle: TextStyle{FontSize: pageFS, Color: pageColor},
5970
})
6071
}
6172
d := mkBtn(GlyphChevronRight, canDown, hoverPageBtn == "down")

wind_input/internal/ui/viewbox_menu.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ func buildMenuTree(items []MenuItem, hoverIdx, submenuIdx int, hasChecked, hasCh
123123
}
124124
if isHovered && rmv.Item.Hover != nil && rmv.Item.Hover.BgColor != nil {
125125
row.Background = Fill{Color: rmv.Item.Hover.BgColor}
126+
// 菜单项高亮背景圆角:默认取 views.menu.item.border.radius,hover 显式 radius 则覆盖。
127+
hr := rmv.Item.BorderRadius.Scaled(scale)
128+
if hov := rmv.Item.Hover.BorderRadius.Scaled(scale); hov > 0 {
129+
hr = hov
130+
}
131+
row.Border = Border{Radius: hr}
126132
}
127133

128134
if hasChecked {

0 commit comments

Comments
 (0)