Files
aego/ui/theme/theme.go
T
sanspie 69d19e501f Stage 7: documentation, help, playground; templates, aego new/bootstrap/icons, launcher
Documentation: engine/docs assembles one registry from the script
bindings, the schema, module docs and module-owned script paths; problems
are reported as warnings at build time. Module registries record doc
sources and script module owners; diag.Codes lists every diagnostic code.

Project bootstrap: project.defaultSpace ("2d"/"3d"), EnsureDirs creates
the default folders when the editor opens a project (reported in the
console), prefabs/ is a pipeline root. Native builds drop -trimpath so
binding locations resolve inside native/.

Editor files: create scene/prefab/script from menus, move/rename/duplicate
/delete with undo, script package retargeting on move, open scenes and
script panels follow renames, Save As / Rename Scene prompts, scene
picker, startup scene. Scoped shortcuts fall back to the global command
when disabled; Save As is Ctrl+Shift+S, Save All Ctrl+Alt+S.

Script editor: Go to Implementation (stub → native/ source), host
definitions always resolve to stubs, bracket match/mismatch states,
rainbow brackets (persisted), mono code font (ui-mono atlases, per-command
fonts in draw.List, PushFont/PopFont restored by Mark/Restore).

Tests: langsvc definition/implementation, bracket states, dispatch
fallback, script renames, font stack, editor file-op integration, golden
mono glyph and bracket references; depcheck rule for engine/docs.

Docs pipeline: engine, render2d and script/engine ship their own res/docs;
keyword hover text comes from the registry through manifest.Keywords;
project script symbols join the registry; aego docs export|check|build|
serve, --tool docs in native binaries, aego check --explain; app/docstool
and the tools/gendocs module (goldmark) build the static site.

Playground: app/playground + cmd/aego-playground (js/wasm, 3.3 MB gzip)
compile, highlight and run scripts in the browser; run blocks in the
language docs become examples. engine/builtin/headless is the module set
without render3d; workspace.Config.FS; StubFor/StubPaths; backends and the
script importer drop out of js builds.

VM: one frame pointer in the interpreter loop, direct host calls, panic
recovery once per run instead of per host call (Update2k -19%,
Schedule10k -24% against the previous head). bench-build/compare/profile
run pre-built, pinned, interleaved binaries.

Editor: structural bracket levels and current-block highlight, indent
guides, occurrence highlighting with write marks, multi-format clipboard
(copy/cut/paste assets, paste images as sprites or textures). gl33 probes
a renderable depth format and reports framebuffer failures by stage.

7 E:
- project templates empty/2d/2.5d/3d, app/projects as the single creation path (D148)
- launcher and recent projects (D149)
- orthographic Camera3D and Scene View (D150)
- reference states in the Inspector, ids.Short (D151)
- sceneio remaps node references when loading without KeepIDs (D152)
- exported ComponentRef<T> (D153)
- aego icons via module.Audit (D146)
2026-10-13 01:08:56 +03:00

258 lines
8.5 KiB
Go

