guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
guillaume::systems::fab_style Namespace Reference

Maps a FAB size and variant to Material 3 metrics and scheme colors, for the regular and the extended FAB alike. More...

Namespaces

namespace  detail
 The table lookups behind the templates, taking the enumerator as an index. Call the templated functions of fab_style instead.

Functions

template<typename SizeType>
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, 96 dp for Large.
template<typename SizeType>
float getIconFontSize (SizeType size)
 Font size of the icon of a regular FAB: 24 dp for Small and Medium, 36 dp for Large.
template<typename SizeType>
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, 36 dp for Large.
template<typename SizeType>
float getBorderRadius (SizeType size)
 Corner radius of the container: the Medium, Large and ExtraLarge shape of the active theme for a Small, Medium and Large FAB.
template<typename VariantType>
utility::graphic::Color32Bit getContainerColor (VariantType variant, bool lowered)
 Fill color of the container of a FAB.
template<typename VariantType>
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 of the others.

Detailed Description

Maps a FAB size and variant to Material 3 metrics and scheme colors, for the regular and the extended FAB alike.

components::FloatingActionButton and components::ExtendedFloatingActionButton each declare their own Size (Small, Medium, Large) and Variant (Surface, Primary, Secondary, Tertiary) enumerations with the same enumerators in the same order. The functions are therefore templated on the enumeration type and resolve through one shared table, indexed by the integer value of the enumerator.

const float side = fab_style::getContainerSize(Size::Medium); // 56 dp
Size
Size step: a 40, 56 or 96 dp square container around a 24, 24 or 36 dp icon.
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,...
See also
guillaume::systems::FloatingActionButton, guillaume::systems::ExtendedFloatingActionButton, guillaume::systems::button_style

Function Documentation

◆ getBorderRadius()

template<typename SizeType>
float guillaume::systems::fab_style::getBorderRadius ( SizeType size)

Corner radius of the container: the Medium, Large and ExtraLarge shape of the active theme for a Small, Medium and Large FAB.

Template Parameters
SizeTypeThe Size enumeration of the FAB component.
Parameters
sizeThe FAB size.
Returns
The radius, in dp.
Exceptions
std::runtime_errorIf the size is not a valid enumerator.

Definition at line 170 of file fab_style.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getContainerColor()

template<typename VariantType>
utility::graphic::Color32Bit guillaume::systems::fab_style::getContainerColor ( VariantType variant,
bool lowered )

Fill color of the container of a FAB.

Primary, Secondary and Tertiary use the matching container role of the active scheme. Surface has no role of its own: it uses the surface color tinted for elevation level 3, or level 1 when lowered.

Template Parameters
VariantTypeThe Variant enumeration of the FAB component.
Parameters
variantThe FAB variant.
loweredTrue for a FAB drawn at the lowered elevation. Only the Surface variant changes color with it.
Returns
The container color, without any hover or press tint.
Exceptions
std::runtime_errorIf the variant is not a valid enumerator.

Definition at line 189 of file fab_style.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getContainerSize()

template<typename SizeType>
float guillaume::systems::fab_style::getContainerSize ( SizeType size)

Width and height of the container of a FAB at its default size: 40 dp for Small, 56 dp for Medium, 96 dp for Large.

An extended FAB uses it as its height; its width follows the label.

Template Parameters
SizeTypeThe Size enumeration of the FAB component.
Parameters
sizeThe FAB size.
Returns
The extent, in dp.
Exceptions
std::runtime_errorIf the size is not a valid enumerator.

Definition at line 130 of file fab_style.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getContentColor()

template<typename VariantType>
utility::graphic::Color32Bit guillaume::systems::fab_style::getContentColor ( VariantType variant)

Color of the icon and of the label of a FAB: Primary for the Surface variant, the "on container" role of the others.

Template Parameters
VariantTypeThe Variant enumeration of the FAB component.
Parameters
variantThe FAB variant.
Returns
The content color, from the active color scheme.
Exceptions
std::runtime_errorIf the variant is not a valid enumerator.

Definition at line 204 of file fab_style.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIconFontSize()

template<typename SizeType>
float guillaume::systems::fab_style::getIconFontSize ( SizeType size)

Font size of the icon of a regular FAB: 24 dp for Small and Medium, 36 dp for Large.

Template Parameters
SizeTypeThe Size enumeration of the FAB component.
Parameters
sizeThe FAB size.
Returns
The font size, in dp.
Exceptions
std::runtime_errorIf the size is not a valid enumerator.

Definition at line 143 of file fab_style.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLabelFontSize()

template<typename SizeType>
float guillaume::systems::fab_style::getLabelFontSize ( SizeType size)

Font size shared by the label and the icon of an extended FAB: 18 dp for Small, 24 dp for Medium, 36 dp for Large.

Template Parameters
SizeTypeThe Size enumeration of the FAB component.
Parameters
sizeThe FAB size.
Returns
The font size, in dp.
Exceptions
std::runtime_errorIf the size is not a valid enumerator.

Definition at line 156 of file fab_style.hpp.

Here is the call graph for this function:
Here is the caller graph for this function: