0651debf9decafade1320e193b4336ec59e5b6ac
RuleDiamond draws the rule-diamond-rule of Heading, Dialog, Result, Card titles and the ornament Divider; Frame draws the inset line with corner diamonds of Card and decorated Dialog. Both snap the diamonds, and the rule's diamond sits on the pixel-aligned line. Snapshots: card (all densities, light and dark) moves the title rule's diamond onto the rule's pixel row, an 8x8 region. Decorated dialog (both densities, light and dark) loses the surface-colored halo under each corner diamond, so the frame line now runs into the diamond as on Card and the panel border is no longer notched at the corners. Heading, Divider and Result render unchanged.
MujicaUI
宫廷哥特风格的 Go 桌面组件库,建立在 MyGo 原生 UI 之上。象牙白与炭黑底色,酒红主色,旧金装饰线,衬线标题。100 个组件,浅深两套主题,三种密度。
界面由 MyGo 在 GPU 上自绘,不使用 HTML、JavaScript 或 WebView。
安装
模块路径暂为 mujicaui,尚未发布到代码托管地址。本地使用:
go mod edit -require=mujicaui@v0.0.0 -replace=mujicaui=/path/to/MujicaUI
要求 Go 1.27.1 与 MyGo v0.2.10(见 兼容表)。
最小示例
即 examples/minimal/main.go,CI 校验两者一致。
package main
import (
"log"
"github.com/egoist/mygo"
"github.com/egoist/mygo/ui"
mujica "mujicaui"
)
type app struct{ name string }
func (a *app) view(c *ui.Context) {
mujica.Use(c, mujica.Settings{Locale: mujica.ZhCN})
ui.Column(c).Fill().Center().Gap(12).Children(func() {
mujica.TextInput(c, &a.name, mujica.TextInputOptions{Placeholder: "姓名"})
if mujica.Button(c, "觐见", mujica.ButtonOptions{}).Clicked() {
log.Println("hello", a.name)
}
})
}
func main() {
a := &app{}
mygo.App.WhenReady(func() {
mygo.NewWindow(mygo.WindowOptions{Title: "Mujica", Width: 480, Height: 320, Content: ui.View(a.view)})
})
if err := mygo.App.Run(); err != nil {
log.Fatal(err)
}
}
主题
每帧开头调用 mujica.Use(c, settings)。Settings 决定模式(System、Light、Dark)、密度(theme.Compact、theme.Default、theme.Comfortable)、语言与文案覆盖。每个窗口各自设置,切换不重置业务状态。
mujica.Use(c, mujica.Settings{
Mode: mujica.Dark,
Density: theme.Compact,
Locale: mujica.ZhCN,
})
k := mujica.Tokens(c) // 当前窗口的颜色
覆盖顺序:组件参数,窗口 Settings,库默认值。系统高对比度、文本缩放、减少动画始终生效。
Gallery
go run ./examples/gallery # 原生窗口
go run ./examples/gallery -web :8080 # 浏览器镜像
浏览器镜像不在浏览器里运行组件。Go 进程用 ui.NewTester 驱动同一个 Gallery 视图,把帧推给页面,再把指针、键盘、输入法和剪贴板事件送回 Go。
文档
许可
MIT。第三方声明见 THIRD_PARTY_NOTICES.md。
Languages
Go
99.7%
CSS
0.2%