Struct Color
- Namespace
- ScottPlot
- Assembly
- ScottPlot.dll
public readonly struct Color
- Inherited Members
- Extension Methods
Constructors
Color(SKColor)
public Color(SKColor color)
Parameters
colorSKColor
Color(byte, byte, byte, byte)
public Color(byte red, byte green, byte blue, byte alpha = 255)
Parameters
Color(Color)
public Color(Color color)
Parameters
colorColor
Color(float, float, float, float)
public Color(float red, float green, float blue, float alpha = 1)
Parameters
Color(string)
public Color(string hexCode)
Parameters
hexCodestring
Color(uint)
public Color(uint argb)
Parameters
argbuint
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
Opacity
public double Opacity { 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
fractiondouble
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
FromARGB(int)
public static Color FromARGB(int argb)
Parameters
argbint
Returns
FromARGB(uint)
public static Color FromARGB(uint argb)
Parameters
argbuint
Returns
FromColor(Color)
Create a ScottPlot color from a System Drawing Color
public static Color FromColor(Color color)
Parameters
colorColor
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
hexIEnumerable<string>
Returns
- Color[]
FromHex(string)
public static Color FromHex(string hex)
Parameters
hexstring
Returns
FromHtml(string)
public static Color FromHtml(string html)
Parameters
htmlstring
Returns
FromSDColor(Color)
Create a ScottPlot color from a System Drawing Color
public static Color FromSDColor(Color sdColor)
Parameters
sdColorColor
Returns
FromSKColor(SKColor)
Create a ScottPlot color from a SkiaSharp Color
public static Color FromSKColor(SKColor skcolor)
Parameters
skcolorSKColor
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
valuebyte
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[]
Inverted()
public Color Inverted()
Returns
InvertedHue()
public Color InvertedHue()
Returns
Lighten(double)
Amount to lighten the color (from 0-1). Larger numbers produce lighter results.
public Color Lighten(double fraction = 0.5)
Parameters
fractiondouble
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
colorColor
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
alphabyte
Returns
WithAlpha(double)
public Color WithAlpha(double alpha)
Parameters
alphadouble
Returns
WithBlue(byte)
public Color WithBlue(byte blue)
Parameters
bluebyte
Returns
WithGreen(byte)
public Color WithGreen(byte green)
Parameters
greenbyte
Returns
WithLightness(float)
public Color WithLightness(float lightness = 0.5)
Parameters
lightnessfloat
Returns
WithOpacity(double)
public Color WithOpacity(double opacity = 0.5)
Parameters
opacitydouble
Returns
WithRed(byte)
public Color WithRed(byte red)
Parameters
redbyte
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)