UI Toolbox logoUI Toolbox
Support

GlassPanel

A GlassPanel is a frosted glass container. It blurs the UI behind it, then lays a translucent tint and a light border on the blur. Use it for a pause menu over the game, a HUD card or an item wheel: the player still sees what is behind the panel, but the text on the panel stays easy to read. The GlassDemo example has the three tints and a pause menu.

Three glass panels over moving shapes: Light, Dark and AccentThree glass panels over moving shapes: Light, Dark and Accent

<tb:GlassPanel tint="Dark" blur="12">
    <ui:Label text="Paused" />
</tb:GlassPanel>
var glass = new GlassPanel { Blur = 12, Tint = GlassTint.Dark };
glass.Add(new Label("Paused"));
Member Description
Blur (blur) The blur radius in pixels (12). 0 shows the UI behind the panel sharp, as clear glass.
Tint (tint) The color of the glass: Light (frosted glass in the frost of the theme, clear by default; the default), Dark (smoked glass, for text on a bright scene) or Accent (glass in a color, for a selected card).

Glass windows

A window can be glass too. The built-in GlassWindowTemplate chrome blurs the wallpaper and the windows behind the window. Each window chooses its chrome, so glass windows and default windows can share a workspace. The WorkspaceDemo example has three glass windows and one default window.

<tb:Window
    id="about"
    title="About"
    template-uri="UIToolbox/Templates/GlassWindowTemplate" />

A tab group made from a glass window is glass too: the group takes the chrome of the window that you drop on, and its tab strip and pages are tints on the blur.

The blur is 8 pixels, so the windows behind show as frosted shapes. For a stronger frost, set backdrop-filter in your style sheet. A large blur leaves only the colors of the wallpaper.

.tb-window.tb-window--glass {
    backdrop-filter: blur(16px);
}

The theme sets the frost and the border of glass windows (--tb-color-glass-frost, --tb-color-glass-border). See Custom chrome templates and Theme variables.

A glass toolbar

The toolbar of a workspace takes glass from USS alone. Over a wallpaper, a glass bar above a solid toolbar looks odd, so the WorkspaceDemo example gives its toolbar the tint and the blur of its dark GlassPanel bar. The two rows read as one frosted header. The workspace background is clear in that example, so the toolbar blurs the wallpaper.

.my-desktop .tb-toolbar {
    background-color: rgba(10, 12, 16, 0.45);
    backdrop-filter: blur(10px);
    border-bottom-color: rgba(255, 255, 255, 0.18);
}

Glass is clear in every theme. The theme sets the frost, the tint that lies on the blur, with one variable. A game theme tints or clears all glass by setting it:

.tb-workspace { --tb-color-glass-frost: rgba(40, 120, 255, 0.12); }

The Dark and Accent tints come from --tb-color-glass-dark and --tb-color-glass-accent, and the rim of the panel from --tb-color-glass-border and --tb-color-glass-rim.

Styling

Class Element
tb-glass The panel: padding, a rounded corner and a border that is lighter at the top.
tb-glass--light On the panel when Tint is Light. The tint is --tb-color-glass-frost.
tb-glass--dark On the panel when Tint is Dark. The tint is --tb-color-glass-dark.
tb-glass--accent On the panel when Tint is Accent. The tint is --tb-color-glass-accent.

A class of your own changes the look. The blur comes from Blur, not from the class:

.my-glass {
    background-color: rgba(255, 120, 200, 0.2);
    border-top-color: rgba(255, 255, 255, 0.7);
    border-radius: 16px;
}