Color
La référence est en anglais : elle est générée à partir des commentaires du code, écrits en anglais.
public struct Color : IEquatable<Color>, IFormattableNamespace NodeWorld.Flux.
A color, as Unity's: red, green, blue and alpha (opacity), 0 to 1 each.
Fields
r
public float rRed.
g
public float gGreen.
b
public float bBlue.
a
public float aAlpha: 0 transparent, 1 opaque.
Constructors
Color
public Color(float r, float g, float b, float a)A color of these components.
public Color(float r, float g, float b)An opaque color (alpha 1).
Properties
red
public static Color red { get; }Red (1, 0, 0, 1).
green
public static Color green { get; }Green (0, 1, 0, 1).
blue
public static Color blue { get; }Blue (0, 0, 1, 1).
white
public static Color white { get; }White (1, 1, 1, 1).
black
public static Color black { get; }Black (0, 0, 0, 1).
yellow
public static Color yellow { get; }Yellow (1, 0.92, 0.016, 1).
cyan
public static Color cyan { get; }Cyan (0, 1, 1, 1).
magenta
public static Color magenta { get; }Magenta (1, 0, 1, 1).
gray
public static Color gray { get; }Gray (0.5, 0.5, 0.5, 1).
grey
public static Color grey { get; }Grey: the same as gray.
clear
public static Color clear { get; }Transparent black (0, 0, 0, 0).
Methods
Lerp
public static Color Lerp(Color a, Color b, float t)From a (t = 0) to b (t = 1), component by component; t is kept between 0 and 1.
Equals
public bool Equals(Color other)The components are exactly equal.
public override bool Equals(object other)other is a Color with exactly the same components.
GetHashCode
public override int GetHashCode()A hash of the components.
ToString
public override string ToString()"RGBA(r, g, b, a)" with 3 decimals.
public string ToString(string format)The same text with the numbers in format.
public string ToString(string format, IFormatProvider formatProvider)The same text with the numbers in format (F3 when empty) and formatProvider (the invariant culture when null).
Operators
operator +
public static Color operator +(Color a, Color b)Sum, component by component.
operator -
public static Color operator -(Color a, Color b)Difference, component by component.
operator *
public static Color operator *(Color a, Color b)Product, component by component.
public static Color operator *(Color a, float t)Each component times t.
public static Color operator *(float t, Color a)Each component times t.
operator /
public static Color operator /(Color a, float t)Each component divided by t.
operator ==
public static bool operator ==(Color lhs, Color rhs)Approximately equal, as their Vector4.
operator !=
public static bool operator !=(Color lhs, Color rhs)Not approximately equal (see ==).
implicit operator Vector4
public static implicit operator Vector4(Color c)r, g, b, a as x, y, z, w.
implicit operator Color
public static implicit operator Color(Vector4 v)x, y, z, w as r, g, b, a.
