RSTools 3.1.0
Versatile C++20 utility library
Loading...
Searching...
No Matches
Color.hpp File Reference
#include <array>
#include <cstdint>
#include <iosfwd>
#include <optional>
#include <string>
#include <string_view>

Go to the source code of this file.

Classes

struct  RST::Color::Hsv
 HSV color: hue in degrees [0, 360), saturation, value and alpha in [0, 1]. More...
 
struct  RST::Color::Color
 8-bit RGBA color, packed in 4 bytes. More...
 

Namespaces

namespace  RST
 Root namespace of RSTools.
 
namespace  RST::Color
 RGBA colors: hex and HSV conversions, blending, interpolation and named colors.
 

Functions

std::ostream & RST::Color::operator<< (std::ostream &out, const Color &color)
 Prints the color as #RRGGBBAA.
 
constexpr Color RST::Color::lerp (const Color &a, const Color &b, float t) noexcept
 Interpolates every component, alpha included, with t clamped to [0, 1].
 
constexpr Color RST::Color::blend (const Color &src, const Color &dst) noexcept
 Draws src over dst, taking the alpha of both into account.
 

Variables

Named colors
constexpr Color RST::Color::Black {0, 0, 0, 255}
 
constexpr Color RST::Color::White {255, 255, 255, 255}
 
constexpr Color RST::Color::Gray {128, 128, 128, 255}
 
constexpr Color RST::Color::Red {255, 0, 0, 255}
 
constexpr Color RST::Color::Green {0, 255, 0, 255}
 
constexpr Color RST::Color::Blue {0, 0, 255, 255}
 
constexpr Color RST::Color::Yellow {255, 255, 0, 255}
 
constexpr Color RST::Color::Magenta {255, 0, 255, 255}
 
constexpr Color RST::Color::Cyan {0, 255, 255, 255}
 
constexpr Color RST::Color::Orange {255, 165, 0, 255}
 
constexpr Color RST::Color::Purple {128, 0, 128, 255}
 
constexpr Color RST::Color::Transparent {0, 0, 0, 0}