Class ColorViewModel
- Namespace
- Dynamicweb.Frontend
- Assembly
- Dynamicweb.dll
ColorViewModel represents the rendering context used when a color is rendered.
- Inheritance
-
Color
View Model
- Inherited Members
Properties
Hex
Gets or sets the color hex.
Property Value
- string
Hex value of a color starts with # char.
Remarks
For the transparent color property returns an empty string.
RawValue
Gets or sets the raw model value.
Property Value
- string
The raw model value.
Methods
Contrast(int, double)
Return a color in either lighter or darker contrast based on the original color luminance.
Parameters
percent
intThe percent (1-100) to darken or light the color with - higher percentage will give higher contrast
threshold
doubleThe 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
- Color
View Model A new color viewmodel with the contrasted color in either darker or lighter luminance compared to base color
Darken(int)
Darkens the color.
Parameters
percent
intThe percent (1-100).
Returns
- Color
View Model System.String.
Lighten(int)
Lightens the color.
Parameters
percent
intThe percent (1-100).
Returns
- Color
View Model System.String.
ToString()
Returns the string representation of model