Class Color
- Namespace
- Dynamicweb.Imaging.Colors
- Assembly
- Dynamicweb.Core.dll
Class Color. Use the constructor or one of the from
- Inheritance
-
Color
- Inherited Members
Constructors
Color(Color)
Initializes a new instance of the Color class.
Parameters
color
ColorThe color.
Properties
BaseColor
Gets the base color - defined when object was initialized.
Property Value
- Color
The original color
Brightness
Gets the brightness from 1-255, where 255 is white and 1 is black.
Property Value
- double
The brightness.
CleanColor
Gets the clean color based on original color. Hue not changed, saturation and value set to 100.
Property Value
- Color
The color of the clean.
Hsl
Gets a HSL instance of this color.
Property Value
- Hsl
The HSL.
Hsv
Gets a HSV instance of this color.
Property Value
- Hsv
The HSV.
Methods
Darken(int)
Darkens the color with the specified percent (1-100).
Parameters
percent
intThe percent (1-100).
Returns
- Color
Color.
Exceptions
- Index
Out OfRange Exception Percent must be between 1-100
Darken(string, int)
Darkens the specified color.
Parameters
Returns
- string
System.String.
FromHex(string?)
Creates a new instance of the Color class from hex value - with or withouth the #.
Parameters
hex
stringThe color hex. '#FFFFFF' or 'FFFFFF'
Returns
- Color
Color.
FromHsl(double, double, double)
Creates a new instance of the Color class from HSL values.
Parameters
hue
doubleThe hue. (0-360)
saturation
doubleThe saturation. (0-1)
lightness
doubleThe lightness. (0-1)
Returns
- Color
Color.
Exceptions
- Index
Out OfRange Exception Hue must be between 0-360, Saturation must be between 0-1, Value must be between 0-1
FromHsv(double, double, double)
Creates a new instance of the Color class from HSV values.
Parameters
Returns
- Color
Color.
Exceptions
- Index
Out OfRange Exception Hue must be between 0-360, Saturation must be between 0-1, Value must be between 0-1
FromRgb(int, int, int)
Creates a new instance of the Color class from RGB values.
Parameters
red
intThe red component value. Valid values are 0 through 255
green
intThe green component value. Valid values are 0 through 255
blue
intThe blue component value. Valid values are 0 through 255
Returns
- Color
Color.
GenerateClearColors(int)
Generates clear colors based on the base color.
Parameters
count
intThe count.
Returns
- Color
Collection ColorCollection.
GenerateDarkGreyColors(int)
Generates dark grey colors.
Parameters
count
intThe count.
Returns
- Color
Collection ColorCollection.
GenerateGreyColors(int)
Generates grey colors.
Parameters
count
intThe count.
Returns
- Color
Collection ColorCollection.
GenerateLightGreyColors(int)
Generates light grey colors.
Parameters
count
intThe count.
Returns
- Color
Collection ColorCollection.
GeneratePastelColors(int)
Generates pastel colors.
Parameters
count
intThe count.
Returns
- Color
Collection ColorCollection.
GenerateShadeColors(int)
Generates shade colors (Dark).
Parameters
count
intThe count.
Returns
- Color
Collection ColorCollection.
GenerateSimilarColors(int)
Generates similar colors.
Parameters
count
intThe count.
Returns
- Color
Collection ColorCollection.
GenerateTintColors(int)
Generates tint colors (Light).
Parameters
count
intThe count.
Returns
- Color
Collection ColorCollection.
GenerateToneColors(int)
Generates tone colors (Medium).
Parameters
count
intThe count.
Returns
- Color
Collection ColorCollection.
GetAccentColor(int)
Gets the color of the accent.
Parameters
degrees
intThe color of the accent
Returns
- Color
The color
GetContrastColor()
Returns either black or white contrast color, based on the specified color.
Returns
- string
The contrasting color
Lighten(int)
Lightens the color with the specified percent (1-100).
Parameters
percent
intThe percent (1-100).
Returns
- Color
Color.
Exceptions
- Index
Out OfRange Exception Percent must be between 1-100
Lighten(string, int)
Lightens the specified color.
Parameters
Returns
- string
System.String.
ToHex()
Returns the hex value of the specified color.
Returns
- string
A hex value.
ToRgb()
Returns the RGB value of the specified color.
Returns
- string
A RGB value.
ToString()
Returns current hex