HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
hi::v1::color Class Reference

#include <hikogui/color/color_intf.hpp>

Public Member Functions

constexpr color (color const &) noexcept=default
constexpr color (color &&) noexcept=default
constexpr color & operator= (color const &) noexcept=default
constexpr color & operator= (color &&) noexcept=default
constexpr color (f16x4 const &other) noexcept
constexpr color (f32x4 const &other) noexcept
constexpr operator f16x4 () const noexcept
constexpr operator f32x4 () const noexcept
constexpr color (float r, float g, float b, float a=1.0f) noexcept
size_t hash () const noexcept
constexpr halfr () noexcept
constexpr halfg () noexcept
constexpr halfb () noexcept
constexpr halfa () noexcept
constexpr half r () const noexcept
constexpr half g () const noexcept
constexpr half b () const noexcept
constexpr half a () const noexcept
constexpr bool holds_invariant () const noexcept

Static Public Member Functions

static std::vector< std::stringlist () noexcept
 List color names.
static color * find (std::string const &name) noexcept
 Find a color by name.
static color black () noexcept
static color silver () noexcept
static color gray () noexcept
static color white () noexcept
static color maroon () noexcept
static color red () noexcept
static color purple () noexcept
static color fuchsia () noexcept
static color green () noexcept
static color lime () noexcept
static color olive () noexcept
static color yellow () noexcept
static color navy () noexcept
static color blue () noexcept
static color teal () noexcept
static color aqua () noexcept
static color indigo () noexcept
static color orange () noexcept
static color pink () noexcept
static color gray0 () noexcept
static color gray1 () noexcept
static color gray2 () noexcept
static color gray3 () noexcept
static color gray4 () noexcept
static color gray5 () noexcept
static color gray6 () noexcept
static color gray7 () noexcept
static color gray8 () noexcept
static color gray9 () noexcept
static color gray10 () noexcept
static color transparent () noexcept

Friends

constexpr friend bool operator== (color const &lhs, color const &rhs) noexcept
constexpr friend color operator* (color const &lhs, color const &rhs) noexcept
constexpr friend color operator* (matrix3 const &lhs, color const &rhs) noexcept
 Transform a color by a color matrix.
std::ostreamoperator<< (std::ostream &lhs, color const &rhs)

Detailed Description

This is a RGBA floating point color.

The color can be converted between different color spaces using the matrix-class.

But in most cases in the application and hikogui library this color would be in the scRGBA color space. This color space is compatible with the sRGB standard IEC 61966-2-1:1999.

scRGB details:

  • the ITU-R BT.709 color primaries.
  • A linear transfer function (unlike sRGB).
  • R=0.0, G=0.0, B=0.0: Black
  • R=1.0, G=1.0, B=1.0: White D65 at 80 nits (80 cd/m^2).
  • RGB values above 1.0 are allowed for HDR (high dynamic range)
  • RGB values below 0.0 are allowed for WCG (wide color gamut)

scRGBA details:

  • Includes an alpha value
  • Alpha values are linear and must be between 0.0 and 1.0.
  • A=0.0 fully transparent
  • A=1.0 fully opaque
  • RGB values are NOT pre-multiplied with the alpha.

Member Function Documentation

◆ find()

color * hi::v1::color::find ( std::string const & name)
inlinestaticnodiscardnoexcept

Find a color by name.

Parameters
nameThe name of the color to find.
Returns
A pointer to a writable named-color. Or nullptr when not found.

◆ list()

std::vector< std::string > hi::v1::color::list ( )
inlinestaticnodiscardnoexcept

List color names.

◆ operator*

friend color operator* ( matrix3 const & lhs,
color const & rhs )
friend

Transform a color by a color matrix.

The alpha value is not included in the transformation and copied from the input.

Note
It is undefined behavior if the matrix contains a translation.
Parameters
lhsThe 3x3 color transformation matrix to use.
rhsThe color to be transformed.
Returns
The transformed color.

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