125 color background_color;
127 color caret_primary_color;
128 color caret_secondary_color;
129 color caret_overwrite_color;
130 color caret_compose_color;
131 color selection_color;
153 uint64_t text_theme_assigned : 1 = 0;
154 uint64_t background_color_assigned : 1 = 0;
155 uint64_t fill_color_assigned : 1 = 0;
156 uint64_t caret_primary_color_assigned : 1 = 0;
157 uint64_t caret_secondary_color_assigned : 1 = 0;
158 uint64_t caret_overwrite_color_assigned : 1 = 0;
159 uint64_t caret_compose_color_assigned : 1 = 0;
160 uint64_t selection_color_assigned : 1 = 0;
161 uint64_t border_color_assigned : 1 = 0;
162 uint64_t border_bottom_left_radius_assigned : 1 = 0;
163 uint64_t border_bottom_right_radius_assigned : 1 = 0;
164 uint64_t border_top_left_radius_assigned : 1 = 0;
165 uint64_t border_top_right_radius_assigned : 1 = 0;
166 uint64_t border_width_assigned : 1 = 0;
167 uint64_t width_assigned : 1 = 0;
168 uint64_t height_assigned : 1 = 0;
169 uint64_t margin_bottom_assigned : 1 = 0;
170 uint64_t margin_left_assigned : 1 = 0;
171 uint64_t margin_top_assigned : 1 = 0;
172 uint64_t margin_right_assigned : 1 = 0;
173 uint64_t spacing_vertical_assigned : 1 = 0;
174 uint64_t spacing_horizontal_assigned : 1 = 0;
176 uint64_t text_theme_important : 1 = 0;
177 uint64_t background_color_important : 1 = 0;
178 uint64_t fill_color_important : 1 = 0;
179 uint64_t caret_primary_color_important : 1 = 0;
180 uint64_t caret_secondary_color_important : 1 = 0;
181 uint64_t caret_overwrite_color_important : 1 = 0;
182 uint64_t caret_compose_color_important : 1 = 0;
183 uint64_t selection_color_important : 1 = 0;
184 uint64_t border_color_important : 1 = 0;
185 uint64_t border_bottom_left_radius_important : 1 = 0;
186 uint64_t border_bottom_right_radius_important : 1 = 0;
187 uint64_t border_top_left_radius_important : 1 = 0;
188 uint64_t border_top_right_radius_important : 1 = 0;
189 uint64_t border_width_important : 1 = 0;
190 uint64_t width_important : 1 = 0;
191 uint64_t height_important : 1 = 0;
192 uint64_t margin_bottom_important : 1 = 0;
193 uint64_t margin_left_important : 1 = 0;
194 uint64_t margin_top_important : 1 = 0;
195 uint64_t margin_right_important : 1 = 0;
196 uint64_t spacing_vertical_important : 1 = 0;
197 uint64_t spacing_horizontal_important : 1 = 0;
199 void clear()
noexcept
203 background_color = {};
205 caret_primary_color = {};
206 caret_secondary_color = {};
207 caret_overwrite_color = {};
208 caret_compose_color = {};
209 selection_color = {};
212 border_bottom_left_radius =
dips{0};
213 border_bottom_right_radius =
dips{0};
214 border_top_left_radius =
dips{0};
215 border_top_right_radius =
dips{0};
216 border_width =
dips{0};
220 margin_bottom =
dips{0};
221 margin_left =
dips{0};
222 margin_top =
dips{0};
223 margin_right =
dips{0};
224 spacing_vertical =
dips{0};
225 spacing_horizontal =
dips{0};
228 cap_height =
dips{0};
229 line_height =
dips{0};
231 text_theme_assigned = 0;
232 background_color_assigned = 0;
233 fill_color_assigned = 0;
234 caret_primary_color_assigned = 0;
235 caret_secondary_color_assigned = 0;
236 caret_overwrite_color_assigned = 0;
237 caret_compose_color_assigned = 0;
238 selection_color_assigned = 0;
239 border_color_assigned = 0;
240 border_bottom_left_radius_assigned = 0;
241 border_bottom_right_radius_assigned = 0;
242 border_top_left_radius_assigned = 0;
243 border_top_right_radius_assigned = 0;
244 border_width_assigned = 0;
247 margin_bottom_assigned = 0;
248 margin_left_assigned = 0;
249 margin_top_assigned = 0;
250 margin_right_assigned = 0;
251 spacing_vertical_assigned = 0;
252 spacing_horizontal_assigned = 0;
254 text_theme_important = 0;
255 background_color_important = 0;
256 fill_color_important = 0;
257 caret_primary_color_important = 0;
258 caret_secondary_color_important = 0;
259 caret_overwrite_color_important = 0;
260 caret_compose_color_important = 0;
261 selection_color_important = 0;
262 border_color_important = 0;
263 border_bottom_left_radius_important = 0;
264 border_bottom_right_radius_important = 0;
265 border_top_left_radius_important = 0;
266 border_top_right_radius_important = 0;
267 border_width_important = 0;
269 height_important = 0;
270 margin_bottom_important = 0;
271 margin_left_important = 0;
272 margin_top_important = 0;
273 margin_right_important = 0;
274 spacing_vertical_important = 0;
275 spacing_horizontal_important = 0;
297 hilet lock = std::scoped_lock(_map_mutex);
301 _map[std::format(
"/{}", tag)] =
this;
304 void clear()
noexcept
306 for (
auto &sub_model: _sub_model_by_state) {
313 return _sub_model_by_state[to_underlying(state)];
316 [[nodiscard]]
theme_sub_model const& operator[](theme_state state)
const noexcept
318 return _sub_model_by_state[to_underlying(state)];
321 [[nodiscard]]
theme_sub_model const& get_model(theme_delegate
auto const *delegate)
const noexcept
325 hilet selector = delegate->sub_theme_selector();
326 return (*
this)[selector.state];
333 hilet selector = delegate->sub_theme_selector();
334 hi_axiom(selector.scale < 0,
"scale must be negative so that negative points are converted to positive pixels");
336 return {(*this)[selector.state], selector.scale};
347 hilet[model, scale] = get_model_and_scale(delegate);
348 auto r = model.text_theme;
351 for (
auto &style: r) {
366 return get_model(delegate).background_color;
369 [[nodiscard]]
color fill_color(theme_delegate
auto const *delegate)
const noexcept
371 return get_model(delegate).fill_color;
374 [[nodiscard]] color caret_primary_color(theme_delegate
auto const *delegate)
const noexcept
376 return get_model(delegate).caret_primary_color;
379 [[nodiscard]] color caret_secondary_color(theme_delegate
auto const *delegate)
const noexcept
381 return get_model(delegate).caret_secondary_color;
384 [[nodiscard]] color caret_overwrite_color(theme_delegate
auto const *delegate)
const noexcept
386 return get_model(delegate).caret_overwrite_color;
389 [[nodiscard]] color caret_compose_color(theme_delegate
auto const *delegate)
const noexcept
391 return get_model(delegate).caret_compose_color;
394 [[nodiscard]] color selection_color(theme_delegate
auto const *delegate)
const noexcept
396 return get_model(delegate).selection_color;
399 [[nodiscard]] color border_color(theme_delegate
auto const *delegate)
const noexcept
401 return get_model(delegate).border_color;
404 [[nodiscard]]
int border_bottom_left_radius(theme_delegate
auto const *delegate)
const noexcept
406 hilet[model, scale] = get_model_and_scale(delegate);
407 return model.border_bottom_left_radius(scale);
410 [[nodiscard]]
int border_bottom_right_radius(theme_delegate
auto const *delegate)
const noexcept
412 hilet[model, scale] = get_model_and_scale(delegate);
413 return model.border_bottom_right_radius(scale);
416 [[nodiscard]]
int border_top_left_radius(theme_delegate
auto const *delegate)
const noexcept
418 hilet[model, scale] = get_model_and_scale(delegate);
419 return model.border_top_left_radius(scale);
422 [[nodiscard]]
int border_top_right_radius(theme_delegate
auto const *delegate)
const noexcept
424 hilet[model, scale] = get_model_and_scale(delegate);
425 return model.border_top_right_radius(scale);
428 [[nodiscard]] corner_radiii border_radius(theme_delegate
auto const *delegate)
const noexcept
431 border_bottom_left_radius(delegate),
432 border_bottom_right_radius(delegate),
433 border_top_left_radius(delegate),
434 border_top_right_radius(delegate)};
437 [[nodiscard]]
int border_width(theme_delegate
auto const *delegate)
const noexcept
439 hilet[model, scale] = get_model_and_scale(delegate);
440 return model.border_width(scale);
443 [[nodiscard]]
int width(theme_delegate
auto const *delegate)
const noexcept
445 hilet[model, scale] = get_model_and_scale(delegate);
446 return model.width(scale);
449 [[nodiscard]]
int height(theme_delegate
auto const *delegate)
const noexcept
451 hilet[model, scale] = get_model_and_scale(delegate);
452 return model.height(scale);
455 [[nodiscard]]
extent2i size(theme_delegate
auto const *delegate)
const noexcept
457 return {width(delegate), height(delegate)};
460 [[nodiscard]]
int margin_bottom(theme_delegate
auto const *delegate)
const noexcept
462 hilet[model, scale] = get_model_and_scale(delegate);
463 return model.margin_bottom(scale);
466 [[nodiscard]]
int margin_left(theme_delegate
auto const *delegate)
const noexcept
468 hilet[model, scale] = get_model_and_scale(delegate);
469 return model.margin_left(scale);
472 [[nodiscard]]
int margin_top(theme_delegate
auto const *delegate)
const noexcept
474 hilet[model, scale] = get_model_and_scale(delegate);
475 return model.margin_top(scale);
478 [[nodiscard]]
int margin_right(theme_delegate
auto const *delegate)
const noexcept
480 hilet[model, scale] = get_model_and_scale(delegate);
481 return model.margin_right(scale);
484 [[nodiscard]] marginsi margin(theme_delegate
auto const *delegate)
const noexcept
486 return {margin_left(delegate), margin_bottom(delegate), margin_right(delegate), margin_top(delegate)};
489 [[nodiscard]]
int spacing_vertical(theme_delegate
auto const *delegate)
const noexcept
491 hilet[model, scale] = get_model_and_scale(delegate);
492 return model.spacing_vertical(scale);
495 [[nodiscard]]
int spacing_horizontal(theme_delegate
auto const *delegate)
const noexcept
497 hilet[model, scale] = get_model_and_scale(delegate);
498 return model.spacing_horizontal(scale);
501 [[nodiscard]]
int x_height(theme_delegate
auto const *delegate)
const noexcept
503 hilet[model, scale] = get_model_and_scale(delegate);
504 return model.x_height(scale);
507 [[nodiscard]]
int cap_height(theme_delegate
auto const *delegate)
const noexcept
509 hilet[model, scale] = get_model_and_scale(delegate);
510 return model.cap_height(scale);
513 [[nodiscard]]
int line_height(theme_delegate
auto const *delegate)
const noexcept
515 hilet[model, scale] = get_model_and_scale(delegate);
516 return model.line_height(scale);
521 hilet lock = std::scoped_lock(_map_mutex);
525 for (
auto& [key, value] : _map) {
532 [[nodiscard]]
static theme_model_base& model_by_key(
std::string const& key)
534 hilet lock = std::scoped_lock(_map_mutex);
536 if (
hilet it = _map.find(key); it != _map.end()) {
537 auto *
const ptr = it->second;
553 inline static unfair_mutex_without_deadlock_detector _map_mutex;