Color
Color Struct
The Color class holds RGBA values that define a color.
Syntax
public struct Color
Member Details
Color Constructor
Creates a new color with the supplied values.
SyntaxParameters
v
Initializes the color from a Mono.Simd.Vector4f.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Color Constructor
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
Color Constructor
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
A Property
The alpha component of the color.
Syntaxpublic float A { get; set; }
Value
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
B Property
The blue component of the color.
Syntaxpublic float B { get; set; }
Value
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Black Field
Black
Syntaxpublic static readonly Color Black
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Blue Field
Blue
Syntaxpublic static readonly Color Blue
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Clear Field
Clear
Syntaxpublic static readonly Color Clear
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Cyan Field
Cyan
Syntaxpublic static readonly Color Cyan
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
G Property
The green component of the color.
Syntaxpublic float G { get; set; }
Value
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Gray Field
Gray
Syntaxpublic static readonly Color Gray
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Green Field
Green
Syntaxpublic static readonly Color Green
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Lerp Method
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 Field
Magenta
Syntaxpublic static readonly Color Magenta
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
op_Addition Method
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
op_Division Method
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
Conversion Method
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
Conversion Method
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
op_Multiply Method
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
op_Multiply Method
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
op_Subtraction Method
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 Method
Parse a Color from a string.
Syntaxpublic static Color Parse (string colorString)
Parameters
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
R Property
The red component of the color.
Syntaxpublic float R { get; set; }
Value
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Red Field
Red
Syntaxpublic static readonly Color Red
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
ToRGB Method
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
ToRGBA Method
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
ToString Method
Generates a string representation of the color.
Syntaxpublic override string ToString ()
Returns
The color as a string.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
ToString Method
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
TryParse Method
Attempt to parse a Color from a string
Syntaxpublic static bool TryParse (string colorString, out Color color)
Parameters
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 Field
White
Syntaxpublic static readonly Color White
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Yellow Field
Yellow
Syntaxpublic static readonly Color Yellow
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Last updated