12#include "actsvg/core/style.hpp"
20namespace detray::svgtools::styling::colors {
23template <
typename container_t>
24inline auto pick_random(container_t container) {
25 typename container_t::value_type
c{};
26 std::sample(container.cbegin(), container.cend(), &c, 1,
27 std::mt19937{std::random_device{}()});
32inline constexpr std::array black{0, 0, 0};
33inline constexpr std::array dark_grey{171, 171, 171};
34inline constexpr std::array mortar{89, 89, 89};
35inline constexpr std::array suva_grey{137, 137, 137};
36inline constexpr std::array very_light_grey{207, 207, 207};
39inline constexpr std::array red{255, 0, 0};
40inline constexpr std::array cardinal{167, 51, 63};
41inline constexpr std::array madder{165, 28, 48};
42inline constexpr std::array auburn{167, 51, 63};
43inline constexpr std::array burgundy{116, 18, 29};
44inline constexpr std::array chocolate_cosmos{88, 12, 31};
45inline constexpr std::array macaroni_and_cheese{255, 188, 121};
46inline constexpr std::array pumpkin{255, 128, 14};
47inline constexpr std::array tenne{200, 82, 0};
50inline constexpr std::array blue{0, 0, 255};
51inline constexpr std::array celestial_blue{62, 146, 204};
52inline constexpr std::array cerulean{0, 107, 164};
53inline constexpr std::array lapis_lazulli{42, 98, 143};
54inline constexpr std::array picton_blue{95, 158, 209};
55inline constexpr std::array prussian_blue1{19, 41, 61};
56inline constexpr std::array prussian_blue2{22, 50, 79};
57inline constexpr std::array indigo_dye{24, 67, 90};
58inline constexpr std::array sail{162, 200, 236};
61inline constexpr std::array green{0, 255, 0};
62inline constexpr std::array celadon{190, 230, 206};
63inline constexpr std::array aquamarine1{188, 255, 219};
64inline constexpr std::array aquamarine2{141, 255, 205};
65inline constexpr std::array emerald{104, 216, 155};
66inline constexpr std::array shamrock_green{79, 157, 105};
69inline constexpr std::array yellow{0, 255, 0};
73inline std::vector<actsvg::style::color> rainbow_scale{
74 actsvg::style::color{{255, 0, 0}, 1.f},
75 actsvg::style::color{{255, 51, 0}, 1.f},
76 actsvg::style::color{{255, 102, 0}, 1.f},
77 actsvg::style::color{{255, 153, 0}, 1.f},
78 actsvg::style::color{{255, 204, 0}, 1.f},
79 actsvg::style::color{{255, 255, 0}, 1.f},
80 actsvg::style::color{{204, 255, 0}, 1.f},
81 actsvg::style::color{{153, 255, 0}, 1.f},
82 actsvg::style::color{{102, 255, 0}, 1.f},
83 actsvg::style::color{{51, 255, 0}, 1.f},
84 actsvg::style::color{{0, 255, 0}, 1.f},
85 actsvg::style::color{{0, 255, 51}, 1.f},
86 actsvg::style::color{{0, 255, 102}, 1.f},
87 actsvg::style::color{{0, 255, 153}, 1.f},
88 actsvg::style::color{{0, 255, 204}, 1.f},
89 actsvg::style::color{{0, 255, 255}, 1.f},
90 actsvg::style::color{{0, 204, 255}, 1.f},
91 actsvg::style::color{{0, 153, 255}, 1.f},
92 actsvg::style::color{{0, 102, 255}, 1.f},
93 actsvg::style::color{{0, 51, 255}, 1.f}};
95inline std::vector<actsvg::style::color> viridis_scale{
96 actsvg::style::color{{253, 231, 37}, 1.f},
97 actsvg::style::color{{221, 227, 24}, 1.f},
98 actsvg::style::color{{186, 222, 40}, 1.f},
99 actsvg::style::color{{149, 216, 64}, 1.f},
100 actsvg::style::color{{117, 208, 84}, 1.f},
101 actsvg::style::color{{86, 198, 103}, 1.f},
102 actsvg::style::color{{61, 188, 116}, 1.f},
103 actsvg::style::color{{41, 175, 127}, 1.f},
104 actsvg::style::color{{32, 163, 134}, 1.f},
105 actsvg::style::color{{31, 150, 139}, 1.f},
106 actsvg::style::color{{35, 138, 141}, 1.f},
107 actsvg::style::color{{40, 125, 142}, 1.f},
108 actsvg::style::color{{45, 113, 142}, 1.f},
109 actsvg::style::color{{51, 99, 141}, 1.f},
110 actsvg::style::color{{57, 85, 140}, 1.f},
111 actsvg::style::color{{64, 70, 136}, 1.f},
112 actsvg::style::color{{69, 55, 129}, 1.f},
113 actsvg::style::color{{72, 37, 118}, 1.f},
114 actsvg::style::color{{72, 20, 103}, 1.f},
115 actsvg::style::color{{68, 1, 84}, 1.f}};
117inline std::vector<actsvg::style::color> plasma_scale{
118 actsvg::style::color{{240, 249, 33}, 1.f},
119 actsvg::style::color{{247, 226, 37}, 1.f},
120 actsvg::style::color{{252, 205, 37}, 1.f},
121 actsvg::style::color{{254, 183, 45}, 1.f},
122 actsvg::style::color{{252, 163, 56}, 1.f},
123 actsvg::style::color{{247, 144, 68}, 1.f},
124 actsvg::style::color{{240, 127, 79}, 1.f},
125 actsvg::style::color{{231, 110, 91}, 1.f},
126 actsvg::style::color{{221, 94, 102}, 1.f},
127 actsvg::style::color{{209, 78, 114}, 1.f},
128 actsvg::style::color{{197, 64, 126}, 1.f},
129 actsvg::style::color{{182, 48, 139}, 1.f},
130 actsvg::style::color{{167, 33, 151}, 1.f},
131 actsvg::style::color{{149, 17, 161}, 1.f},
132 actsvg::style::color{{131, 5, 167}, 1.f},
133 actsvg::style::color{{110, 0, 168}, 1.f},
134 actsvg::style::color{{89, 1, 165}, 1.f},
135 actsvg::style::color{{67, 3, 158}, 1.f},
136 actsvg::style::color{{44, 5, 148}, 1.f},
137 actsvg::style::color{{13, 8, 135}, 1.f},
141inline std::vector<actsvg::style::gradient::stop> generate_stops(
142 const std::vector<actsvg::style::color> &scale,
unsigned int n_stops) {
143 if (n_stops > scale.size()) {
144 throw std::invalid_argument(
145 "Too many gradient stops for given color scale! Color scale has "
147 std::to_string(scale.size()) +
" entries.");
150 std::vector<actsvg::style::gradient::stop> stops{};
151 stops.reserve(n_stops);
154 std::size_t color_step{
static_cast<std::size_t
>(scale.size() / n_stops)};
155 std::size_t i_color{0
u};
158 float grad_step{1.f /
static_cast<float>(n_stops - 1u)};
161 for (std::size_t i = 0u; i < n_stops; ++i) {
162 stops.push_back(actsvg::style::gradient::stop{grad, scale.at(i_color)});
164 i_color += color_step;
173inline std::vector<actsvg::style::color> black_theme(
174 const actsvg::scalar opacity) {
175 return {{black, opacity}};
178inline std::vector<actsvg::style::color> red_theme(
179 const actsvg::scalar opacity) {
180 return {{cardinal, opacity},
184 {chocolate_cosmos, opacity}};
187inline std::vector<actsvg::style::color> blue_theme(
188 const actsvg::scalar opacity) {
189 return {{celestial_blue, opacity},
190 {lapis_lazulli, opacity},
191 {prussian_blue1, opacity},
192 {prussian_blue2, opacity},
193 {indigo_dye, opacity}};
196inline std::vector<actsvg::style::color> green_theme(
197 const actsvg::scalar opacity) {
198 return {{emerald, opacity},
199 {shamrock_green, opacity},
201 {aquamarine1, opacity},
202 {aquamarine2, opacity}};
212 const actsvg::scalar opacity) {
213 return {{dark_grey, opacity},
215 {suva_grey, opacity},
216 {very_light_grey, opacity}};
222 const actsvg::scalar opacity) {
223 return {{cerulean, opacity}, {picton_blue, opacity}, {sail, opacity}};
229 const actsvg::scalar opacity) {
231 {tenne, opacity}, {pumpkin, opacity}, {macaroni_and_cheese, opacity}};
constexpr double c
Speed of light in vacuum - native unit (dimensionless).
Definition Units.hpp:236
constexpr double u
atomic mass unit u
Definition Units.hpp:155