Loading...
Searching...
No Matches
hueplusplus::RGB Struct Reference

Color in RGB. More...

`#include <hueplusplus/ColorUnits.h>`

## Public Member Functions

bool | operator== (const RGB &other) const
bool | operator!= (const RGB &other) const
XYBrightness | toXY () const
| Convert to XYBrightness without clamping.
XYBrightness | toXY (const ColorGamut &gamut) const
| Convert to XYBrightness and clip to `gamut`.
HueSaturation | toHueSaturation () const
| Convert to HueSaturation.

## Static Public Member Functions

static RGB | fromXY (const XYBrightness &xy)
| Create from XYBrightness.
static RGB | fromXY (const XYBrightness &xy, const ColorGamut &gamut)
| Create from XYBrightness and clip to `gamut`.

## Public Attributes

uint8_t | r
| Red amount from 0 to 255.
uint8_t | g
| Green amount from 0 to 255.
uint8_t | b
| Blue amount from 0 to 255.

## Detailed Description

Color in RGB.

## Member Function Documentation

## fromXY() [1/2]

RGB hueplusplus::RGB::fromXY | ( | const XYBrightness & | xy | ) |

static

Create from XYBrightness.

Performs gamma correction so the light color matches the screen color better.

Note
  The conversion formula is not exact, it can be off by up to 9 for each channel. This is because the color luminosity is not saved.

## fromXY() [2/2]

RGB hueplusplus::RGB::fromXY | ( | const XYBrightness & | xy,
|  | const ColorGamut & | gamut )

static

Create from XYBrightness and clip to `gamut`.

A light may have XY set out of its range. Then this function returns the actual color the light shows rather than what it is set to. Performs gamma correction so the light color matches the screen color better.

Note
  The conversion formula is not exact, it can be off by up to 9 for each channel. This is because the color luminosity is not saved.

## operator!=()

bool hueplusplus::RGB::operator!= | ( | const RGB & | other | ) | const

inline

## operator==()

bool hueplusplus::RGB::operator== | ( | const RGB & | other | ) | const

inline

## toHueSaturation()

HueSaturation hueplusplus::RGB::toHueSaturation | ( |  | ) | const

Convert to HueSaturation.

To get the correct color, set brightness to max(r,g,b).

## toXY() [1/2]

XYBrightness hueplusplus::RGB::toXY | ( |  | ) | const

Convert to XYBrightness without clamping.

Performs gamma correction so the light color matches the screen color better.

## toXY() [2/2]

XYBrightness hueplusplus::RGB::toXY | ( | const ColorGamut & | gamut | ) | const

Convert to XYBrightness and clip to `gamut`.

Performs gamma correction so the light color matches the screen color better.

## Member Data Documentation

## b

uint8_t hueplusplus::RGB::b

Blue amount from 0 to 255.

## g

uint8_t hueplusplus::RGB::g

Green amount from 0 to 255.

## r

uint8_t hueplusplus::RGB::r

Red amount from 0 to 255.

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

- include/hueplusplus/ColorUnits.h
- src/ColorUnits.cpp