1#ifndef LIBSBX_MATH_COLOR_HPP_
2#define LIBSBX_MATH_COLOR_HPP_
6#include <yaml-cpp/yaml.h>
10#include <libsbx/math/vector4.hpp>
18 static const color black;
19 static const color white;
20 static const color red;
21 static const color green;
22 static const color blue;
24 color(std::uint32_t rgba)
noexcept;
26 color(std::float_t red, std::float_t green, std::float_t blue, std::float_t alpha)
noexcept;
28 auto r()
const noexcept ->
const std::float_t&;
30 auto r()
noexcept -> std::float_t&;
32 auto g()
const noexcept ->
const std::float_t&;
34 auto g()
noexcept -> std::float_t&;
36 auto b()
const noexcept ->
const std::float_t&;
38 auto b()
noexcept -> std::float_t&;
40 auto a()
const noexcept ->
const std::float_t&;
42 auto a()
noexcept -> std::float_t&;
53auto operator==(
const color& lhs,
const color& rhs)
noexcept -> bool;
58struct YAML::convert<sbx::math::color> {
62 node[
"r"] = color.r();
63 node[
"g"] = color.g();
64 node[
"b"] = color.b();
65 node[
"a"] = color.a();
71 if (!node.IsMap() || node.size() != 4) {
75 color.r() = node[
"r"].as<std::float_t>();
76 color.g() = node[
"g"].as<std::float_t>();
77 color.b() = node[
"b"].as<std::float_t>();
78 color.a() = node[
"a"].as<std::float_t>();
85struct std::hash<sbx::math::color> {
86 auto operator()(
const sbx::math::color& color)
const noexcept -> std::size_t {
87 auto hash = std::size_t{0};
88 sbx::utility::hash_combine(hash, color.r(), color.g(), color.b(), color.a());