117 color background_color;
119 color caret_primary_color;
120 color caret_secondary_color;
121 color caret_overwrite_color;
122 color caret_compose_color;
123 color selection_color;
143 uint64_t text_theme_assigned : 1 = 0;
144 uint64_t background_color_assigned : 1 = 0;
145 uint64_t fill_color_assigned : 1 = 0;
146 uint64_t caret_primary_color_assigned : 1 = 0;
147 uint64_t caret_secondary_color_assigned : 1 = 0;
148 uint64_t caret_overwrite_color_assigned : 1 = 0;
149 uint64_t caret_compose_color_assigned : 1 = 0;
150 uint64_t selection_color_assigned : 1 = 0;
151 uint64_t border_color_assigned : 1 = 0;
152 uint64_t border_bottom_left_radius_assigned : 1 = 0;
153 uint64_t border_bottom_right_radius_assigned : 1 = 0;
154 uint64_t border_top_left_radius_assigned : 1 = 0;
155 uint64_t border_top_right_radius_assigned : 1 = 0;
156 uint64_t border_width_assigned : 1 = 0;
157 uint64_t width_assigned : 1 = 0;
158 uint64_t height_assigned : 1 = 0;
159 uint64_t margin_bottom_assigned : 1 = 0;
160 uint64_t margin_left_assigned : 1 = 0;
161 uint64_t margin_top_assigned : 1 = 0;
162 uint64_t margin_right_assigned : 1 = 0;
164 uint64_t text_theme_important : 1 = 0;
165 uint64_t background_color_important : 1 = 0;
166 uint64_t fill_color_important : 1 = 0;
167 uint64_t caret_primary_color_important : 1 = 0;
168 uint64_t caret_secondary_color_important : 1 = 0;
169 uint64_t caret_overwrite_color_important : 1 = 0;
170 uint64_t caret_compose_color_important : 1 = 0;
171 uint64_t selection_color_important : 1 = 0;
172 uint64_t border_color_important : 1 = 0;
173 uint64_t border_bottom_left_radius_important : 1 = 0;
174 uint64_t border_bottom_right_radius_important : 1 = 0;
175 uint64_t border_top_left_radius_important : 1 = 0;
176 uint64_t border_top_right_radius_important : 1 = 0;
177 uint64_t border_width_important : 1 = 0;
178 uint64_t width_important : 1 = 0;
179 uint64_t height_important : 1 = 0;
180 uint64_t margin_bottom_important : 1 = 0;
181 uint64_t margin_left_important : 1 = 0;
182 uint64_t margin_top_important : 1 = 0;
183 uint64_t margin_right_important : 1 = 0;
185 void clear()
noexcept
189 background_color = {};
191 caret_primary_color = {};
192 caret_secondary_color = {};
193 caret_overwrite_color = {};
194 caret_compose_color = {};
195 selection_color = {};
198 border_bottom_left_radius =
dips{0};
199 border_bottom_right_radius =
dips{0};
200 border_top_left_radius =
dips{0};
201 border_top_right_radius =
dips{0};
202 border_width =
dips{0};
206 margin_bottom =
dips{0};
207 margin_left =
dips{0};
208 margin_top =
dips{0};
209 margin_right =
dips{0};
212 cap_height =
dips{0};
213 line_height =
dips{0};
215 text_theme_assigned = 0;
216 background_color_assigned = 0;
217 fill_color_assigned = 0;
218 caret_primary_color_assigned = 0;
219 caret_secondary_color_assigned = 0;
220 caret_overwrite_color_assigned = 0;
221 caret_compose_color_assigned = 0;
222 selection_color_assigned = 0;
223 border_color_assigned = 0;
224 border_bottom_left_radius_assigned = 0;
225 border_bottom_right_radius_assigned = 0;
226 border_top_left_radius_assigned = 0;
227 border_top_right_radius_assigned = 0;
228 border_width_assigned = 0;
231 margin_bottom_assigned = 0;
232 margin_left_assigned = 0;
233 margin_top_assigned = 0;
234 margin_right_assigned = 0;
236 text_theme_important = 0;
237 background_color_important = 0;
238 fill_color_important = 0;
239 caret_primary_color_important = 0;
240 caret_secondary_color_important = 0;
241 caret_overwrite_color_important = 0;
242 caret_compose_color_important = 0;
243 selection_color_important = 0;
244 border_color_important = 0;
245 border_bottom_left_radius_important = 0;
246 border_bottom_right_radius_important = 0;
247 border_top_left_radius_important = 0;
248 border_top_right_radius_important = 0;
249 border_width_important = 0;
251 height_important = 0;
252 margin_bottom_important = 0;
253 margin_left_important = 0;
254 margin_top_important = 0;
255 margin_right_important = 0;
277 hilet lock = std::scoped_lock(_map_mutex);
281 _map[std::format(
"/{}", tag)] =
this;
284 void clear()
noexcept
286 for (
auto& sub_model : _sub_model_by_state) {
293 return _sub_model_by_state[to_underlying(state)];
296 [[nodiscard]]
theme_sub_model const& operator[](theme_state state)
const noexcept
298 return _sub_model_by_state[to_underlying(state)];
301 [[nodiscard]]
theme_sub_model const& get_model(theme_delegate
auto const *delegate)
const noexcept
305 hilet selector = delegate->sub_theme_selector();
306 return (*
this)[selector.state];
313 hilet selector = delegate->sub_theme_selector();
314 hi_axiom(selector.scale < 0.0f,
"scale must be negative so that negative points are converted to positive pixels");
316 return {(*this)[selector.state], selector.scale};
327 hilet[model, scale] = get_model_and_scale(delegate);
328 auto r = model.text_theme;
331 for (
auto& style : r) {
342 return get_model(delegate).background_color;
345 [[nodiscard]]
color fill_color(theme_delegate
auto const *delegate)
const noexcept
347 return get_model(delegate).fill_color;
350 [[nodiscard]] color caret_primary_color(theme_delegate
auto const *delegate)
const noexcept
352 return get_model(delegate).caret_primary_color;
355 [[nodiscard]] color caret_secondary_color(theme_delegate
auto const *delegate)
const noexcept
357 return get_model(delegate).caret_secondary_color;
360 [[nodiscard]] color caret_overwrite_color(theme_delegate
auto const *delegate)
const noexcept
362 return get_model(delegate).caret_overwrite_color;
365 [[nodiscard]] color caret_compose_color(theme_delegate
auto const *delegate)
const noexcept
367 return get_model(delegate).caret_compose_color;
370 [[nodiscard]] color selection_color(theme_delegate
auto const *delegate)
const noexcept
372 return get_model(delegate).selection_color;
375 [[nodiscard]] color border_color(theme_delegate
auto const *delegate)
const noexcept
377 return get_model(delegate).border_color;
380 [[nodiscard]]
float border_bottom_left_radius(theme_delegate
auto const *delegate)
const noexcept
382 hilet[model, scale] = get_model_and_scale(delegate);
383 return std::ceil(model.border_bottom_left_radius(scale));
386 [[nodiscard]]
float border_bottom_right_radius(theme_delegate
auto const *delegate)
const noexcept
388 hilet[model, scale] = get_model_and_scale(delegate);
389 return std::ceil(model.border_bottom_right_radius(scale));
392 [[nodiscard]]
float border_top_left_radius(theme_delegate
auto const *delegate)
const noexcept
394 hilet[model, scale] = get_model_and_scale(delegate);
395 return std::ceil(model.border_top_left_radius(scale));
398 [[nodiscard]]
float border_top_right_radius(theme_delegate
auto const *delegate)
const noexcept
400 hilet[model, scale] = get_model_and_scale(delegate);
401 return std::ceil(model.border_top_right_radius(scale));
404 [[nodiscard]] corner_radii border_radius(theme_delegate
auto const *delegate)
const noexcept
406 hilet[model, scale] = get_model_and_scale(delegate);
407 return ceil(corner_radii{
408 model.border_bottom_left_radius(scale),
409 model.border_bottom_right_radius(scale),
410 model.border_top_left_radius(scale),
411 model.border_top_right_radius(scale)});
414 [[nodiscard]]
float border_width(theme_delegate
auto const *delegate)
const noexcept
416 hilet[model, scale] = get_model_and_scale(delegate);
417 return std::ceil(model.border_width(scale));
420 [[nodiscard]]
float width(theme_delegate
auto const *delegate)
const noexcept
422 hilet[model, scale] = get_model_and_scale(delegate);
426 [[nodiscard]]
float height(theme_delegate
auto const *delegate)
const noexcept
428 hilet[model, scale] = get_model_and_scale(delegate);
432 [[nodiscard]]
extent2 size(theme_delegate
auto const *delegate)
const noexcept
434 hilet[model, scale] = get_model_and_scale(delegate);
438 [[nodiscard]]
float margin_bottom(theme_delegate
auto const *delegate)
const noexcept
440 hilet[model, scale] = get_model_and_scale(delegate);
441 return std::ceil(model.margin_bottom(scale));
444 [[nodiscard]]
float margin_left(theme_delegate
auto const *delegate)
const noexcept
446 hilet[model, scale] = get_model_and_scale(delegate);
447 return std::ceil(model.margin_left(scale));
450 [[nodiscard]]
float margin_top(theme_delegate
auto const *delegate)
const noexcept
452 hilet[model, scale] = get_model_and_scale(delegate);
453 return std::ceil(model.margin_top(scale));
456 [[nodiscard]]
float margin_right(theme_delegate
auto const *delegate)
const noexcept
458 hilet[model, scale] = get_model_and_scale(delegate);
459 return std::ceil(model.margin_right(scale));
462 [[nodiscard]] margins margin(theme_delegate
auto const *delegate)
const noexcept
464 hilet[model, scale] = get_model_and_scale(delegate);
465 return ceil(margins{model.margin_left(scale), model.margin_bottom(scale), model.margin_right(scale), model.margin_top(scale)});
468 [[nodiscard]]
float x_height(theme_delegate
auto const *delegate)
const noexcept
470 hilet[model, scale] = get_model_and_scale(delegate);
474 [[nodiscard]]
float cap_height(theme_delegate
auto const *delegate)
const noexcept
476 hilet[model, scale] = get_model_and_scale(delegate);
477 return std::ceil(model.cap_height(scale));
480 [[nodiscard]]
float line_height(theme_delegate
auto const *delegate)
const noexcept
482 hilet[model, scale] = get_model_and_scale(delegate);
483 return std::ceil(model.line_height(scale));
488 hilet lock = std::scoped_lock(_map_mutex);
492 for (
auto& [key, value] : _map) {
499 [[nodiscard]]
static theme_model_base& model_by_key(
std::string const& key)
501 hilet lock = std::scoped_lock(_map_mutex);
503 if (
hilet it = _map.find(key); it != _map.end()) {
504 auto *
const ptr = it->second;
520 inline static unfair_mutex_without_deadlock_detector _map_mutex;