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/utility.hpp"
8#include "../macros.hpp"
9#include <string>
10#include <ostream>
11
12hi_export_module(hikogui.settings.theme_mode);
13
14namespace hi::inline v1 {
15
16enum class theme_mode { light, dark };
17
18constexpr auto theme_mode_metadata = enum_metadata{theme_mode::light, "light", theme_mode::dark, "dark"};
19
20[[nodiscard]] inline std::string_view to_string(theme_mode rhs) noexcept
21{
22 return theme_mode_metadata[rhs];
23}
24
25inline std::ostream &operator<<(std::ostream &lhs, theme_mode rhs)
26{
27 return lhs << theme_mode_metadata[rhs];
28}
29
30} // namespace hi::inline v1
31
32template<typename CharT>
33struct std::formatter<hi::theme_mode, CharT> : std::formatter<std::string_view, CharT> {
34 auto format(hi::theme_mode const &t, auto &fc) const
35 {
36 return std::formatter<std::string_view, CharT>::format(hi::theme_mode_metadata[t], fc);
37 }
38};
DOXYGEN BUG.
Definition algorithm.hpp:16
@ light
300: Light
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
T to_string(T... args)