package theme
import "aego/core/mathx"
type GutterMetrics struct {
MarkerW float32
NumberPad float32
CodePad float32
}
type CodeTheme struct {
Background mathx.Color
GutterBg mathx.Color
Gutter GutterMetrics
LineNo mathx.Color
LineNoActive mathx.Color
CurrentLine mathx.Color
CurrentBlock mathx.Color
Guide mathx.Color
IndentGuide mathx.Color
IndentGuideActive mathx.Color
GuideRainbow [6]mathx.Color
GuideRainbowActive [6]mathx.Color
BracketMatch mathx.Color
BracketMismatch mathx.Color
Rainbow [6]mathx.Color
Occurrence mathx.Color
OccurrenceDim mathx.Color
OccurrenceWrite mathx.Color
Plain mathx.Color
Keyword mathx.Color
Type mathx.Color
BuiltinType mathx.Color
Function mathx.Color
Method mathx.Color
Field mathx.Color
Property mathx.Color
Param mathx.Color
Local mathx.Color
Const mathx.Color
EnumMember mathx.Color
String mathx.Color
Number mathx.Color
Comment mathx.Color
Attribute mathx.Color
Namespace mathx.Color
Script mathx.Color
Signal mathx.Color
Coroutine mathx.Color
Builtin mathx.Color
Operator mathx.Color
Punctuation mathx.Color
Error mathx.Color
GuideColumn int
}
type Theme struct {
Text mathx.Color
TextDim mathx.Color
TextDisabled mathx.Color
Background mathx.Color
Panel mathx.Color
PanelAlt mathx.Color
Header mathx.Color
Widget mathx.Color
WidgetHot mathx.Color
WidgetDown mathx.Color
Accent mathx.Color
AccentDim mathx.Color
Selection mathx.Color
SelectionDim mathx.Color
Border mathx.Color
Separator mathx.Color
Error mathx.Color
Warn mathx.Color
Ok mathx.Color
DropTarget mathx.Color
Overlay mathx.Color
Tab mathx.Color
TabHot mathx.Color
TabActive mathx.Color
AxisX mathx.Color
AxisY mathx.Color
AxisZ mathx.Color
AxisHot mathx.Color
PlayTint mathx.Color
CardBg mathx.Color
CardHeader mathx.Color
Badge mathx.Color
Unit mathx.Color
BarBg mathx.Color
BarBorder mathx.Color
ButtonHover mathx.Color
ButtonActive mathx.Color
Code CodeTheme
Padding float32
BarHeight float32
RowHeight float32
Spacing float32
Indent float32
ScrollbarW float32
SplitterW float32
TabHeight float32
MenuHeight float32
FontSize float32
Mixed string
}
func Default() Theme {
t := Editor()
t.Text = mathx.ColorRGB8(0xEA, 0xEA, 0xEA)
t.TextDim = mathx.ColorRGB8(0x9A, 0x9A, 0x9A)
t.Panel = mathx.Color{R: 0.02, G: 0.02, B: 0.03, A: 0.78}
t.Widget = mathx.Color{R: 0.16, G: 0.17, B: 0.20, A: 0.95}
t.WidgetHot = mathx.Color{R: 0.24, G: 0.26, B: 0.31, A: 0.95}
t.WidgetDown = mathx.Color{R: 0.10, G: 0.11, B: 0.14, A: 0.95}
t.Accent = mathx.ColorRGB8(0xE0, 0x7B, 0x39)
t.Border = mathx.Color{R: 1, G: 1, B: 1, A: 0.12}
t.Padding = 6
t.RowHeight = 16
t.Spacing = 4
t.FontSize = 13
return t
}
func Mix(a, b mathx.Color, t float32) mathx.Color {
ch := func(x, y float32) float32 {
s := mathx.LinearToSRGB(mathx.Clamp(x, 0, 1))
d := mathx.LinearToSRGB(mathx.Clamp(y, 0, 1))
return mathx.SRGBToLinear(s + (d-s)*t)
}
return mathx.Color{R: ch(a.R, b.R), G: ch(a.G, b.G), B: ch(a.B, b.B), A: 1}
}
func mixAll(bg mathx.Color, cs [6]mathx.Color, t float32) [6]mathx.Color {
var out [6]mathx.Color
for i, c := range cs {
out[i] = Mix(bg, c, t)
}
return out
}
func Code() CodeTheme {
bg := mathx.ColorRGB8(0x1A, 0x1D, 0x22)
white := mathx.Color{R: 1, G: 1, B: 1, A: 1}
blue := mathx.ColorRGB8(0x4D, 0x78, 0xB8)
warm := mathx.ColorRGB8(0xE5, 0x9B, 0x4B)
rainbow := [6]mathx.Color{
mathx.ColorRGB8(0xE5, 0xC0, 0x7B),
mathx.ColorRGB8(0xC6, 0x78, 0xDD),
mathx.ColorRGB8(0x61, 0xAF, 0xEF),
mathx.ColorRGB8(0x98, 0xC3, 0x79),
mathx.ColorRGB8(0xD1, 0x9A, 0x66),
mathx.ColorRGB8(0x56, 0xB6, 0xC2),
}
return CodeTheme{
Background: bg,
GutterBg: mathx.ColorRGB8(0x17, 0x19, 0x1D),
Gutter: GutterMetrics{MarkerW: 1, NumberPad: 1, CodePad: 1},
LineNo: mathx.ColorRGB8(0x5C, 0x61, 0x6B),
LineNoActive: mathx.ColorRGB8(0xB0, 0xB5, 0xBF),
CurrentLine: Mix(bg, white, 0.035),
CurrentBlock: Mix(bg, white, 0.012),
Guide: Mix(bg, white, 0.05),
IndentGuide: Mix(bg, white, 0.07),
IndentGuideActive: Mix(bg, white, 0.16),
GuideRainbow: mixAll(bg, rainbow, 0.18),
GuideRainbowActive: mixAll(bg, rainbow, 0.4),
BracketMatch: mathx.ColorRGB8(0xE5, 0xC0, 0x7B),
BracketMismatch: mathx.ColorRGB8(0xE5, 0x53, 0x4B),
Rainbow: rainbow,
Occurrence: Mix(bg, blue, 0.22),
OccurrenceDim: Mix(bg, blue, 0.12),
OccurrenceWrite: Mix(bg, warm, 0.55),
Plain: mathx.ColorRGB8(0xD8, 0xDB, 0xE2),
Keyword: mathx.ColorRGB8(0xC6, 0x78, 0xDD),
Type: mathx.ColorRGB8(0x56, 0xB6, 0xC2),
BuiltinType: mathx.ColorRGB8(0x56, 0xB6, 0xC2),
Function: mathx.ColorRGB8(0x61, 0xAF, 0xEF),
Method: mathx.ColorRGB8(0x61, 0xAF, 0xEF),
Field: mathx.ColorRGB8(0xE0, 0x6C, 0x75),
Property: mathx.ColorRGB8(0xE0, 0x6C, 0x75),
Param: mathx.ColorRGB8(0xE8, 0xA8, 0x7C),
Local: mathx.ColorRGB8(0xD8, 0xDB, 0xE2),
Const: mathx.ColorRGB8(0xD1, 0x9A, 0x66),
EnumMember: mathx.ColorRGB8(0xD1, 0x9A, 0x66),
String: mathx.ColorRGB8(0x98, 0xC3, 0x79),
Number: mathx.ColorRGB8(0xD1, 0x9A, 0x66),
Comment: mathx.ColorRGB8(0x6B, 0x72, 0x80),
Attribute: mathx.ColorRGB8(0xE5, 0xC0, 0x7B),
Namespace: mathx.ColorRGB8(0xE0, 0x7B, 0x39),
Script: mathx.ColorRGB8(0x56, 0xB6, 0xC2),
Signal: mathx.ColorRGB8(0xF2, 0x9E, 0x74),
Coroutine: mathx.ColorRGB8(0x7F, 0xCF, 0xC9),
Builtin: mathx.ColorRGB8(0xE5, 0x8E, 0xC6),
Operator: mathx.ColorRGB8(0xAB, 0xB2, 0xBF),
Punctuation: mathx.ColorRGB8(0x8B, 0x92, 0x9E),
Error: mathx.ColorRGB8(0xE5, 0x53, 0x4B),
GuideColumn: 100,
}
}
func Editor() Theme {
return Theme{
Text: mathx.ColorRGB8(0xE4, 0xE6, 0xEB),
TextDim: mathx.ColorRGB8(0x93, 0x98, 0xA3),
TextDisabled: mathx.ColorRGB8(0x5C, 0x61, 0x6B),
Background: mathx.ColorRGB8(0x15, 0x17, 0x1B),
Panel: mathx.ColorRGB8(0x1E, 0x21, 0x26),
PanelAlt: mathx.ColorRGB8(0x23, 0x26, 0x2C),
Header: mathx.ColorRGB8(0x18, 0x1A, 0x1E),
Widget: mathx.ColorRGB8(0x2B, 0x2F, 0x36),
WidgetHot: mathx.ColorRGB8(0x36, 0x3B, 0x44),
WidgetDown: mathx.ColorRGB8(0x22, 0x25, 0x2B),
Accent: mathx.ColorRGB8(0xE0, 0x7B, 0x39),
AccentDim: mathx.Color{R: 0.75, G: 0.2, B: 0.05, A: 0.5},
Selection: mathx.ColorRGB8(0x2F, 0x5A, 0x8C),
SelectionDim: mathx.ColorRGB8(0x2A, 0x3A, 0x4F),
Border: mathx.Color{R: 1, G: 1, B: 1, A: 0.08},
Separator: mathx.Color{R: 1, G: 1, B: 1, A: 0.06},
Error: mathx.ColorRGB8(0xE5, 0x53, 0x4B),
Warn: mathx.ColorRGB8(0xE5, 0xB5, 0x4B),
Ok: mathx.ColorRGB8(0x6B, 0xC4, 0x6D),
DropTarget: mathx.Color{R: 0.2, G: 0.35, B: 0.6, A: 0.45},
Overlay: mathx.Color{A: 0.45},
Tab: mathx.ColorRGB8(0x1B, 0x1D, 0x22),
TabHot: mathx.ColorRGB8(0x26, 0x29, 0x30),
TabActive: mathx.ColorRGB8(0x1E, 0x21, 0x26),
AxisX: mathx.ColorRGB8(0xE5, 0x53, 0x4B),
AxisY: mathx.ColorRGB8(0x6B, 0xC4, 0x6D),
AxisZ: mathx.ColorRGB8(0x4B, 0x8B, 0xE5),
AxisHot: mathx.ColorRGB8(0xF5, 0xD7, 0x4B),
PlayTint: mathx.Color{R: 0.88, G: 0.48, B: 0.22, A: 0.85},
CardBg: mathx.ColorRGB8(0x22, 0x25, 0x2B),
CardHeader: mathx.ColorRGB8(0x29, 0x2D, 0x34),
Badge: mathx.ColorRGB8(0x34, 0x38, 0x40),
Unit: mathx.ColorRGB8(0x7A, 0x80, 0x8C),
BarBg: mathx.ColorRGB8(0x1A, 0x1C, 0x21),
BarBorder: mathx.Color{R: 1, G: 1, B: 1, A: 0.06},
ButtonHover: mathx.ColorRGB8(0x30, 0x34, 0x3C),
ButtonActive: mathx.ColorRGB8(0x2F, 0x5A, 0x8C),
Code: Code(),
BarHeight: 28,
Padding: 6,
RowHeight: 22,
Spacing: 2,
Indent: 14,
ScrollbarW: 8,
SplitterW: 4,
TabHeight: 26,
MenuHeight: 24,
FontSize: 14,
Mixed: "—",
}
}