Class
ThemableColor

Color value that can originate from a theme or a local override and be resolved to an actual color.

Definition

Namespace:Telerik.Windows.Documents.Spreadsheet.Model

Assembly:Telerik.Windows.Documents.Core.dll

Syntax:

cs-api-definition
[TypeConverter(typeof(ThemableColorTypeConverter))]
public class ThemableColor : IThemableObject<Color>

Inheritance: objectThemableColor

Implements: IThemableObject<Color>

Constructors

ThemableColor(Color)

Initializes a new instance of the ThemableColor class with a concrete color value.

Declaration

cs-api-definition
public ThemableColor(Color color)

Parameters

color

Color

The color.

ThemableColor(Color, bool)

Initializes a new instance of the ThemableColor class with a concrete color and an automatic flag.

Declaration

cs-api-definition
public ThemableColor(Color color, bool isAutomatic)

Parameters

color

Color

The color.

isAutomatic

bool

The is automatic.

ThemableColor(ThemeColorType, ColorShadeType?)

Initializes a new instance that references a theme color and optional shade step.

Declaration

cs-api-definition
public ThemableColor(ThemeColorType themeColorType, ColorShadeType? colorShadeType = null)

Parameters

themeColorType

ThemeColorType

The theme color type.

colorShadeType

ColorShadeType?

The color shade type.

ThemableColor(ThemeColorType, double)

Initializes a new instance that references a theme color with a tint/shade adjustment in [-1, 1].

Declaration

cs-api-definition
public ThemableColor(ThemeColorType themeColorType, double tintAndShade)

Parameters

themeColorType

ThemeColorType

Theme color type.

tintAndShade

double

The tint and shade.

Properties

ColorShadeType

Gets the shade step used to derive a lighter/darker variant when the color references a theme.

Declaration

cs-api-definition
public ColorShadeType? ColorShadeType { get; }

Property Value

ColorShadeType?

The color shade type.

IsAutomatic

Gets whether the color is marked as automatic, allowing consumers to adjust it as appropriate.

Declaration

cs-api-definition
public bool IsAutomatic { get; }

Property Value

bool

Value indicating if the color is automatic.

IsFromTheme

Gets whether the color is resolved from the theme rather than a local color.

Declaration

cs-api-definition
public bool IsFromTheme { get; }

Property Value

bool

The value indicating if the instance is from a theme.

Implements IThemableObject<Color>.IsFromTheme

LocalValue

Gets the locally assigned color used when the value does not come from the theme.

Declaration

cs-api-definition
public Color LocalValue { get; }

Property Value

Color

Implements IThemableObject<Color>.LocalValue

ThemeColorType

Gets the referenced theme color type when the value comes from the theme.

Declaration

cs-api-definition
public ThemeColorType ThemeColorType { get; }

Property Value

ThemeColorType

The theme color type.

TintAndShade

Gets the tint/shade adjustment in the range [-1, 1] when explicitly specified.

Declaration

cs-api-definition
public double? TintAndShade { get; }

Property Value

double?

The tint and shade.

Methods

Equals(object)

Determines whether the specified object is equal to the current object.

Declaration

cs-api-definition
public override bool Equals(object obj)

Parameters

obj

object

The object to compare with the current object.

Returns

bool

True if the specified object is equal to the current object; otherwise, false.

Overrides object.Equals(object)

FromArgb(byte, byte, byte, byte)

Create a themable color from ARGB components.

Declaration

cs-api-definition
public static ThemableColor FromArgb(byte alfa, byte red, byte green, byte blue)

Parameters

alfa

byte

The alfa 0 to 255.

red

byte

The red 0 to 255.

green

byte

The green 0 to 255.

blue

byte

The blue 0 to 255.

Returns

ThemableColor

FromColor(Color)

Convert a Color to a ThemableColor.

Declaration

cs-api-definition
public static ThemableColor FromColor(Color value)

Parameters

value

Color

The Color.

Returns

ThemableColor

The ThemableColor.

GetActualValue(DocumentTheme)

Resolve the effective color using the specified theme.

Declaration

cs-api-definition
public Color GetActualValue(DocumentTheme theme)

Parameters

theme

DocumentTheme

The theme.

Returns

Color

The actual value.

Implements IThemableObject<Color>.GetActualValue(DocumentTheme)

GetActualValue(ThemeColorScheme)

Resolve the effective color using the provided color scheme.

Declaration

cs-api-definition
public Color GetActualValue(ThemeColorScheme colorScheme)

Parameters

colorScheme

ThemeColorScheme

The color scheme.

Returns

Color

The actual color.

GetHashCode()

Serves as a hash function for a particular type.

Declaration

cs-api-definition
public override int GetHashCode()

Returns

int

A hash code for the current object.

Overrides object.GetHashCode()

ToString()

Returns a string that represents the current object.

Declaration

cs-api-definition
public override string ToString()

Returns

string

A string that represents the current object.

Overrides object.ToString()

Operators

explicit operator ThemableColor(Color)

Explicitly cast a concrete color to a themable color instance.

Declaration

cs-api-definition
public static explicit operator ThemableColor(Color value)

Parameters

value

Color

The color.

Returns

ThemableColor

Themable color.

operator !=(ThemableColor, ThemableColor)

Compare two themable colors for inequality.

Declaration

cs-api-definition
public static bool operator !=(ThemableColor first, ThemableColor second)

Parameters

first

ThemableColor

The first themable color.

second

ThemableColor

The second themable color.

Returns

bool

If the two themable colors are equal.

operator ==(ThemableColor, ThemableColor)

Compare two themable colors for value equality.

Declaration

cs-api-definition
public static bool operator ==(ThemableColor first, ThemableColor second)

Parameters

first

ThemableColor

The first themable color.

second

ThemableColor

The second themable color.

Returns

bool

If the two themable colors are equal.