Help us shape the future of Go! Take the 2026 Go Developer Survey

MujicaUI

module
v0.0.0-...-e475536 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2026 License: MIT

README

MujicaUI

宫廷哥特风格的 Go 桌面组件库,建立在 MyGo 原生 UI 之上。象牙白与炭黑底色,酒红主色,旧金装饰线,衬线标题。100 个组件,浅深两套主题,三种密度。

界面由 MyGo 在 GPU 上自绘,不使用 HTML、JavaScript 或 WebView。

安装

go get github.com/ELY-Open-Source/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"

	"github.com/ELY-Open-Source/MujicaUI/core"
	"github.com/ELY-Open-Source/MujicaUI/input"
)

type app struct{ name string }

func (a *app) view(c *ui.Context) {
	core.Use(c, core.Settings{Locale: core.ZhCN})
	ui.Column(c).Fill().Center().Gap(12).Children(func() {
		input.TextInput(c, &a.name, input.TextInputOptions{Placeholder: "姓名"})
		if input.Button(c, "觐见", input.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)
	}
}

主题

每帧开头调用 core.Use(c, settings)。Settings 决定模式(System、Light、Dark)、密度(theme.Compact、theme.Default、theme.Comfortable)、语言与文案覆盖。每个窗口各自设置,切换不重置业务状态。

core.Use(c, core.Settings{
	Mode:    core.Dark,
	Density: theme.Compact,
	Locale:  core.ZhCN,
})
k := core.Tokens(c) // 当前窗口的颜色

覆盖顺序:组件参数,窗口 Settings,库默认值。系统高对比度、文本缩放、减少动画始终生效。

go run ./examples/gallery            # 原生窗口
go run ./examples/gallery -web 127.0.0.1:8080 # 浏览器镜像,仅本机

-web 按传入的地址监听;写 :8080 会对所有网络接口开放。浏览器镜像不在浏览器里运行组件。Go 进程用 ui.NewTester 驱动同一个 Gallery 视图,把帧推给页面,再把指针、键盘、输入法和剪贴板事件送回 Go。

文档

许可

MIT。第三方声明见 THIRD_PARTY_NOTICES.md。

Directories

Path Synopsis
Package account holds MujicaUI settings and account management.
Package account holds MujicaUI settings and account management.
Package agent holds MujicaUI agent plans, tool calls and approvals.
Package agent holds MujicaUI agent plans, tool calls and approvals.
Package chart holds MujicaUI general and market charts with their shared frame.
Package chart holds MujicaUI general and market charts with their shared frame.
Package chat holds MujicaUI chat messages, the chat input and chat sessions.
Package chat holds MujicaUI chat messages, the chat input and chat sessions.
Package code holds MujicaUI terminal and code views.
Package code holds MujicaUI terminal and code views.
Package core holds MujicaUI's theme, copy and the types and helpers every category shares.
Package core holds MujicaUI's theme, copy and the types and helpers every category shares.
Package data holds MujicaUI lists, tables, trees, cards and other content and data views.
Package data holds MujicaUI lists, tables, trees, cards and other content and data views.
Package datetime holds MujicaUI date and time pickers and calendar views.
Package datetime holds MujicaUI date and time pickers and calendar views.
Package devtools holds MujicaUI dashboards and developer tools.
Package devtools holds MujicaUI dashboards and developer tools.
Package display holds MujicaUI text, headings, icons, images, avatars and other read-only display.
Package display holds MujicaUI text, headings, icons, images, avatars and other read-only display.
examples
gallery command
Gallery tours MujicaUI natively, or mirrored to a browser with -web.
Gallery tours MujicaUI natively, or mirrored to a browser with -web.
minimal command
Package feedback holds MujicaUI alerts, toasts, progress, empty states and agent ops loaders and motion.
Package feedback holds MujicaUI alerts, toasts, progress, empty states and agent ops loaders and motion.
Package files holds MujicaUI file browsing and collaboration.
Package files holds MujicaUI file browsing and collaboration.
Package finance holds MujicaUI quotes, order entry, trading and market views.
Package finance holds MujicaUI quotes, order entry, trading and market views.
Package git holds MujicaUI version control views: diffs, commits, branches and merges.
Package git holds MujicaUI version control views: diffs, commits, branches and merges.
Package icons embeds the Lucide icons MujicaUI draws.
Package icons embeds the Lucide icons MujicaUI draws.
Package input holds MujicaUI buttons, text fields, choices, form controls and general essentials.
Package input holds MujicaUI buttons, text fields, choices, form controls and general essentials.
Package internal holds drawing shared by MujicaUI components.
Package internal holds drawing shared by MujicaUI components.
snaptest
Package snaptest compares rendered views with the PNG goldens in testdata/snapshots.
Package snaptest compares rendered views with the PNG goldens in testdata/snapshots.
Package layout holds MujicaUI app shells, panes, toolbars and other desktop layout.
Package layout holds MujicaUI app shells, panes, toolbars and other desktop layout.
Package media holds MujicaUI audio, video, image and device controls.
Package media holds MujicaUI audio, video, image and device controls.
Package messaging holds MujicaUI messaging, calls and mail.
Package messaging holds MujicaUI messaging, calls and mail.
Package navigation holds MujicaUI tabs, menus, breadcrumbs, pagination and other navigation.
Package navigation holds MujicaUI tabs, menus, breadcrumbs, pagination and other navigation.
Package overlay holds MujicaUI dialogs, drawers, popovers, tooltips and menus that float above the view.
Package overlay holds MujicaUI dialogs, drawers, popovers, tooltips and menus that float above the view.
Package project holds MujicaUI project management: issues, boards and time tracking.
Package project holds MujicaUI project management: issues, boards and time tracking.
Package theme holds MujicaUI's design tokens: colors, type, metrics and motion.
Package theme holds MujicaUI's design tokens: colors, type, metrics and motion.
tools
site command
Command site builds the static MujicaUI documentation site into site/dist.
Command site builds the static MujicaUI documentation site into site/dist.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL