OpenXLSX 1.9.1
Loading...
Searching...
No Matches
OpenXLSX::XLColor Class Reference

#include <XLColor.hpp>

Public Member Functions

 XLColor ()
 Default constructor. Initializes to opaque black (A=255, R=0, G=0, B=0).
 
 XLColor (uint8_t alpha, uint8_t red, uint8_t green, uint8_t blue)
 Constructs a color with explicit ARGB channels.
 
 XLColor (uint8_t red, uint8_t green, uint8_t blue)
 Constructs an opaque color with RGB channels.
 
 XLColor (std::string_view hexCode)
 Constructs a color from an ARGB or RGB hex string (e.g., "FF0000" or "FFFF0000").
 
 XLColor (const XLColor &other)
 
 XLColor (XLColor &&other) noexcept
 
 ~XLColor ()
 
XLColoroperator= (const XLColor &other)
 
XLColoroperator= (XLColor &&other) noexcept
 
void set (uint8_t alpha, uint8_t red, uint8_t green, uint8_t blue)
 Sets explicit ARGB channels.
 
void set (uint8_t red=0, uint8_t green=0, uint8_t blue=0)
 Sets RGB channels. Alpha is implicitly set to 255 (opaque).
 
void set (std::string_view hexCode)
 Sets the color from an ARGB or RGB hex string.
 
uint8_t alpha () const
 Retrieves the alpha (opacity) channel value.
 
uint8_t red () const
 Retrieves the red channel value.
 
uint8_t green () const
 Retrieves the green channel value.
 
uint8_t blue () const
 Retrieves the blue channel value.
 
std::string hex () const
 Returns the 8-character ARGB hex string representation used in OOXML (e.g., "FFFF0000").
 

Friends

bool operator== (const XLColor &lhs, const XLColor &rhs)
 Checks if two colors have identical ARGB channels.
 
bool operator!= (const XLColor &lhs, const XLColor &rhs)
 Checks if two colors differ in any of their ARGB channels.
 

Constructor & Destructor Documentation

◆ XLColor() [1/6]

XLColor::XLColor ( )
default

Default constructor. Initializes to opaque black (A=255, R=0, G=0, B=0).

◆ XLColor() [2/6]

XLColor::XLColor ( uint8_t  alpha,
uint8_t  red,
uint8_t  green,
uint8_t  blue 
)

Constructs a color with explicit ARGB channels.

◆ XLColor() [3/6]

XLColor::XLColor ( uint8_t  red,
uint8_t  green,
uint8_t  blue 
)

Constructs an opaque color with RGB channels.

◆ XLColor() [4/6]

XLColor::XLColor ( std::string_view  hexCode)
explicit

Constructs a color from an ARGB or RGB hex string (e.g., "FF0000" or "FFFF0000").

◆ XLColor() [5/6]

XLColor::XLColor ( const XLColor other)
default

◆ XLColor() [6/6]

XLColor::XLColor ( XLColor &&  other)
defaultnoexcept

◆ ~XLColor()

XLColor::~XLColor ( )
default

Member Function Documentation

◆ alpha()

uint8_t XLColor::alpha ( ) const

Retrieves the alpha (opacity) channel value.

◆ blue()

uint8_t XLColor::blue ( ) const

Retrieves the blue channel value.

◆ green()

uint8_t XLColor::green ( ) const

Retrieves the green channel value.

◆ hex()

std::string XLColor::hex ( ) const

Returns the 8-character ARGB hex string representation used in OOXML (e.g., "FFFF0000").

◆ operator=() [1/2]

XLColor & XLColor::operator= ( const XLColor other)
default

◆ operator=() [2/2]

XLColor & XLColor::operator= ( XLColor &&  other)
defaultnoexcept

◆ red()

uint8_t XLColor::red ( ) const

Retrieves the red channel value.

◆ set() [1/3]

void XLColor::set ( std::string_view  hexCode)

Sets the color from an ARGB or RGB hex string.

◆ set() [2/3]

void XLColor::set ( uint8_t  alpha,
uint8_t  red,
uint8_t  green,
uint8_t  blue 
)

Sets explicit ARGB channels.

◆ set() [3/3]

void XLColor::set ( uint8_t  red = 0,
uint8_t  green = 0,
uint8_t  blue = 0 
)

Sets RGB channels. Alpha is implicitly set to 255 (opaque).

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( const XLColor lhs,
const XLColor rhs 
)
friend

Checks if two colors differ in any of their ARGB channels.

◆ operator==

bool operator== ( const XLColor lhs,
const XLColor rhs 
)
friend

Checks if two colors have identical ARGB channels.


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