HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
theme_mode.hpp
1// Copyright Take Vos 2020-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 "../utility.hpp"
8#include "../assert.hpp"
9#include "../enum_metadata.hpp"
10#include <string>
11#include <ostream>
12
13namespace hi::inline v1 {
14
15enum class theme_mode { light, dark };
16
17constexpr auto theme_mode_metadata = enum_metadata{theme_mode::light, "light", theme_mode::dark, "dark"};
18
19[[nodiscard]] inline std::string_view to_string(theme_mode rhs) noexcept
20{
21 return theme_mode_metadata[rhs];
22}
23
24inline std::ostream &operator<<(std::ostream &lhs, theme_mode rhs)
25{
26 return lhs << theme_mode_metadata[rhs];
27}
28
29} // namespace hi::inline v1
30
31template<typename CharT>
32struct std::formatter<hi::theme_mode, CharT> : std::formatter<std::string_view, CharT> {
33 auto format(hi::theme_mode const &t, auto &fc)
34 {
35 return std::formatter<std::string_view, CharT>::format(hi::theme_mode_metadata[t], fc);
36 }
37};
Utilities to assert and bound check.
Utilities used by the HikoGUI library itself.
constexpr std::string to_string(std::u32string_view rhs) noexcept
Conversion from UTF-32 to UTF-8.
Definition to_string.hpp:215
DOXYGEN BUG.
Definition algorithm.hpp:15
geometry/margins.hpp
Definition assert.hpp:18