51 constexpr color(
color const&)
noexcept =
default;
53 constexpr color& operator=(
color const&)
noexcept =
default;
54 constexpr color& operator=(
color&&)
noexcept =
default;
58 hi_axiom(holds_invariant());
63 [[nodiscard]]
constexpr explicit operator f16x4()
const noexcept
68 [[nodiscard]]
constexpr explicit operator f32x4()
const noexcept
70 return static_cast<f32x4>(_v);
73 [[nodiscard]]
constexpr color(
float r,
float g,
float b,
float a = 1.0f) noexcept :
color(
f32x4{r, g, b, a}) {}
80 _v.y() =
half(std::in_place, 0x0000);
81 _v.z() =
half(std::in_place, 0x0000);
85 [[nodiscard]]
constexpr bool is_semantic()
const noexcept
87 return (_v.x().intrinsic() & 0xf900) == 0xf900;
92 hi_axiom(is_semantic());
97 [[nodiscard]]
constexpr static color blue()
noexcept {
return color{semantic_color::blue}; }
98 [[nodiscard]]
constexpr static color green()
noexcept {
return color{semantic_color::green}; }
99 [[nodiscard]]
constexpr static color indigo()
noexcept {
return color{semantic_color::indigo}; }
100 [[nodiscard]]
constexpr static color orange()
noexcept {
return color{semantic_color::orange}; }
101 [[nodiscard]]
constexpr static color pink()
noexcept {
return color{semantic_color::pink}; }
102 [[nodiscard]]
constexpr static color purple()
noexcept {
return color{semantic_color::purple}; }
103 [[nodiscard]]
constexpr static color red()
noexcept {
return color{semantic_color::red}; }
104 [[nodiscard]]
constexpr static color teal()
noexcept {
return color{semantic_color::teal}; }
105 [[nodiscard]]
constexpr static color yellow()
noexcept {
return color{semantic_color::yellow}; }
106 [[nodiscard]]
constexpr static color gray()
noexcept {
return color{semantic_color::gray}; }
107 [[nodiscard]]
constexpr static color gray2()
noexcept {
return color{semantic_color::gray2}; }
108 [[nodiscard]]
constexpr static color gray3()
noexcept {
return color{semantic_color::gray3}; }
109 [[nodiscard]]
constexpr static color gray4()
noexcept {
return color{semantic_color::gray4}; }
110 [[nodiscard]]
constexpr static color gray5()
noexcept {
return color{semantic_color::gray5}; }
111 [[nodiscard]]
constexpr static color gray6()
noexcept {
return color{semantic_color::gray6}; }
112 [[nodiscard]]
constexpr static color foreground()
noexcept {
return color{semantic_color::foreground}; }
113 [[nodiscard]]
constexpr static color border()
noexcept {
return color{semantic_color::border}; }
114 [[nodiscard]]
constexpr static color fill()
noexcept {
return color{semantic_color::fill}; }
115 [[nodiscard]]
constexpr static color accent()
noexcept {
return color{semantic_color::accent}; }
116 [[nodiscard]]
constexpr static color text_select()
noexcept {
return color{semantic_color::text_select}; }
117 [[nodiscard]]
constexpr static color primary_cursor()
noexcept {
return color{semantic_color::primary_cursor}; }
118 [[nodiscard]]
constexpr static color secondary_cursor()
noexcept {
return color{semantic_color::secondary_cursor}; }
121 [[nodiscard]]
constexpr static color transparent()
noexcept
123 return {0.0f, 0.0f, 0.0f, 0.0f};
126 [[nodiscard]]
constexpr static color white()
noexcept
128 return {1.0f, 1.0f, 1.0f, 1.0f};
131 [[nodiscard]]
constexpr static color black()
noexcept
133 return {0.0f, 0.0f, 0.0f, 1.0f};
136 [[nodiscard]]
size_t hash()
const noexcept
141 [[nodiscard]]
constexpr half& r()
noexcept
146 [[nodiscard]]
constexpr half& g()
noexcept
151 [[nodiscard]]
constexpr half& b()
noexcept
156 [[nodiscard]]
constexpr half& a()
noexcept
161 [[nodiscard]]
constexpr half r()
const noexcept
166 [[nodiscard]]
constexpr half g()
const noexcept
171 [[nodiscard]]
constexpr half b()
const noexcept
176 [[nodiscard]]
constexpr half a()
const noexcept
181 [[nodiscard]]
constexpr bool holds_invariant()
const noexcept
183 return _v.w() >= 0.0 && _v.w() <= 1.0;
186 [[nodiscard]]
constexpr friend bool operator==(
color const& lhs,
color const& rhs)
noexcept
188 return equal(lhs._v, rhs._v);
191 [[nodiscard]]
constexpr friend color operator*(
color const& lhs,
color const& rhs)
noexcept
193 return color{lhs._v * rhs._v};
207 hi_axiom(rhs.holds_invariant());
209 get<0>(lhs) *
static_cast<f32x4>(rhs).xxxx() + get<1>(lhs) *
static_cast<f32x4>(rhs).yyyy() +
210 get<2>(lhs) *
static_cast<f32x4>(rhs).zzzz() + get<3>(lhs)};
constexpr friend color operator*(matrix3 const &lhs, color const &rhs) noexcept
Transform a color by a color matrix.
Definition color_intf.hpp:205