diff --git a/docs/settings.md b/docs/settings.md index f090c8cc..85a904be 100644 --- a/docs/settings.md +++ b/docs/settings.md @@ -4,7 +4,7 @@ The rail's **Settings** (or the command palette) has these sections, for the con **Appearance** is a page of its own, not one of these sections, reached from the sidebar's menu or the palette. It keeps the app in Dark mode, Light mode, or System mode, which follows the device as its appearance changes. Existing preferences stay dark until another mode is chosen. Every palette has a light variant; the chosen palette and custom accent survive mode changes. Light accents use a contrast-safe shade of the same color. The app and its floating control update together; terminals keep the palette's dark variant so CLI programs with their own pale input text remain readable. These preferences are local to the device. -On the same page, **Style** builds the whole app another way, on this device: Liquid Glass (the default), Ledger (real black, flat panes on one-pixel lines, denser controls), Tonal (flat tones of one hue, no lines or shadows) or Bento (Ledger's look with regions and page sections in fixed tiles). Regions, navigation, labels and shortcuts are the same in each. A palette tints any style: Ledger and Bento keep their black ground, taking the palette's accent and a tint in their surfaces; Tonal takes the palette's ground and accent for its whole field. A background image, its opacity and blur, and Follow background apply to Liquid Glass only: in the others those controls are disabled and say so, and the image is kept for going back. Ledger, Tonal and Bento ask for IBM Plex Sans or Rubik and use the system's font on a device that lacks it. +On the same page, **Style** builds the whole app another way, on this device: Liquid Glass (the default), Windows 11 (Fluent Design System with Mica layering and rounded geometry), Ledger (real black, flat panes on one-pixel lines, denser controls), Tonal (flat tones of one hue, no lines or shadows) or Bento (Ledger's look with regions and page sections in fixed tiles). Regions, navigation, labels and shortcuts are the same in each. A palette tints any style: Ledger and Bento keep their black ground, taking the palette's accent and a tint in their surfaces; Tonal takes the palette's ground and accent for its whole field. A background image, its opacity and blur, and Follow background apply to Liquid Glass only: in the others those controls are disabled and say so, and the image is kept for going back. Ledger, Tonal and Bento ask for IBM Plex Sans or Rubik and use the system's font on a device that lacks it. **Background**, on that page: an image of the user's own behind the panels (PNG, JPEG, GIF's first frame, WebP; up to 64 MB and about 120 megapixels, kept in memory at no more than 2560 pixels on its longest side), how opaque the panels over it are, and the strength of its blur, with the window itself as the preview; **Use the default** goes back to the theme's own. **Follow background**, beside the palettes, derives the palette from the image, once per image and off the drawing path: its most common color, darkened, for the ground, its main colors for the wallpaper, its most colorful for the accent, lifted or deepened to read as words, in dark and light; a custom accent still replaces that one. It is kept per device, and with no image, or one gone, the palette last saved applies. The image stays a path on that device and isn't synced: another device has its own files and picks its own. A file gone or unreadable shows the theme's background and says so. The slider reaches every main surface, from fully opaque down to the image alone with a faint edge: the session list, the frame, the side panel, the bars' pieces, the tools dock, cards, terminals, chat, code and diffs. A scrim of the theme's ground fades with it, and glass stops frosting near its lowest. The default stays readable over any image; how readable the low end is, is the user's choice. Menus, dialogs and pop-overs stay as they are, as they float over content. Blur is drawn on the GPU where the window draws, on every platform; a page in a web view is a native surface above the window, so nothing of the background shows behind it. diff --git a/ui/appearance_fluent_test.go b/ui/appearance_fluent_test.go new file mode 100644 index 00000000..58ecc74d --- /dev/null +++ b/ui/appearance_fluent_test.go @@ -0,0 +1,102 @@ +package ui + +import ( + "encoding/json" + "os" + "path/filepath" + "testing" + + "github.com/egoist/mygo/ui" + + "github.com/enowx/enowx/ui/theme" +) + +func TestWindows11FluentStyleIntegration(t *testing.T) { + app := &App{} + app.state = appState{ + UIStyle: "windows-11", + Theme: "windows-11", + ThemeMode: "dark", + } + + app.applyTheme() + + if style := theme.CurrentStyle(); style.ID != "windows-11" { + t.Fatalf("expected active style 'windows-11', got %q", style.ID) + } else { + if style.RadiusControl != 8 { + t.Errorf("expected RadiusControl=8, got %.0f", style.RadiusControl) + } + if style.RadiusCard != 12 { + t.Errorf("expected RadiusCard=12, got %.0f", style.RadiusCard) + } + if style.RadiusPanel != 12 { + t.Errorf("expected RadiusPanel=12, got %.0f", style.RadiusPanel) + } + if style.Family != theme.FluentFontFamily { + t.Errorf("expected Family=%q, got %q", theme.FluentFontFamily, style.Family) + } + } + + curPal := theme.Current() + if curPal.ID != "windows-11" { + t.Fatalf("expected active palette 'windows-11', got %q", curPal.ID) + } + if theme.Hex(curPal.Background) != "#202020" { + t.Errorf("expected dark background #202020, got %s", theme.Hex(curPal.Background)) + } + if theme.Hex(curPal.Accent) != "#60CDFF" { + t.Errorf("expected dark accent #60CDFF, got %s", theme.Hex(curPal.Accent)) + } + + // Switch to light mode + app.setAppearanceMode("light") + lightPal := theme.Current() + if !lightPal.Light { + t.Fatalf("expected light palette, got Light=false") + } + if theme.Hex(lightPal.Background) != "#F3F3F3" { + t.Errorf("expected light background #F3F3F3, got %s", theme.Hex(lightPal.Background)) + } + if theme.Hex(lightPal.Accent) != "#0067C0" { + t.Errorf("expected light accent #0067C0, got %s", theme.Hex(lightPal.Accent)) + } +} + +func TestWindows11StatePersistenceAndFallback(t *testing.T) { + dir := t.TempDir() + stateFile := filepath.Join(dir, "state.json") + + // 1. Save valid Windows 11 state + st := appState{ + UIStyle: "windows-11", + Theme: "windows-11", + ThemeMode: "light", + } + data, err := json.MarshalIndent(st, "", " ") + if err != nil { + t.Fatal(err) + } + if err := os.WriteFile(stateFile, data, 0o600); err != nil { + t.Fatal(err) + } + + loaded := loadState(stateFile) + if loaded.UIStyle != "windows-11" || loaded.Theme != "windows-11" || loaded.ThemeMode != "light" { + t.Fatalf("failed to restore Windows 11 state: %+v", loaded) + } + + // 2. Fallback on corrupt or invalid theme / style IDs + corruptSt := appState{ + UIStyle: "unknown-corrupt-style", + Theme: "unknown-corrupt-theme", + } + s := theme.StyleByID(corruptSt.UIStyle) + if s.ID != theme.LiquidGlass.ID { + t.Errorf("expected fallback to LiquidGlass on unknown style, got %q", s.ID) + } + p := theme.Lookup(corruptSt.Theme, ui.Color{}) + if p.ID != theme.Default.ID { + t.Errorf("expected fallback to Default on unknown palette, got %q", p.ID) + } +} diff --git a/ui/appearance_style.go b/ui/appearance_style.go index e0dbcb36..5e1d3752 100644 --- a/ui/appearance_style.go +++ b/ui/appearance_style.go @@ -12,7 +12,7 @@ import ( func (a *App) stylePicker(c *ui.Context) { ui.Column(c.Key("style-picker")).FillWidth().Gap(theme.S2).Children(func() { ui.Text(c, "Style").FontSize(theme.TextUI).FontWeight(500) - ui.Grid(c).FillWidth().Columns(4).Gap(theme.S3).Children(func() { + ui.Grid(c).FillWidth().Columns(len(theme.Styles)).Gap(theme.S3).Children(func() { current := theme.StyleByID(a.state.UIStyle).ID for _, s := range theme.Styles { if a.styleCard(c.Key(s.ID), s, s.ID == current) && s.ID != current { diff --git a/ui/theme/fluent_palette.go b/ui/theme/fluent_palette.go new file mode 100644 index 00000000..d52059a4 --- /dev/null +++ b/ui/theme/fluent_palette.go @@ -0,0 +1,40 @@ +package theme + +import "github.com/egoist/mygo/ui" + +// Windows11Palette is the Windows 11 Fluent Design System palette: Mica dark #202020 base, +// subtle acrylic layering, and official Windows 11 royal blue / cyan accents. +var Windows11Palette = Palette{ + ID: "windows-11", + Name: "Windows 11", + + Ground: ui.Hex("#202020"), + Wall: [3]ui.Color{light("#0078D4", 0.35), light("#60CDFF", 0.25), light("#1F1F1F", 0.35)}, + Background: ui.Hex("#202020"), + Panel: ui.RGBA(39, 39, 39, 0.85), + Raised: ui.RGBA(255, 255, 255, 0.05), + Sunken: ui.RGBA(0, 0, 0, 0.25), + Frame: ui.RGBA(42, 42, 42, 0.92), + Popover: ui.RGBA(44, 44, 44, 0.98), + composer: ui.RGBA(30, 30, 30, 0.92), + Hover: ui.RGBA(255, 255, 255, 0.08), + Selected: ui.RGBA(255, 255, 255, 0.15), + Dialog: ui.RGBA(44, 44, 44, 0.98), + Border: ui.RGBA(255, 255, 255, 0.08), + BorderStrong: ui.Hex("#8A8A8A"), + Text: ui.Hex("#F5F6FA"), + TextStrong: ui.Hex("#FFFFFF"), + TextSoft: ui.Hex("#D0D2DE"), + Muted: ui.Hex("#B4B6C4"), + Accent: ui.Hex("#60CDFF"), + OnAccent: ui.Hex("#000000"), + Working: ui.Hex("#60CDFF"), + Done: ui.Hex("#6CCB5F"), + Warning: ui.Hex("#FFD60A"), + Error: ui.Hex("#FF6961"), + Idle: ui.Hex("#AEAEB2"), + Add: ui.Hex("#6CCB5F"), + Del: ui.Hex("#FF6961"), + Now: ui.Hex("#60CDFF"), + own: true, +} diff --git a/ui/theme/fluent_test.go b/ui/theme/fluent_test.go new file mode 100644 index 00000000..d82b118c --- /dev/null +++ b/ui/theme/fluent_test.go @@ -0,0 +1,66 @@ +package theme + +import ( + "testing" + + "github.com/egoist/mygo/ui" +) + +func TestFluentTokensStructureAndValues(t *testing.T) { + for _, dark := range []bool{true, false} { + tokens := GetFluentTokens(dark) + + if tokens.FontFamily == "" { + t.Errorf("dark=%v: FontFamily is empty", dark) + } + if tokens.RadiusSmall != 4 || tokens.RadiusControl != 8 || tokens.RadiusCard != 12 || tokens.RadiusPanel != 12 { + t.Errorf("dark=%v: unexpected corner radii: small=%.0f, control=%.0f, card=%.0f, panel=%.0f", + dark, tokens.RadiusSmall, tokens.RadiusControl, tokens.RadiusCard, tokens.RadiusPanel) + } + if tokens.AccentPrimary.A == 0 { + t.Errorf("dark=%v: AccentPrimary is zero", dark) + } + if tokens.SurfaceBackground.A == 0 || tokens.SurfaceCard.A == 0 || tokens.SurfaceFlyout.A == 0 { + t.Errorf("dark=%v: Surface colors have zero alpha", dark) + } + if tokens.StrokeSubtle.A == 0 || tokens.StrokeDefault.A == 0 { + t.Errorf("dark=%v: Stroke colors have zero alpha", dark) + } + if tokens.ElevationRest == "" || tokens.ElevationFlyout == "" || tokens.ElevationDialog == "" { + t.Errorf("dark=%v: Elevation shadows are empty", dark) + } + if tokens.EasingStandard == "" || tokens.DurationFast == "" { + t.Errorf("dark=%v: Motion tokens are empty", dark) + } + } +} + +func TestWindows11StyleLookupAndSurfaces(t *testing.T) { + s := StyleByID("windows-11") + if s.ID != Windows11.ID { + t.Fatalf("expected style ID %q, got %q", Windows11.ID, s.ID) + } + if s.RadiusControl != 8 || s.RadiusCard != 12 || s.RadiusPanel != 12 { + t.Fatalf("unexpected Windows11 style metrics: %+v", s) + } + + pDark := fluentSurfaces(Windows11Palette) + if pDark.Background.A == 0 || pDark.Text.A == 0 || pDark.Accent.A == 0 { + t.Fatalf("dark fluent surfaces returned invalid palette: %+v", pDark) + } + + pLight := fluentSurfaces(lightOf(Windows11Palette, ui.Color{})) + if pLight.Background.A == 0 || pLight.Text.A == 0 || pLight.Accent.A == 0 { + t.Fatalf("light fluent surfaces returned invalid palette: %+v", pLight) + } +} + +func TestWindows11PaletteLookup(t *testing.T) { + p := Lookup("windows-11", ui.Color{}) + if p.ID != "windows-11" { + t.Fatalf("expected 'windows-11', got %q", p.ID) + } + if p.Name != "Windows 11" { + t.Fatalf("expected 'Windows 11', got %q", p.Name) + } +} diff --git a/ui/theme/fluent_tokens.go b/ui/theme/fluent_tokens.go new file mode 100644 index 00000000..8648538e --- /dev/null +++ b/ui/theme/fluent_tokens.go @@ -0,0 +1,170 @@ +package theme + +import ( + "fmt" + + "github.com/egoist/mygo/ui" +) + +// FluentTokens defines the Microsoft Fluent Design System token hierarchy +// for Windows 11 styling across surfaces, strokes, effects, accents, and motion. +type FluentTokens struct { + IsDark bool + + // Surfaces + SurfaceBackground ui.Color + SurfaceCard ui.Color + SurfaceCardHover ui.Color + SurfaceFlyout ui.Color + SurfaceDialog ui.Color + SurfaceMica ui.Color + + // Borders / Strokes + StrokeSubtle ui.Color + StrokeDefault ui.Color + StrokeCard ui.Color + StrokeFocus ui.Color + + // Effects & Elevation + ElevationRest string + ElevationHover string + ElevationFlyout string + ElevationDialog string + MaterialMicaFilter string + + // Accents + AccentPrimary ui.Color + AccentSecondary ui.Color + AccentPressed ui.Color + AccentFocusOutline ui.Color + OnAccent ui.Color + + // Typography + FontFamily string + TextCaption float32 + TextBody float32 + TextSubtitle float32 + TextTitle float32 + + // Corner Radii + RadiusSmall float32 // 4px (badge, checkbox, micro) + RadiusControl float32 // 8px (buttons, inputs) + RadiusCard float32 // 12px (cards, containers, flyouts) + RadiusPanel float32 // 12px (dialogs, main panels) + + // Motion + EasingStandard string + EasingEnterExit string + DurationFast string + DurationNormal string +} + +// FluentFontFamily is the standard Windows 11 font stack with Segoe UI Variable first. +const FluentFontFamily = "Segoe UI Variable, Segoe UI, system-ui, -apple-system, Roboto, sans-serif" + +// FluentDarkTokens holds the Windows 11 Fluent tokens for Dark mode. +var FluentDarkTokens = FluentTokens{ + IsDark: true, + + SurfaceBackground: ui.Hex("#202020"), + SurfaceCard: ui.RGBA(255, 255, 255, 0.05), + SurfaceCardHover: ui.RGBA(255, 255, 255, 0.08), + SurfaceFlyout: ui.RGBA(44, 44, 44, 0.96), + SurfaceDialog: ui.RGBA(44, 44, 44, 0.98), + SurfaceMica: ui.RGBA(32, 32, 32, 0.88), + + StrokeSubtle: ui.RGBA(255, 255, 255, 0.08), + StrokeDefault: ui.RGBA(255, 255, 255, 0.15), + StrokeCard: ui.RGBA(255, 255, 255, 0.08), + StrokeFocus: ui.Hex("#60CDFF"), + + ElevationRest: "0 0 0 1px rgba(255, 255, 255, 0.08)", + ElevationHover: "0 2px 4px rgba(0, 0, 0, 0.20), 0 0 0 1px rgba(255, 255, 255, 0.12)", + ElevationFlyout: "0 8px 16px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.10)", + ElevationDialog: "0 32px 64px rgba(0, 0, 0, 0.40), 0 0 0 1px rgba(255, 255, 255, 0.12)", + MaterialMicaFilter: "blur(30px) saturate(125%)", + + AccentPrimary: ui.Hex("#60CDFF"), + AccentSecondary: ui.Hex("#4CC2FF"), + AccentPressed: ui.Hex("#1CA8F8"), + AccentFocusOutline: ui.Hex("#60CDFF"), + OnAccent: ui.Hex("#000000"), + + FontFamily: FluentFontFamily, + TextCaption: 12, + TextBody: 13, + TextSubtitle: 15, + TextTitle: 18, + + RadiusSmall: 4, + RadiusControl: 8, + RadiusCard: 12, + RadiusPanel: 12, + + EasingStandard: "cubic-bezier(0, 0, 0, 1)", + EasingEnterExit: "cubic-bezier(0.1, 0.9, 0.2, 1)", + DurationFast: "150ms", + DurationNormal: "250ms", +} + +// FluentLightTokens holds the Windows 11 Fluent tokens for Light mode. +var FluentLightTokens = FluentTokens{ + IsDark: false, + + SurfaceBackground: ui.Hex("#F3F3F3"), + SurfaceCard: ui.RGBA(255, 255, 255, 0.70), + SurfaceCardHover: ui.RGBA(255, 255, 255, 0.90), + SurfaceFlyout: ui.RGBA(252, 252, 252, 0.96), + SurfaceDialog: ui.Hex("#FFFFFF"), + SurfaceMica: ui.RGBA(243, 243, 243, 0.88), + + StrokeSubtle: ui.RGBA(0, 0, 0, 0.06), + StrokeDefault: ui.RGBA(0, 0, 0, 0.14), + StrokeCard: ui.RGBA(0, 0, 0, 0.06), + StrokeFocus: ui.Hex("#0067C0"), + + ElevationRest: "0 0 0 1px rgba(0, 0, 0, 0.06)", + ElevationHover: "0 2px 4px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.08)", + ElevationFlyout: "0 8px 16px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.06)", + ElevationDialog: "0 32px 64px rgba(0, 0, 0, 0.24), 0 0 0 1px rgba(0, 0, 0, 0.08)", + MaterialMicaFilter: "blur(30px) saturate(125%)", + + AccentPrimary: ui.Hex("#0067C0"), + AccentSecondary: ui.Hex("#0078D4"), + AccentPressed: ui.Hex("#005A9E"), + AccentFocusOutline: ui.Hex("#0067C0"), + OnAccent: ui.Hex("#FFFFFF"), + + FontFamily: FluentFontFamily, + TextCaption: 12, + TextBody: 13, + TextSubtitle: 15, + TextTitle: 18, + + RadiusSmall: 4, + RadiusControl: 8, + RadiusCard: 12, + RadiusPanel: 12, + + EasingStandard: "cubic-bezier(0, 0, 0, 1)", + EasingEnterExit: "cubic-bezier(0.1, 0.9, 0.2, 1)", + DurationFast: "150ms", + DurationNormal: "250ms", +} + +// GetFluentTokens returns the active token set based on light/dark mode. +func GetFluentTokens(isDark bool) FluentTokens { + if isDark { + return FluentDarkTokens + } + return FluentLightTokens +} + +// ColorRGBAString formats a ui.Color into a standard CSS rgba(r, g, b, a) string. +func ColorRGBAString(c ui.Color) string { + a := float32(c.A) / 255.0 + if a >= 0.999 { + return fmt.Sprintf("#%02X%02X%02X", c.R, c.G, c.B) + } + return fmt.Sprintf("rgba(%d, %d, %d, %.2f)", c.R, c.G, c.B, a) +} diff --git a/ui/theme/light.go b/ui/theme/light.go index c8bd55e5..abc3e09c 100644 --- a/ui/theme/light.go +++ b/ui/theme/light.go @@ -50,6 +50,32 @@ func lightOf(dark Palette, accent ui.Color) Palette { p.darkOf = &dark case Teal.ID: p.Ground, p.Accent = ui.Hex("#E6F0F0"), ui.Hex("#285F63") + case Windows11Palette.ID: + p.Ground = ui.Hex("#F3F3F3") + p.Background = ui.Hex("#F3F3F3") + p.Panel = ui.RGBA(255, 255, 255, 0.70) + p.Frame = ui.RGBA(255, 255, 255, 0.90) + p.Raised = ui.RGBA(0, 0, 0, 0.035) + p.Sunken = ui.RGBA(0, 0, 0, 0.06) + p.Hover = ui.RGBA(0, 0, 0, 0.05) + p.Selected = ui.RGBA(0, 0, 0, 0.10) + p.Dialog = ui.RGBA(252, 252, 254, 0.98) + p.Popover = ui.RGBA(252, 252, 254, 0.98) + p.Border = ui.RGBA(0, 0, 0, 0.12) + p.BorderStrong = ui.Hex("#778497") + p.Text = ui.Hex("#1C2130") + p.TextStrong = ui.Hex("#0C101C") + p.TextSoft = ui.Hex("#475467") + p.Muted = ui.Hex("#526075") + p.Accent = ui.Hex("#0067C0") + p.Working = ui.Hex("#0067C0") + p.Done = ui.Hex("#166B42") + p.Warning = ui.Hex("#855300") + p.Error = ui.Hex("#B3261E") + p.Idle = ui.Hex("#5F6673") + p.Add = ui.Hex("#166B42") + p.Del = ui.Hex("#B3261E") + p.Now = ui.Hex("#0067C0") } if accent.A != 0 { p.Accent = accent diff --git a/ui/theme/palette.go b/ui/theme/palette.go index 426d49aa..3d0363e9 100644 --- a/ui/theme/palette.go +++ b/ui/theme/palette.go @@ -87,13 +87,14 @@ var ( ) // Palettes is every built-in palette. -var Palettes = []Palette{Champagne, Obsidian, Midnight, Copper, Graphite, Teal} +var Palettes = []Palette{Champagne, Obsidian, Midnight, Copper, Graphite, Teal, Windows11Palette} // Default is the palette of who hasn't picked one. var Default = Teal // Accents are the colors a user can give any palette instead of its own. var Accents = []ui.Color{ + ui.Hex("#0067C0"), // Windows 11 royal blue ui.Hex("#0A6FE0"), // blue ui.Hex("#2B7A5B"), // green ui.Hex("#8A5CF6"), // violet diff --git a/ui/theme/style.go b/ui/theme/style.go index 4f5bb7ca..659d9dd9 100644 --- a/ui/theme/style.go +++ b/ui/theme/style.go @@ -53,7 +53,7 @@ var LiquidGlass = Style{ } // Styles is every style, in the order the app offers them. -var Styles = []Style{LiquidGlass, Ledger, Tonal, Bento} +var Styles = []Style{LiquidGlass, Windows11, Ledger, Tonal, Bento} // style is the style in use. var style Style diff --git a/ui/theme/style_fluent.go b/ui/theme/style_fluent.go new file mode 100644 index 00000000..9aee9331 --- /dev/null +++ b/ui/theme/style_fluent.go @@ -0,0 +1,130 @@ +package theme + +import ( + "github.com/egoist/mygo/ui" +) + +// Windows11 is the Windows 11 Fluent Design System style: Mica/Acrylic translucency, +// 8px rounded corners for controls, 12px for cards and panels, Segoe UI Variable, +// and subtle layered borders. +var Windows11 = Style{ + ID: "windows-11", + Name: "Windows 11", + + // Radii: 4px micro, 8px controls, 12px cards and panels + RadiusFull: 8, + RadiusControl: 8, + RadiusTail: 4, + RadiusSmall: 4, + RadiusCard: 12, + RadiusPanel: 12, + + // Spacing and control metrics + BentoGap: 8, + WindowInset: 10, + ControlHeight: 32, + BarHeight: 40, + ScrollWidth: 8, + BarRadius: 8, + RailWidth: 44, + ReadWidth: 760, + HeaderHeight: 52, + RowHeight: 34, + RowTwo: 40, + RowTall: 42, + TabHeight: 28, + Rule: 1, + + S1: 4, S2: 8, S3: 12, S4: 16, S5: 24, S6: 32, + + // Typography: Segoe UI Variable hierarchy + TextLabel: 12, + TextUI: 13, + TextRead: 15, + TextTitle: 18, + + Family: FluentFontFamily, + Scrim: ui.RGBA(0, 0, 0, 0.45), + Hairline: 1, + surfaces: fluentSurfaces, +} + +// fluentSurfaces maps a palette to Windows 11 Fluent Design System layers. +func fluentSurfaces(p Palette) Palette { + t := GetFluentTokens(p.Light == false) + + if p.Light { + p.Ground = t.SurfaceBackground + p.Background = t.SurfaceBackground + p.Panel = t.SurfaceCard + p.Frame = ui.RGBA(249, 249, 249, 0.95) + p.Raised = t.SurfaceCard + p.Sunken = ui.RGBA(0, 0, 0, 0.04) + p.Hover = t.SurfaceCardHover + p.Selected = ui.RGBA(0, 0, 0, 0.08) + p.Dialog = t.SurfaceDialog + p.Popover = t.SurfaceFlyout + p.composer = t.SurfaceDialog + + p.Border = t.StrokeSubtle + p.BorderStrong = t.StrokeDefault + p.floatLine = ui.RGBA(0, 0, 0, 0.10) + + p.Text = ui.Hex("#1A1A1A") + p.TextStrong = ui.Hex("#000000") + p.TextSoft = ui.RGBA(0, 0, 0, 0.62) + p.Muted = ui.RGBA(0, 0, 0, 0.44) + + if p.own { + p.Accent = t.AccentPrimary + p.OnAccent = t.OnAccent + } + + p.Working = t.AccentPrimary + p.Done = ui.Hex("#107C10") + p.Warning = ui.Hex("#9D5D00") + p.Error = ui.Hex("#C42B1C") + p.Idle = ui.Hex("#5F6673") + p.Add = ui.Hex("#107C10") + p.Del = ui.Hex("#C42B1C") + p.Now = t.AccentPrimary + } else { + p.Ground = t.SurfaceBackground + p.Background = t.SurfaceBackground + p.Panel = ui.RGBA(39, 39, 39, 0.90) + p.Frame = ui.RGBA(36, 36, 36, 0.95) + p.Raised = t.SurfaceCard + p.Sunken = ui.RGBA(0, 0, 0, 0.28) + p.Hover = t.SurfaceCardHover + p.Selected = ui.RGBA(255, 255, 255, 0.12) + p.Dialog = t.SurfaceDialog + p.Popover = t.SurfaceFlyout + p.composer = ui.RGBA(30, 30, 30, 0.92) + + p.Border = t.StrokeSubtle + p.BorderStrong = t.StrokeDefault + p.floatLine = ui.RGBA(255, 255, 255, 0.12) + + p.Text = ui.Hex("#FFFFFF") + p.TextStrong = ui.Hex("#FFFFFF") + p.TextSoft = ui.RGBA(255, 255, 255, 0.72) + p.Muted = ui.RGBA(255, 255, 255, 0.54) + + if p.own { + p.Accent = t.AccentPrimary + p.OnAccent = t.OnAccent + } + + p.Working = t.AccentPrimary + p.Done = ui.Hex("#6CCB5F") + p.Warning = ui.Hex("#FCE100") + p.Error = ui.Hex("#FF99A4") + p.Idle = ui.Hex("#AEAEB2") + p.Add = ui.Hex("#6CCB5F") + p.Del = ui.Hex("#FF99A4") + p.Now = t.AccentPrimary + } + + p.OnAccent = contrastInk(p.Accent) + return holdWords(p) +}