29#include "guillaume/theme.hpp"
46 constexpr std::array<SizeMetrics, 3> sizeTable { {
55 std::optional<Role> container;
60 constexpr std::array<Palette, 4> paletteTable { {
61 { std::nullopt, Role::Primary },
62 { Role::PrimaryContainer, Role::OnPrimaryContainer },
63 { Role::SecondaryContainer, Role::OnSecondaryContainer },
64 { Role::TertiaryContainer, Role::OnTertiaryContainer },
67 const SizeMetrics &metrics(std::size_t size)
69 if (size >= sizeTable.size()) {
70 throw std::runtime_error(
"Invalid FAB size");
72 return sizeTable[size];
75 const Palette &palette(std::size_t variant)
77 if (variant >= paletteTable.size()) {
78 throw std::runtime_error(
"Invalid FAB variant");
80 return paletteTable[variant];
86 return metrics(size).containerSize;
91 return metrics(size).iconFontSize;
96 return metrics(size).labelFontSize;
107 const auto role = palette(variant).container;
The table lookups behind the templates, taking the enumerator as an index. Call the templated functio...
float borderRadius(std::size_t size)
Corner radius of the container.
float labelFontSize(std::size_t size)
Font size of the label and icon of an extended FAB.
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.
float containerSize(std::size_t size)
Width and height of the container at its default size.
@ Level1
Lowest raised level.
@ Level3
Third raised level.
ShapeRole
The corner radii a widget can ask for, by name.
@ ExtraLarge
28 dp (dialogs, search bars, sheets).
@ Large
16 dp (FABs, drawers).
utility::graphic::Color32Bit getElevatedSurfaceColor(theme::ElevationLevel level)
Get the background color of a surface raised to an elevation level.
SchemeColorRole
The named colors of a scheme: what a color is used for, not what it looks like.
float getShapeRadius(theme::ShapeRole role)
Get the corner radius the active theme gives to a shape role.
utility::graphic::Color32Bit getActiveColor(SchemeColorRole role)
Get the color the active scheme gives to a role.
Style tables of the floating action buttons (FAB): container size, font sizes, corner radius and colo...