2023-Robot
Robot code for 2023 FRC season by Argos, FRC team #1756
Loading...
Searching...
No Matches
color.h
Go to the documentation of this file.
1
4
5#pragma once
6
7#include <array>
8
9namespace argos_lib {
10 struct ArgosColor {
11 int r;
12 int g;
13 int b;
14
15 ArgosColor operator*(double scale) {
16 return ArgosColor{static_cast<int>(r * scale), static_cast<int>(g * scale), static_cast<int>(b * scale)};
17 }
18 };
19
20 // clang-format off
21 constexpr std::array<uint8_t, 256> gamma8 = {
22 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
23 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
24 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
25 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5,
26 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10,
27 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16,
28 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 24, 24, 25,
29 25, 26, 27, 27, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 35, 36,
30 37, 38, 39, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 50,
31 51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68,
32 69, 70, 72, 73, 74, 75, 77, 78, 79, 81, 82, 83, 85, 86, 87, 89,
33 90, 92, 93, 95, 96, 98, 99, 101, 102, 104, 105, 107, 109, 110, 112, 114,
34 115, 117, 119, 120, 122, 124, 126, 127, 129, 131, 133, 135, 137, 138, 140, 142,
35 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 167, 169, 171, 173, 175,
36 177, 180, 182, 184, 186, 189, 191, 193, 196, 198, 200, 203, 205, 208, 210, 213,
37 215, 218, 220, 223, 225, 228, 231, 233, 236, 239, 241, 244, 247, 249, 252, 255};
38 // clang-format on
39
40 namespace colors {
41 constexpr static ArgosColor kOff = ArgosColor{0, 0, 0};
42 constexpr static ArgosColor kWhite = ArgosColor{120, 120, 120};
43 constexpr static ArgosColor kReallyRed = ArgosColor{255, 0, 0};
44 constexpr static ArgosColor kReallyGreen = ArgosColor{0, 255, 0};
45 constexpr static ArgosColor kReallyBlue = ArgosColor{0, 0, 255};
46 constexpr static ArgosColor kCubePurple = ArgosColor{130, 0, 130};
47 constexpr static ArgosColor kConeYellow = ArgosColor{222, 178, 18};
48 constexpr static ArgosColor kHotPink = ArgosColor{255, 105, 180};
49 constexpr static ArgosColor kCatYellow = ArgosColor{255, 163, 0}; // Pantone 137C
50 constexpr static ArgosColor kPurple = ArgosColor{75, 0, 130};
51 } // namespace colors
52
53 constexpr ArgosColor GammaCorrect(ArgosColor original) {
54 return ArgosColor{gamma8[original.r], gamma8[original.g], gamma8[original.b]};
55 }
68
69} // namespace argos_lib
static constexpr ArgosColor kCubePurple
Definition color.h:46
static constexpr ArgosColor kHotPink
Definition color.h:48
static constexpr ArgosColor kWhite
Definition color.h:42
static constexpr ArgosColor kReallyGreen
Definition color.h:44
static constexpr ArgosColor kPurple
Definition color.h:50
static constexpr ArgosColor kCatYellow
Definition color.h:49
static constexpr ArgosColor kReallyRed
Definition color.h:43
static constexpr ArgosColor kOff
Definition color.h:41
static constexpr ArgosColor kReallyBlue
Definition color.h:45
static constexpr ArgosColor kConeYellow
Definition color.h:47
static constexpr ArgosColor kReallyBlue
Definition color.h:61
static constexpr ArgosColor kReallyGreen
Definition color.h:60
static constexpr ArgosColor kCatYellow
Definition color.h:65
static constexpr ArgosColor kHotPink
Definition color.h:64
static constexpr ArgosColor kConeYellow
Definition color.h:63
static constexpr ArgosColor kCubePurple
Definition color.h:62
static constexpr ArgosColor kWhite
Definition color.h:58
static constexpr ArgosColor kOff
Definition color.h:57
static constexpr ArgosColor kPurple
Definition color.h:66
static constexpr ArgosColor kReallyRed
Definition color.h:59
Definition swap_controllers_command.h:12
constexpr ArgosColor GammaCorrect(ArgosColor original)
Definition color.h:53
constexpr std::array< uint8_t, 256 > gamma8
Definition color.h:21
Definition color.h:10
ArgosColor operator*(double scale)
Definition color.h:15
int r
Definition color.h:11
int b
Definition color.h:13
int g
Definition color.h:12