Gum.Themes.Template.MonoGame 2026.6.12.1

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Gum.Themes.Template.MonoGame --version 2026.6.12.1
                    
NuGet\Install-Package Gum.Themes.Template.MonoGame -Version 2026.6.12.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Gum.Themes.Template.MonoGame" Version="2026.6.12.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Gum.Themes.Template.MonoGame" Version="2026.6.12.1" />
                    
Directory.Packages.props
<PackageReference Include="Gum.Themes.Template.MonoGame" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Gum.Themes.Template.MonoGame --version 2026.6.12.1
                    
#r "nuget: Gum.Themes.Template.MonoGame, 2026.6.12.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Gum.Themes.Template.MonoGame@2026.6.12.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Gum.Themes.Template.MonoGame&version=2026.6.12.1
                    
Install as a Cake Addin
#tool nuget:?package=Gum.Themes.Template.MonoGame&version=2026.6.12.1
                    
Install as a Cake Tool

Gum.Themes.Template

A starting point for building a new Gum theme. A theme restyles Gum Forms controls by subclassing their V3 default visuals; this project sets up that structure so you can focus on the look instead of the plumbing.

For how a finished theme is consumed (install the package, call Apply), see the user guide: https://docs.flatredball.com/gum/code/styling/themes

What's here

File Role
TemplateTheme.cs Entry point. Apply(GraphicsDevice) registers fonts, sets the shared styling tokens, and installs the visuals as the default Forms templates.
TemplatePalette.cs The one place colors live. Base tokens transcribed from your design's CSS, plus derived hover/press colors computed via Adjust.
TemplateShapes.cs Factory helpers for the Apos.Shapes runtimes (filled rect, stroked border, focus ring, circles). Keeps each visual short.
TemplateTextInputDecoration.cs Shared shape stack + state wiring for TextBox and PasswordBox.
*Visual.cs One per styled control. Each subclasses a Gum.Forms.DefaultVisuals.V3.*Visual, swaps in shapes, and re-wires the state callbacks.
Variants/ Opt-in Rich alternates for a representative control subset (pill + hard-offset-shadow button, rounded box, soft focus glow, dashed-outline panel, circular drop-shadow thumb). Not registered by default — copy the ones matching your design. See Choosing a style below.
Content/Fonts/ Embedded TTFs — a display font, a body font (the multi-font demo), and an icon font for glyphs the others lack.

The .Kni project source-shares every .cs from this project and re-embeds the fonts under its own assembly name — one set of code, two backend packages.

Making your own theme

  1. Clone both projects (.MonoGame and .Kni) and rename TemplateYourTheme: folder names, file names, the <PackageId>, the namespace, and the four Template* type names (TemplateTheme, TemplatePalette, TemplateShapes, TemplateTextInputDecoration). The per-control visual class names (ButtonVisual, etc.) stay the same — the namespace distinguishes them. Don't do a blind global find-replace of the word Template. Three Gum framework identifiers also contain it and must not be renamed: VisualTemplate, DefaultFormsTemplates, and ScrollViewerVisualTemplate. The template deliberately keeps its own element names prefix-free (e.g. "BoxFill", not "TemplateBoxFill"), so the only theme-owned Template tokens are the namespace and those four type names — rename exactly those (a whole-word / case-sensitive replace of each), and leave the framework identifiers alone. Leave <AssemblyName> and <RootNamespace> unset in both csprojs: they default to the project name and must stay equal, because the embedded fonts are looked up by assembly name but live under the root namespace. If those diverge, the build still succeeds but fonts throw FileNotFoundException at runtime — so rename the .csproj files and folders, not just the <PackageId>.
  2. Fill in the palette. Transcribe your design's :root { --bg: …; } block into the base tokens in TemplatePalette. Leave the derived colors computed unless your design pins an exact value. The standard slots are a starting vocabulary, not a cage — add tokens for anything your design defines (extra accents, success/danger, etc.) and delete the ones you don't use.
  3. Swap the fonts. Drop your TTFs into Content/Fonts/, update the <EmbeddedResource> entries in both csprojs, and update FontFamily / IconFontFamily / RegisterBundledFonts in the theme class. Keep the license files alongside the fonts and packed in the csproj. Need static TTFs, not a variable font. KernSmith rasterizes static TTFs; it does not select instances from a variable font (a single Foo[wght].ttf carrying every weight). Many modern Google Fonts ship VF-only — if yours does, fetch its static weight cuts, or approximate with a static sibling family (e.g. the Condensed variant) and map one cut to each Gum style slot (null → Normal, "Bold", etc.). google-webfonts-helper (gwfh.mranftl.com) serves static cuts of VF-only Google fonts. This template ships two families — see Two typefaces.
  4. Restyle the visuals, and as you build out a control, move it from the "stock V3" block in RegisterVisuals up to the styled block.
  5. Verify by running, not just building. Build both .MonoGame and .Kni, then add the theme to the MonoGameGumThemesShowcase sample (a ProjectReference plus one ThemeOption entry) and run it. Apply and font loading only fail at runtime — this is where a font FileNotFoundException from an uneven rename shows.
  6. Publish: flip <GeneratePackageOnBuild> to true in both csprojs.

