SceneColor Struct
An sRGB color with an alpha channel, 8 bits per channel.
public readonly struct SceneColor : IEquatable<SceneColor>- Implements
Constructors
| Name | Description |
|---|---|
| SceneColor(byte, byte, byte, byte) | An sRGB color with an alpha channel, 8 bits per channel. |
SceneColor(byte, byte, byte, byte)
Properties
| Name | Description |
|---|---|
| A | The alpha channel: 0 is transparent, 255 is opaque. |
| B | The blue channel. |
| Black | Gets the opaque black color. |
| G | The green channel. |
| IsOpaque | Gets a value that indicates whether the color is fully opaque. |
| Opacity | Gets the opacity of the color, from 0 to 1. |
| R | The red channel. |
| Transparent | Gets the transparent color. |
| White | Gets the opaque white color. |
Black
SceneColor.csIsOpaque
SceneColor.csOpacity
SceneColor.csTransparent
SceneColor.csWhite
SceneColor.csMethods
| Name | Description |
|---|---|
| Deconstruct(byte, byte, byte, byte) | |
| Equals(SceneColor) | |
| Equals(object) | |
| FromHsl(double, double, double, double) | Creates a color from its hue, saturation and lightness, as the CSS function hsl(). |
| GetHashCode() | |
| Parse(string) | Parses a CSS color: #rgb, #rgba, #rrggbb, #rrggbbaa, a CSS color name such as steelblue, or the functions rgb(), rgba(), hsl() and hsla(), with commas or spaces. |
| ToHexRgb() | Returns the color as #rrggbb, without its alpha channel. |
| ToString() | Returns the color as #rrggbb, or #rrggbbaa when it is not opaque. |
| TryParse(string?, SceneColor) | Tries to parse a CSS color: #rgb, #rgba, #rrggbb, #rrggbbaa, a CSS color name, or rgb(), rgba(), hsl() and hsla(). |
| WithOpacity(double) | Returns a copy of the color with another opacity. |
Deconstruct(byte, byte, byte, byte)
Equals overloads
Equals(SceneColor)
public bool Equals(SceneColor other)No documentation is available.
Equals(object)
FromHsl(double, double, double, double)
SceneColor.csCreates a color from its hue, saturation and lightness, as the CSS function hsl().
public static SceneColor FromHsl(double hue, double saturation, double lightness, double alpha = 1d)Parameters
huedouble- The hue, in degrees; it wraps around 360.
saturationdouble- The saturation, from 0 to 1.
lightnessdouble- The lightness, from 0 to 1.
alphadouble- The opacity, from 0 to 1.
Returns
SceneColor The color, its channels rounded to the nearest integer.
Exceptions
ArgumentOutOfRangeException- A value is not finite.
GetHashCode()
Parse(string)
SceneColor.csParses a CSS color: #rgb, #rgba, #rrggbb, #rrggbbaa, a CSS color name such as steelblue, or the functions rgb(), rgba(), hsl() and hsla(), with commas or spaces.
public static SceneColor Parse(string value)Parameters
valuestring- The text to parse.
Returns
SceneColor The color.
Exceptions
FormatExceptionvalueis not a supported color.
ToHexRgb()
SceneColor.csToString()
SceneColor.csTryParse(string?, SceneColor)
SceneColor.csTries to parse a CSS color: #rgb, #rgba, #rrggbb, #rrggbbaa, a CSS color name, or rgb(), rgba(), hsl() and hsla().
public static bool TryParse(string? value, out SceneColor color)Parameters
valuestring?- The text to parse.
colorSceneColor- The color, when the method returns
true.
Returns
bool true when value is a supported color.
WithOpacity(double)
SceneColor.csReturns a copy of the color with another opacity.
public SceneColor WithOpacity(double opacity)Operators
| Name | Description |
|---|---|
| operator ==(SceneColor, SceneColor) | |
| implicit operator SceneColor(string) | Converts a text to a color with SceneColor.Parse. |
| operator !=(SceneColor, SceneColor) |
operator ==(SceneColor, SceneColor)
public static bool operator ==(SceneColor left, SceneColor right)No documentation is available.
implicit operator SceneColor(string)
SceneColor.csConverts a text to a color with SceneColor.Parse.
public static implicit operator SceneColor(string value)operator !=(SceneColor, SceneColor)
public static bool operator !=(SceneColor left, SceneColor right)No documentation is available.