Molybden API
Loading...
Searching...
No Matches
molybden::Color Struct Reference

A numeric model of an RGB color. More...

#include <color.hpp>

Public Member Functions

 Color (float red, float green, float blue, float alpha)
 
 Color (float red, float green, float blue)
 
bool isValid () const
 Indicates whether this color is a valid color.
 
std::string hexRGBA () const
 Returns a string representation for this color in the RGBA hex format or an empty string when this color is invalid.
 
std::string hexRGB () const
 Returns a string representation for this color in the RGB hex format or an empty string when this color is invalid.
 

Public Attributes

float red = 0.0
 The red channel value in the {0..1} range.
 
float green = 0.0
 The green channel value in the {0..1} range.
 
float blue = 0.0
 The blue channel value in the {0..1} range.
 
float alpha = 0.0
 The opacity channel value in the {0..1} range.
 

Detailed Description

A numeric model of an RGB color.

The components of the color instance are presented in the arithmetic notation. This means that each component accepts any fractional value from 0 to 1.

If all the components except alpha are at zero and the alpha is at 1, the result is black. If all are at 1, the result is the brightest white.

Important: the component values out of the {0..1} range are not allowed and should not be used.

Member Function Documentation

◆ isValid()

bool molybden::Color::isValid ( ) const

Indicates whether this color is a valid color.

The color is valid only if its channel values are in the {0..1} range.

Member Data Documentation

◆ alpha

float molybden::Color::alpha = 0.0

The opacity channel value in the {0..1} range.

When the value is 1, the color is 100% opaque. When 0, the color is 100% transparent.


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