guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
fab_style.hpp
Go to the documentation of this file.
1/*
2 Copyright (c) 2026 ETIB Corporation
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy of
5 this software and associated documentation files (the "Software"), to deal in
6 the Software without restriction, including without limitation the rights to
7 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 of the Software, and to permit persons to whom the Software is furnished to do
9 so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21 */
22
23#pragma once
24
25#include <cstddef>
26
27#include <utility/graphic/color.hpp>
28
41
64{
69 namespace detail
70 {
77 float containerSize(std::size_t size);
84 float iconFontSize(std::size_t size);
91 float labelFontSize(std::size_t size);
98 float borderRadius(std::size_t size);
108 utility::graphic::Color32Bit containerColor(std::size_t variant,
109 bool lowered);
117 utility::graphic::Color32Bit contentColor(std::size_t variant);
118 } // namespace detail
119
130 template<typename SizeType> float getContainerSize(SizeType size)
131 {
132 return detail::containerSize(static_cast<std::size_t>(size));
133 }
134
143 template<typename SizeType> float getIconFontSize(SizeType size)
144 {
145 return detail::iconFontSize(static_cast<std::size_t>(size));
146 }
147
156 template<typename SizeType> float getLabelFontSize(SizeType size)
157 {
158 return detail::labelFontSize(static_cast<std::size_t>(size));
159 }
160
170 template<typename SizeType> float getBorderRadius(SizeType size)
171 {
172 return detail::borderRadius(static_cast<std::size_t>(size));
173 }
174
188 template<typename VariantType> utility::graphic::Color32Bit
189 getContainerColor(VariantType variant, bool lowered)
190 {
191 return detail::containerColor(static_cast<std::size_t>(variant),
192 lowered);
193 }
194
203 template<typename VariantType>
204 utility::graphic::Color32Bit getContentColor(VariantType variant)
205 {
206 return detail::contentColor(static_cast<std::size_t>(variant));
207 }
208
209} // namespace guillaume::systems::fab_style
The table lookups behind the templates, taking the enumerator as an index. Call the templated functio...
Definition fab_style.hpp:70
float borderRadius(std::size_t size)
Corner radius of the container.
Definition fab_style.cpp:99
float labelFontSize(std::size_t size)
Font size of the label and icon of an extended FAB.
Definition fab_style.cpp:94
utility::graphic::Color32Bit contentColor(std::size_t variant)
Color of the icon and of the label.
utility::graphic::Color32Bit containerColor(std::size_t variant, bool lowered)
Fill color of the container.
float iconFontSize(std::size_t size)
Font size of the icon of a regular FAB.
Definition fab_style.cpp:89
float containerSize(std::size_t size)
Width and height of the container at its default size.
Definition fab_style.cpp:84
Maps a FAB size and variant to Material 3 metrics and scheme colors, for the regular and the extended...
utility::graphic::Color32Bit getContentColor(VariantType variant)
Color of the icon and of the label of a FAB: Primary for the Surface variant, the "on container" role...
float getLabelFontSize(SizeType size)
Font size shared by the label and the icon of an extended FAB: 18 dp for Small, 24 dp for Medium,...
float getContainerSize(SizeType size)
Width and height of the container of a FAB at its default size: 40 dp for Small, 56 dp for Medium,...
utility::graphic::Color32Bit getContainerColor(VariantType variant, bool lowered)
Fill color of the container of a FAB.
float getBorderRadius(SizeType size)
Corner radius of the container: the Medium, Large and ExtraLarge shape of the active theme for a Smal...
float getIconFontSize(SizeType size)
Font size of the icon of a regular FAB: 24 dp for Small and Medium, 36 dp for Large.