Table of Contents

Struct RGBWColor

Namespace
CTRE.Phoenix6.Signals
Assembly
Phoenix6.Hardware.dll

Represents an RGBW color that can be applied to an LED.

public readonly record struct RGBWColor : IEquatable<RGBWColor>
Implements
Inherited Members

Constructors

RGBWColor()

Creates a new RGBW color where all components are off.

public RGBWColor()

RGBWColor(byte, byte, byte, byte)

Represents an RGBW color that can be applied to an LED.

public RGBWColor(byte Red, byte Green, byte Blue, byte White = 0)

Parameters

Red byte

The red component of the color, within [0, 255].

Green byte

The green component of the color, within [0, 255].

Blue byte

The blue component of the color, within [0, 255].

White byte

The white component of the color, within [0, 255]. Note that not all LED strips support the white component.

Properties

Blue

The blue component of the color, within [0, 255].

public byte Blue { get; init; }

Property Value

byte

Green

The green component of the color, within [0, 255].

public byte Green { get; init; }

Property Value

byte

Red

The red component of the color, within [0, 255].

public byte Red { get; init; }

Property Value

byte

White

The white component of the color, within [0, 255]. Note that not all LED strips support the white component.

public byte White { get; init; }

Property Value

byte

Methods

FromHSV(double, double, double)

Creates a new RGBW color from the given HSV color.

public static RGBWColor FromHSV(double h, double s, double v)

Parameters

h double

The hue as an angle from [0, 360) deg, where 0 is red.

s double

The saturation as a scalar from [0, 1].

v double

The value as a scalar from [0, 1].

Returns

RGBWColor

The corresponding RGB color; the white component will be 0.

FromHex(string)

Creates a new RGBW color from the given hex string.

public static RGBWColor? FromHex(string hex)

Parameters

hex string

The color hex in the form "#RRGGBBWW" or "#RRGGBB".

Returns

RGBWColor?

The color if the hex is valid, otherwise null

ToHexString()

Returns this RGBW color as a hex string.

public string ToHexString()

Returns

string

A hex string in the format "#RRGGBBWW"

ToString()

Returns this RGBW color as a string.

public override string ToString()

Returns

string

A string in the format "RGBW(Red, Green, Blue, White)"

Operators

operator *(RGBWColor, double)

Scales down the components of the color by the given brightness.

public static RGBWColor operator *(RGBWColor color, double brightness)

Parameters

color RGBWColor

The color to scale.

brightness double

The scalar to apply from [0, 1].

Returns

RGBWColor

New color scaled by the given brightness