HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
theme_color.hpp
1// Copyright Take Vos 2021.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include "../exception.hpp"
8
9namespace tt {
10
11enum class theme_color : unsigned char {
12 blue,
13 green,
14 indigo,
15 orange,
16 pink,
17 purple,
18 red,
19 teal,
20 yellow,
21
22 gray,
23 gray2,
24 gray3,
25 gray4,
26 gray5,
27 gray6,
28
29 foreground,
30 border,
31 fill,
32 accent,
33 text_select,
34 cursor,
35 incomplete_glyph,
36
37 _size
38};
39
40constexpr size_t num_theme_colors = static_cast<size_t>(theme_color::_size);
41
42[[nodiscard]] inline theme_color theme_color_from_string(std::string_view str)
43{
44 if (str == "blue") {
45 return theme_color::blue;
46 } else if (str == "green") {
47 return theme_color::green;
48 } else if (str == "indigo") {
49 return theme_color::indigo;
50 } else if (str == "orange") {
51 return theme_color::orange;
52 } else if (str == "pink") {
53 return theme_color::pink;
54 } else if (str == "purple") {
55 return theme_color::purple;
56 } else if (str == "red") {
57 return theme_color::red;
58 } else if (str == "teal") {
59 return theme_color::teal;
60 } else if (str == "yellow") {
61 return theme_color::yellow;
62 } else if (str == "gray") {
63 return theme_color::gray;
64 } else if (str == "gray2") {
65 return theme_color::gray2;
66 } else if (str == "gray3") {
67 return theme_color::gray3;
68 } else if (str == "gray4") {
69 return theme_color::gray4;
70 } else if (str == "gray5") {
71 return theme_color::gray5;
72 } else if (str == "gray6") {
73 return theme_color::gray6;
74 } else if (str == "foreground") {
75 return theme_color::foreground;
76 } else if (str == "border") {
77 return theme_color::border;
78 } else if (str == "fill") {
79 return theme_color::fill;
80 } else if (str == "accent") {
81 return theme_color::accent;
82 } else if (str == "text_select") {
83 return theme_color::text_select;
84 } else if (str == "cursor") {
85 return theme_color::cursor;
86 } else if (str == "incomplete_glyph") {
87 return theme_color::incomplete_glyph;
88 } else {
89 throw parse_error("Unknown theme color '{}'", str);
90 }
91}
92
93} // namespace tt
T fill(T... args)