Skip to main content

BnTheme

Namespace: BlazorNative.Components

A pair of background colors, handed down the tree as a cascading value.

public sealed record class BnTheme : System.IEquatable`1[[BlazorNative.Components.BnTheme, BlazorNative.Components, Version=0.20.3.0, Culture=neutral, PublicKeyToken=null]]

Inheritance Object → BnTheme
Implements IEquatable<BnTheme>
Attributes NullableContextAttribute, NullableAttribute

Remarks:

It is a record for a reason worth knowing before you use it: cascading values notify their consumers by reference, so a theme change has to produce a new instance. Replace it — theme with { ... }, or a fresh new BnTheme(...) — and every component reading the CascadingValue<BnTheme> re-renders. Mutating state in place and keeping the same instance changes nothing on screen.

The colors are hex strings, the same grammar BnLayoutItem.BackgroundColor takes.

Properties​

Background​

The background for themed surfaces.

public string Background { get; init; }

Property Value​

String

AltBackground​

The background a toggle swaps in.

public string AltBackground { get; init; }

Property Value​

String

Constructors​

BnTheme(String, String)​

A pair of background colors, handed down the tree as a cascading value.

public BnTheme(string Background, string AltBackground)

Parameters​

Background String
The background for themed surfaces.

AltBackground String
The background a toggle swaps in.

Remarks:

It is a record for a reason worth knowing before you use it: cascading values notify their consumers by reference, so a theme change has to produce a new instance. Replace it — theme with { ... }, or a fresh new BnTheme(...) — and every component reading the CascadingValue<BnTheme> re-renders. Mutating state in place and keeping the same instance changes nothing on screen.

The colors are hex strings, the same grammar BnLayoutItem.BackgroundColor takes.