Color
Last updated
Last updated
The Color class holds RGBA values that define a color.
public struct Color
Creates a new color with the supplied values.
SyntaxParameters
v
Initializes the color from a .
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Creates a new solid color with the supplied values.
SyntaxParameters
r
The red component.
g
The green component.
b
The blue component.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Creates a new color with the supplied values.
SyntaxParameters
r
The red component.
g
The green component.
b
The blue component.
a
The alpha component.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
The alpha component of the color.
SyntaxValue
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
The blue component of the color.
SyntaxValue
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Black
Syntax
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Blue
Syntax
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Clear
Syntax
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Cyan
Syntax
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
The green component of the color.
SyntaxValue
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Gray
Syntax
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Green
Syntax
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Performs a linear interpolation between two colors.
SyntaxParameters
c
The second color.
amount
Value from [0..1] indicating the weight for the second color.
Returns
A color that is linearly interpolated between the two sources.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Magenta
Syntax
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Performs color addition.
SyntaxParameters
a
The first Color.
b
The second Color.
Returns
A new color that is the sum of the arguments.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Divides color components by a scalar.
SyntaxParameters
c
The color.
s
The scalar.
Returns
Returns a new color with value [c.R/s, c.G/s, c.B/s, c.A/s]
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Converts a Mono.Simd.Vector4f to a Color.
SyntaxParameters
v
Vector to convert
Returns
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Converts a Color to a Mono.Simd.Vector4f
SyntaxParameters
c
Color to convert
Returns
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Performs a color scalar multiplication.
SyntaxParameters
c
The color.
s
The scalar.
Returns
Returns a new color with value [c.R*s, c.G*s, c.B*s, c.A*s]
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Performs a color scalar multiplication.
SyntaxParameters
s
The scalar.
c
The color.
Returns
Returns a new color with value [s*c.R, s*c.G, s*c.B, s*c.A]
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Performs color subtraction.
SyntaxParameters
a
The first Color.
b
The second Color.
Returns
A new color that is the difference of the arguments.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Parse a Color from a string.
SyntaxParameters
colorString
A string of the format (R,G,B) or (R,G,B,A)
Returns
The Color parsed from the string.
Exceptions
If colorString is null.
If the string is not a valid color or its components are not valid floats.
Remarks
Example
C# Example
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
The red component of the color.
SyntaxValue
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Red
Syntax
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Generates a string RGB representation of the color.
SyntaxReturns
The RGB color as a string.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Generates a string RGBA representation of the color.
SyntaxReturns
The RGBA color as a string.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Generates a string representation of the color.
SyntaxReturns
The color as a string.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Generates a string representation of the color.
SyntaxParameters
format
Format to use for each of the coordinates.
Returns
The color as a string.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Attempt to parse a Color from a string
SyntaxParameters
colorString
A string of the format (R,G,B) or (R,G,B,A)
color
The color that will be set if colorString represents a valid color.
Returns
True if successfully parsed a color, false if not.
Remarks
Example
C# Example
|
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
White
Syntax
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Yellow
Syntax
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
public A { get; set; }
public B { get; set; }
public static readonly Black
public static readonly Blue
public static readonly Clear
public static readonly Cyan
public G { get; set; }
public static readonly Gray
public static readonly Green
public static readonly Magenta
public static Parse ( colorString)
public R { get; set; }
public static readonly Red
public override ToString ()
public static TryParse ( colorString, out color)
public static readonly White
public static readonly Yellow