FuncSketch
Loading...
Searching...
No Matches
rgb_color.h
Go to the documentation of this file.
1/*
2 * Copyright 2026 MusicScience37 (Kenta Kabashima)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
20#pragma once
21
22#include <cstdint>
23
24#include <fmt/base.h>
25
26namespace func_sketch::plotter {
27
31struct RGBColor {
33 std::uint8_t r;
34
36 std::uint8_t g;
37
39 std::uint8_t b;
40};
41
50inline bool operator==(const RGBColor& left, const RGBColor& right) {
51 return left.r == right.r && left.g == right.g && left.b == right.b;
52}
53
62inline bool operator!=(const RGBColor& left, const RGBColor& right) {
63 return !(left == right);
64}
65
66} // namespace func_sketch::plotter
67
72template <>
73struct fmt::formatter<func_sketch::plotter::RGBColor>
74 : fmt::formatter<string_view> {
82 auto format(const func_sketch::plotter::RGBColor& value,
83 format_context& context) const -> format_context::iterator;
84};
bool operator!=(const RGBColor &left, const RGBColor &right)
Check if two RGBColor objects are equal.
Definition rgb_color.h:62
bool operator==(const RGBColor &left, const RGBColor &right)
Check if two RGBColor objects are equal.
Definition rgb_color.h:50
auto format(const func_sketch::plotter::RGBColor &value, format_context &context) const -> format_context::iterator
Format a value.
Definition rgb_color.cpp:25
Struct of RGB color.
Definition rgb_color.h:31
std::uint8_t g
Green component.
Definition rgb_color.h:36
std::uint8_t r
Red component.
Definition rgb_color.h:33
std::uint8_t b
Blue component.
Definition rgb_color.h:39