Skip to content
IzzyBlazor

Enter all results ↑ ↓ move Esc close

ThemeScope

Since 0.1.0-alpha.22
Themes part of a page: its brand color, density, shape or color scheme.

Themes part of a page, in a div: a section in another brand, a denser panel, an inverse band.

A panel in another theme

Put the content inside a ThemeScope, and set any of Brand, a built-in Gray, Radius, Density, Preset (shape, density and depth) and ColorScheme, which here can also be Inverse. What it doesn't set comes from the theme around it.

Static

Preview

The page's theme

Standard, blue, medium radius.

Draft

In a ThemeScope

Compact, rose, small radius.

Draft

Code

Usage.razor
@* A ThemeScope themes what's inside: here a compact, rose, small-radius panel next to one in the
   page's theme. What it doesn't set comes from the theme around it. *@
<Grid Columns="new() { Base = 1, Sm = 2 }" Gap="4" Grow>
    <Card Title="The page's theme" Description="Standard, blue, medium radius.">
        <Row Gap="2" Wrap Align="Align.Center">
            <Button>Approve</Button>
            <Button Variant="ButtonVariant.Soft">Comment</Button>
            <Badge Accent="Accent.Primary">Draft</Badge>
        </Row>
    </Card>
    <ThemeScope Density="ThemeDensity.Compact" Brand="rose" Radius="ThemeRadius.Sm">
        <Card Title="In a ThemeScope" Description="Compact, rose, small radius.">
            <Row Gap="2" Wrap Align="Align.Center">
                <Button>Approve</Button>
                <Button Variant="ButtonVariant.Soft">Comment</Button>
                <Badge Accent="Accent.Primary">Draft</Badge>
            </Row>
        </Card>
    </ThemeScope>
</Grid>

Add this example to a page with the izzy CLI:

bash
izzy add component ThemeScope --at <file>:<line>

Details

It takes Brand, a built-in Gray, Radius, Density, Preset (shape, density and depth only) and ColorScheme; what it doesn't set comes from around it. Fonts, HeadingWeight, Scrollbars and a hex Gray are the app's, on IzzyTheme. For one exact value, use CSS: its variable in your stylesheet, or Style and Class here (izzyblazor.com/docs/theming/tokens).

Mode support

What works in each mode, ThemeScope
FeatureStaticInteractive
EverythingYesYes

Static: static server-side rendering, with no circuit and no WebAssembly. Interactive: Server, WebAssembly or Auto.

Accessibility

  • It renders a div around its content, with nothing people interact with.
  • A hex Brand is adjusted until text on it, and the accent as text, reach 4.5:1 contrast.

Parameters

ThemeScope parameters
PropTypeDefault
ColorSchemeThe color scheme here: ColorScheme.Light, ColorScheme.Dark, or ColorScheme.Inverse for the opposite of the page's.ColorScheme?
ChildContentThe part of the page to theme.RenderFragment?Required
ClassClasses for the div, such as one that sets CSS variables in your stylesheet.string?
StyleInline style for the div, such as "--ib-card-padding: 1rem".string?
PresetThe starting set of defaults: density, shape and type, and a default accent and gray, which the other settings override.ThemePreset?
BrandThe brand color, over the preset's: a hex color ("#0a7d5a"), from which the fill, the text on it, the accent as text and the soft tint are derived in light and dark, each pair at AA (see BrandPalette); or a built-in, hand-tuned one: blue (the default), ink (monochrome), indigo, violet, teal, green, rose.string?
GrayThe grays (page, surfaces, fills, borders and text), over the preset's: a built-in set, neutral (the default), slate (cool) or stone (warm paper).string?
RadiusThe radius scale, over the preset's.ThemeRadius?
DensityControl heights, table rows and card padding, over the preset's.ThemeDensity?
ChartPaletteThe colors charts, gauges and the scheduler use, unless a chart sets its own ChartPalette.ThemeChartPalette?

See also

  • IzzyTheme: sets the preset, brand color, fonts and color scheme on the server.
  • ColorSchemeSwitch: lets the user pick System, Light or Dark.

Connection lost

Rejoining the server…