Table of Contents

Class ColorViewModel

Namespace
Dynamicweb.Frontend
Assembly
Dynamicweb.dll
ColorViewModel represents the rendering context used when a color is rendered.
public class ColorViewModel : ViewModelBase
Inheritance
ColorViewModel
Inherited Members

Properties

Hex

Gets or sets the color hex.
public string Hex { get; set; }

Property Value

string
Hex value of a color starts with # char.

Remarks

For the transparent color property returns an empty string.
See Also

Methods

Contrast(int, double)

Return a color in either lighter or darker contrast based on the original color luminance.
public ColorViewModel Contrast(int percent, double threshold = 0.5)

Parameters

percent int
The percent (1-100) to darken or light the color with - higher percentage will give higher contrast
threshold double
The luminance threshold (0-1). Default is 0.5. 0 is black, 1 is white. Luminance threshold is used to decide wether the returned contrast color should be darker or lighter than the base color

Returns

ColorViewModel
A new color viewmodel with the contrasted color in either darker or lighter luminance compared to base color
See Also

Darken(int)

Darkens the color.
public ColorViewModel Darken(int percent)

Parameters

percent int
The percent (1-100).

Returns

ColorViewModel
System.String.
See Also

Lighten(int)

Lightens the color.
public ColorViewModel Lighten(int percent)

Parameters

percent int
The percent (1-100).

Returns

ColorViewModel
System.String.
See Also

ToString()

Returns the string representation of model
public override string ToString()

Returns

string
See Also

See Also

To top