Choosing a style: flat default, or the Rich variants

The registered visuals are flat and rectangular — no shadows, gradients, bevels, or pills. The Variants/ folder ships Rich alternates (Gum.Themes.Template.Variants) for a representative subset of controls, each demonstrating one technique: a pill button with a flat hard-offset "stacked card" shadow, a rounded check box, a soft focus-ring glow, a dashed-outline list panel, and a circular drop-shadow slider thumb. Each variant copies its flat sibling's palette and state wiring and changes only the shapes, so the two are interchangeable per control.

They're not registered by default — RegisterVisuals carries a commented swap-in line per control. To adopt one, uncomment its line (or register new Variants.YourControlVisual(...)), then delete the variant files you don't want.

For looks beyond the gallery, crib from the closest shipped theme:

  • Drop shadows / soft glows → Bubblegum, plus the "Drop shadows" section of the gum-theming skill (native Apos.Shapes shadow — soft = bump the alpha; hard "stacked card" edge = an opaque color with blur 0).
  • Gradients → ForestGlade.
  • Bevels / inset edges (Win95-style) → Retro95.
  • Pills / large rounded corners → a larger CornerRadius on the rect shapes.
  • NineSlice instead of Apos.Shapes → Editor.

Two typefaces

Styling.Text carries a single family — the display default (FontFamily), which flows to every control. This template also bundles a body family (BodyFontFamily) and opts the typed / list / menu / tooltip visuals into it via TextInstance.Font = TemplateTheme.BodyFontFamily. Collapse to one family by deleting BodyFontFamily, its RegisterBundledFonts lines, and those per-visual opt-ins; add a third family the same way. For a family with no italic cut, point the Italic / BoldItalic style slots at the upright files (as the template does for the body font) so a stray italic request still resolves to a real font.

Conventions worth keeping

  • Read colors from the palette, never inline new Color(...) in a visual. That's what keeps a restyle to one file.
  • Build chrome with TemplateShapes for the common centered/full-parent shapes; build bespoke geometry (e.g. a left-anchored fill bar) inline.
  • Re-wire state callbacks with =, not += — you're replacing the base's behavior (which targets children you detached), not adding to it.
  • See the gum-theming skill for the full set of gotchas (clip-container ordering, HasEvents on wrappers, focus-ring z-order, the cross-runtime packaging pattern).
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2026.6.15.1-preview.2 86 6/15/2026
2026.6.14.1-preview.1 60 6/14/2026
2026.6.12.1 117 6/12/2026
2026.6.6.1 111 6/6/2026
2026.5.31.1 109 6/1/2026