HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
src
ttauri
GUI
theme_mode.hpp
1
// Copyright Take Vos 2020.
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 "../required.hpp"
8
#include "../assert.hpp"
9
#include <string>
10
#include <ostream>
11
12
namespace
tt {
13
14
enum class
theme_mode { light, dark };
15
16
[[nodiscard]]
constexpr
char
const
*to_const_string(theme_mode rhs)
noexcept
17
{
18
switch
(rhs) {
19
case
theme_mode::light:
return
"light"
;
20
case
theme_mode::dark:
return
"dark"
;
21
default
: tt_no_default();
22
}
23
}
24
25
[[nodiscard]]
inline
std::string
to_string
(theme_mode rhs)
noexcept
26
{
27
return
to_const_string(rhs);
28
}
29
30
inline
std::ostream
&operator<<(
std::ostream
&lhs, theme_mode rhs)
31
{
32
return
lhs << to_const_string(rhs);
33
}
34
35
theme_mode read_os_theme_mode() noexcept;
36
37
}
// namespace tt
38
39
namespace
std
{
40
41
template
<
typename
CharT>
42
struct
std::formatter<tt::theme_mode, CharT> : std::formatter<char const *, CharT> {
43
auto
format(tt::theme_mode
const
&t,
auto
&fc)
44
{
45
return
std::formatter<char const *, CharT>::format(tt::to_const_string(t), fc);
46
}
47
};
48
49
}
// namespace std
std
STL namespace.
std::ostream
std::string
std::to_string
T to_string(T... args)
Generated on Mon Apr 22 2024 12:53:30 for HikoGUI by
1.10.0