Struct Color
- Namespace
- ScottPlot
- Assembly
- ScottPlot.dll
public readonly struct Color
- Inherited Members
- Extension Methods
Constructors
Color(SKColor)
public Color(SKColor color)
Parameters
color
SKColor
Color(byte, byte, byte, byte)
public Color(byte red, byte green, byte blue, byte alpha = 255)
Parameters
Color(Color)
public Color(Color color)
Parameters
color
Color
Color(float, float, float, float)
public Color(float red, float green, float blue, float alpha = 1)
Parameters
Color(string)
public Color(string hexCode)
Parameters
hexCode
string
Color(uint)
public Color(uint argb)
Parameters
argb
uint
Fields
Alpha
public readonly byte Alpha
Field Value
Blue
public readonly byte Blue
Field Value
Green
public readonly byte Green
Field Value
Red
public readonly byte Red
Field Value
Properties
A
public byte A { get; }
Property Value
ARGB
public uint ARGB { get; }
Property Value
B
public byte B { get; }
Property Value
G
public byte G { get; }
Property Value
Hue
Hue as a fraction from 0 to 1
public float Hue { get; }
Property Value
Luminance
Luminance as a fraction from 0 to 1
public float Luminance { get; }
Property Value
PremultipliedARGB
public uint PremultipliedARGB { get; }
Property Value
R
public byte R { get; }
Property Value
Saturation
Saturation as a fraction from 0 to 1
public float Saturation { get; }
Property Value
Methods
Darken(double)
Amount to darken the color (from 0-1). Larger numbers produce darker results.
public Color Darken(double fraction = 0.5)
Parameters
fraction
double
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current instance.
Returns
- bool
true if
obj
and this instance are the same type and represent the same value; otherwise, false.
FromARGB(int)
public static Color FromARGB(int argb)
Parameters
argb
int
Returns
FromARGB(uint)
public static Color FromARGB(uint argb)
Parameters
argb
uint
Returns
FromColor(Color)
Create a ScottPlot color from a System Drawing Color
public static Color FromColor(Color color)
Parameters
color
Color
Returns
FromHSL(float, float, float, float)
Create a Color given Hue, Saturation, and Luminance (as fractions from 0 to 1)
public static Color FromHSL(float hue, float saturation, float luminosity, float alpha = 1)
Parameters
Returns
FromHex(IEnumerable<string>)
Create a collection of colors from a collection of hex strings formatted like "#66AA99"
public static Color[] FromHex(IEnumerable<string> hex)
Parameters
hex
IEnumerable<string>
Returns
- Color[]
FromHex(string)
public static Color FromHex(string hex)
Parameters
hex
string
Returns
FromHtml(string)
public static Color FromHtml(string html)
Parameters
html
string
Returns
FromSDColor(Color)
Create a ScottPlot color from a System Drawing Color
public static Color FromSDColor(Color sdColor)
Parameters
sdColor
Color
Returns
FromSKColor(SKColor)
Create a ScottPlot color from a SkiaSharp Color
public static Color FromSKColor(SKColor skcolor)
Parameters
skcolor
SKColor
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Gray(byte)
public static Color Gray(byte value)
Parameters
value
byte
Returns
InterpolateArrayRgb(Color, int)
public Color[] InterpolateArrayRgb(Color c1, int steps)
Parameters
Returns
- Color[]
InterpolateRgb(Color, Color, double)
public static Color InterpolateRgb(Color c1, Color c2, double fraction)
Parameters
Returns
InterpolateRgb(Color, double)
public Color InterpolateRgb(Color c1, double fraction)
Parameters
Returns
InterpolateRgbArray(Color, Color, int)
public static Color[] InterpolateRgbArray(Color c1, Color c2, int steps)
Parameters
Returns
- Color[]
Lighten(double)
Amount to lighten the color (from 0-1). Larger numbers produce lighter results.
public Color Lighten(double fraction = 0.5)
Parameters
fraction
double
Returns
MixedWith(Color, double)
Return this color mixed with another color.
public Color MixedWith(Color otherColor, double fraction)
Parameters
Returns
RandomHue()
public static Color RandomHue()
Returns
ToColor(Color)
public static Color ToColor(Color color)
Parameters
color
Color
Returns
ToHSL()
Hue, Saturation, and Luminance (as fractions from 0 to 1)
public (float h, float s, float l) ToHSL()
Returns
ToHex()
return a string like "#6699AA" or "#6699AA42" if a semitransparent alpha is in use
public string ToHex()
Returns
ToSDColor()
public Color ToSDColor()
Returns
ToSKColor()
Create a SkiaSharp color
public SKColor ToSKColor()
Returns
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
ToStringRGB()
return a string like "#6699AA"
public string ToStringRGB()
Returns
ToStringRGBA()
return a string like "#6699AAFF"
public string ToStringRGBA()
Returns
WithAlpha(byte)
public Color WithAlpha(byte alpha)
Parameters
alpha
byte
Returns
WithAlpha(double)
public Color WithAlpha(double alpha)
Parameters
alpha
double
Returns
WithBlue(byte)
public Color WithBlue(byte blue)
Parameters
blue
byte
Returns
WithGreen(byte)
public Color WithGreen(byte green)
Parameters
green
byte
Returns
WithLightness(float)
public Color WithLightness(float lightness = 0.5)
Parameters
lightness
float
Returns
WithOpacity(double)
public Color WithOpacity(double opacity = 0.5)
Parameters
opacity
double
Returns
WithRed(byte)
public Color WithRed(byte red)
Parameters
red
byte
Returns
Operators
operator ==(Color, Color)
public static bool operator ==(Color a, Color b)
Parameters
Returns
operator !=(Color, Color)
public static bool operator !=(Color a, Color b)