struct Color32

in global

A 32bit color, commonly used by things like vertex buffers. The functionality on this is purposely left minimal so we're encouraged to use the regular struct.


public byte r

The red color component, in range of 0-255.

public byte g

The green color component, in range of 0-255.

public byte b

The blue color component, in range of 0-255.

public byte a

The alpha/transparency color component, in range of 0 (fully transparent) to 255 (fully opaque).

public Color32( byte r, byte g, byte b, byte a = 255 )

Initialize a color with each component set to given values, in range [0,255]

public Color32( byte all )

Initialize a color with each component set to given value, even alpha.

  • all A number in range [0-255]

public Color32( uint raw )

Initialize from an integer of the form 0xAABBGGRR.

  • raw Packed integer of the form 0xAABBGGRR.

public Color32( int raw )

Initialize from an integer of the form 0xAABBGGRR.

  • raw Packed integer of the form 0xAABBGGRR.

public static Color32 White { get; }

A constant representing a fully opaque color white.

public static Color32 Black { get; }

A constant representing a fully opaque color black.

public static Color32 Transparent { get; }

A constant representing a fully transparent color.

public static Color32 FromRgb( uint rgb )

Converts an integer of the form 0xRRGGBB into the color #RRGGBB with 100% alpha.

  • rgb Integer between 0x000000 and 0xffffff representing a color.

public static Color32 FromRgba( uint rgba )

Converts an integer of the form 0xRRGGBBAA into the color #RRGGBBAA.

  • rgba Integer between 0x00000000 and 0xffffffff representing a color with alpha.

public Color ToColor( bool srgb )

Convert this object to .

  • srgb If true we'll convert from the srgb color space to linear
  • Returns The converted color struct.

public static Color32 Min( Color32 a, Color32 b )

Returns a new color with each component being the minimum of the 2 given colors.

  • a Color A
  • b Color B
  • Returns The new color with minimum values.

public static Color32 Max( Color32 a, Color32 b )

Returns a new color with each component being the maximum of the 2 given colors.

  • a Color A
  • b Color B
  • Returns The new color with maximum values.

public string Hex { get; }

String representation of the form "#RRGGBB[AA]".

public string Rgba { get; }

String representation in the form of rgba( r, g, b, a ) css function notation.

public string Rgb { get; }

String representation in the form of rgb( r, g, b ) css function notation.

public uint RgbaInt { get; }

Integer representation of the form 0xRRGGBBAA.

public uint RgbInt { get; }

Integer representation of the form 0xRRGGBB.

public uint RawInt { get; }

Integer representation of the form 0xAABBGGRR as used by native code.

public void Write( BinaryWriter writer )

Write this color to a binary writer.

  • writer Writer to write to.

public static Color32 Read( BinaryReader reader )

Read a color from binary reader.

  • reader Reader to read from.
  • Returns The read color.

public static Nullable<Color32> Parse( string value )

Parse a string to a color, in format "255 255 255 255" or "255,255,255". Alpha is optional.

  • value The value to parse.
  • Returns The color parsed from the string, or null if we failed to do so.

public Color ToColor( )

😔 No documentation found.

public string ToString( )

😔 No documentation found.

public int GetHashCode( )

😔 No documentation found.

public bool Equals( Color32 o )

😔 No documentation found.

public bool Equals( object obj )

😔 No documentation found.

public static bool op_Equality( Color32 left, Color32 right )

😔 No documentation found.

public static Color32 op_Implicit( Color value )

😔 No documentation found.

public Type GetType( )

😔 No documentation found.

public static bool op_Inequality( Color32 left, Color32 right )

😔 No documentation found.