1#ifndef LIBSBX_MATH_COLOR_HPP_
2#define LIBSBX_MATH_COLOR_HPP_
6#include <yaml-cpp/yaml.h>
18 color(std::uint32_t rgba)
noexcept;
20 color(std::float_t red, std::float_t green, std::float_t blue, std::float_t alpha = 1.0f)
noexcept;
22 static auto black()
noexcept ->
color {
23 return color{0.0f, 0.0f, 0.0f, 1.0f};
26 static auto white()
noexcept ->
color {
27 return color{1.0f, 1.0f, 1.0f, 1.0f};
30 static auto red()
noexcept ->
color {
31 return color{1.0f, 0.0f, 0.0f, 1.0f};
34 static auto green()
noexcept ->
color {
35 return color{0.0f, 1.0f, 0.0f, 1.0f};
38 static auto blue()
noexcept ->
color {
39 return color{0.0f, 0.0f, 1.0f, 1.0f};
42 static auto magenta()
noexcept ->
color {
43 return color{1.0f, 0.0f, 1.0f, 1.0f};
46 static auto yellow()
noexcept ->
color {
47 return color{1.0f, 1.0f, 0.0f, 1.0f};
50 static auto cyan()
noexcept ->
color {
51 return color{0.0f, 1.0f, 1.0f, 1.0f};
54 auto r()
const noexcept ->
const std::float_t&;
56 auto r()
noexcept -> std::float_t&;
58 auto g()
const noexcept ->
const std::float_t&;
60 auto g()
noexcept -> std::float_t&;
62 auto b()
const noexcept ->
const std::float_t&;
64 auto b()
noexcept -> std::float_t&;
66 auto a()
const noexcept ->
const std::float_t&;
68 auto a()
noexcept -> std::float_t&;
79auto operator==(
const color& lhs,
const color& rhs)
noexcept -> bool;
81auto operator*(
color lhs,
const std::float_t value) ->
color;
86struct YAML::convert<sbx::math::color> {
92struct std::hash<sbx::math::color> {
93 auto operator()(
const sbx::math::color& color)
const noexcept -> std::size_t;