OpenEnroth 73e68f7
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
Color Struct Reference

#include <Color.h>

Public Member Functions

constexpr Color ()=default
 
constexpr Color (uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
 
uint16_t c16 () const
 
uint32_t c32 () const
 
constexpr Colorf toColorf () const
 
constexpr detail::ColorTag< Colortag () const
 

Static Public Member Functions

static constexpr Color fromC16 (uint16_t color)
 
static Color fromC32 (uint32_t color)
 

Public Attributes

uint8_t r = 0
 
uint8_t g = 0
 
uint8_t b = 0
 
uint8_t a = 0
 

Friends

bool constexpr operator== (const Color &l, const Color &r)=default
 

Detailed Description

Color in A8B8G8R8 format.

Constructor & Destructor Documentation

◆ Color() [1/2]

constexpr Color::Color ( )
constexprdefault

◆ Color() [2/2]

constexpr Color::Color ( uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)
inlineconstexpr

Member Function Documentation

◆ c16()

uint16_t Color::c16 ( ) const
inline

◆ c32()

uint32_t Color::c32 ( ) const
inline

◆ fromC16()

static constexpr Color Color::fromC16 ( uint16_t  color)
inlinestaticconstexpr

◆ fromC32()

static Color Color::fromC32 ( uint32_t  color)
inlinestatic

◆ tag()

constexpr detail::ColorTag< Color > Color::tag ( ) const
inlineconstexpr

This function returns a tag that can then be used in fmt::format calls to print out a color introducer.

For example:

std::string s = fmt::format("{::}{}{::} more text", Color(255, 255, 255).tag(), "text", Color().tag());
s
Definition: Json_ut.cpp:85
constexpr Color()=default
constexpr detail::ColorTag< Color > tag() const
Definition: Color.h:82

The code above will set string s to "\f65535text\f00000 more text".

Note that the only supported format specifier for color tags is "{::}". This is done intentionally so that the user won't accidentally mix up color introducers with other fmt::format args.

Returns
Tag that can be used with fmt::format.

◆ toColorf()

constexpr Colorf Color::toColorf ( ) const
inlineconstexpr

Friends And Related Function Documentation

◆ operator==

bool constexpr operator== ( const Color l,
const Color r 
)
friend

Member Data Documentation

◆ a

uint8_t Color::a = 0

◆ b

uint8_t Color::b = 0

◆ g

uint8_t Color::g = 0

◆ r

uint8_t Color::r = 0

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