WPILibC++ 2024.3.2
frc::Color8Bit Class Reference

Represents colors that can be used with Addressable LEDs. More...

#include <frc/util/Color8Bit.h>

Public Member Functions

constexpr Color8Bit ()=default
 Constructs a default color (black). More...
 
constexpr Color8Bit (int r, int g, int b)
 Constructs a Color8Bit. More...
 
constexpr Color8Bit (const Color &color)
 Constructs a Color8Bit from a Color. More...
 
constexpr Color8Bit (std::string_view hexString)
 Constructs a Color8Bit from a hex string. More...
 
constexpr bool operator== (const Color8Bit &) const =default
 
constexpr operator Color () const
 
constexpr auto HexString () const
 Return this color represented as a hex string. More...
 

Static Public Member Functions

static constexpr Color8Bit FromHexString (std::string_view hexString)
 Create a Color8Bit from a hex string. More...
 

Public Attributes

int red = 0
 Red component (0-255). More...
 
int green = 0
 Green component (0-255). More...
 
int blue = 0
 Blue component (0-255). More...
 

Detailed Description

Represents colors that can be used with Addressable LEDs.

Constructor & Destructor Documentation

◆ Color8Bit() [1/4]

constexpr frc::Color8Bit::Color8Bit ( )
constexprdefault

Constructs a default color (black).

◆ Color8Bit() [2/4]

constexpr frc::Color8Bit::Color8Bit ( int  r,
int  g,
int  b 
)
inlineconstexpr

Constructs a Color8Bit.

Parameters
rRed value (0-255)
gGreen value (0-255)
bBlue value (0-255)

◆ Color8Bit() [3/4]

constexpr frc::Color8Bit::Color8Bit ( const Color color)
inlineconstexpr

Constructs a Color8Bit from a Color.

Parameters
colorThe color

◆ Color8Bit() [4/4]

constexpr frc::Color8Bit::Color8Bit ( std::string_view  hexString)
inlineexplicitconstexpr

Constructs a Color8Bit from a hex string.

Parameters
hexStringa string of the format #RRGGBB
Exceptions
std::invalid_argumentif the hex string is invalid.

Member Function Documentation

◆ FromHexString()

static constexpr Color8Bit frc::Color8Bit::FromHexString ( std::string_view  hexString)
inlinestaticconstexpr

Create a Color8Bit from a hex string.

Parameters
hexStringa string of the format #RRGGBB
Returns
Color8Bit object from hex string.
Exceptions
std::invalid_argumentif the hex string is invalid.

◆ HexString()

constexpr auto frc::Color8Bit::HexString ( ) const
inlineconstexpr

Return this color represented as a hex string.

Returns
a string of the format #RRGGBB

◆ operator Color()

constexpr frc::Color8Bit::operator Color ( ) const
inlineconstexpr

◆ operator==()

constexpr bool frc::Color8Bit::operator== ( const Color8Bit ) const
constexprdefault

Member Data Documentation

◆ blue

int frc::Color8Bit::blue = 0

Blue component (0-255).

◆ green

int frc::Color8Bit::green = 0

Green component (0-255).

◆ red

int frc::Color8Bit::red = 0

Red component (0-255).


The documentation for this class was generated from the following file: