Table of Contents

Class IconColorBuilder

Namespace
TwBlazor.Builders
Assembly
TwBlazor.dll

Resolves the color classes for an icon glyph from Colors.

public class IconColorBuilder
Inheritance
IconColorBuilder
Inherited Members

Remarks

Icons are graphics rather than body text, so they are held to the 3:1 non-text contrast ratio instead of the 4.5:1 text ratio that GetTextColor(Color?) is tuned for. Reusing the text colors made icons look muddy in light mode (e.g. brown instead of yellow) and washed out in dark mode.

Constructors

IconColorBuilder(TwBlazorOptions)

Resolves the color classes for an icon glyph from Colors.

public IconColorBuilder(TwBlazorOptions options)

Parameters

options TwBlazorOptions

Remarks

Icons are graphics rather than body text, so they are held to the 3:1 non-text contrast ratio instead of the 4.5:1 text ratio that GetTextColor(Color?) is tuned for. Reusing the text colors made icons look muddy in light mode (e.g. brown instead of yellow) and washed out in dark mode.

Methods

GetIconColor(Color?)

Gets the light and dark mode text color classes for an icon of the specified color.

public string GetIconColor(Color? color)

Parameters

color Color?

The icon color. If null or unrecognized, an empty string is returned so the icon inherits its surrounding color.

Returns

string

The color classes from Colors, or an empty string.