dice-gui/src/style.h

93 lines
2 KiB
C++

#ifndef STYLE_H
#define STYLE_H
#include "defs.h"
#include "dice.h"
#include <clay/clay.h>
#include <stdint.h>
////////////////////////////////////
// WINDOW STYLE
////////////////////////////////////
constexpr uint16_t windowPadding = 10;
constexpr float windowBackground = 0.15f;
////////////////////////////////////
// CONTAINER STYLE
////////////////////////////////////
constexpr uint16_t containerGap = 10;
constexpr double defaultRadius = 5.0;
constexpr float containerBackgrounds[] = {
.2f,
.3f,
.4f
};
constexpr float containerBorders[] = {
.3f,
.4f,
.5f
};
constexpr Clay_Padding containerPadding = {
24, 24,
24, 24,
};
#define CONTAINER(depth_)\
backgroundColor = ContainerBackgrounds(depth_),\
.border = { ContainerBorders(depth_), CLAY_BORDER_ALL(2) },\
.cornerRadius = defaultRadiusAll
////////////////////////////////////
// TEXT STYLE
////////////////////////////////////
constexpr float paragraphGap = 10;
constexpr uint16_t baseFontSize = 16;
constexpr float textColorsP[] = {
0.9f,
0.9f,
0.9f
};
constexpr uint16_t headerSizes[] = {
64, 32,
28, 16
};
#define BODY(color_)\
fontId = FONT_DEFAULT,\
.fontSize = baseFontSize
#define H(level_)\
fontId = FONT_BOLD,\
.fontSize = headerSizes[(level_)-1]
////////////////////////////////////
// COMPILATIONS
// | Functions and expressions that combine styling data from the settings above.
////////////////////////////////////
constexpr Clay_Sizing layoutExpand = {
.width = CLAY_SIZING_GROW(0),
.height = CLAY_SIZING_GROW(0)
};
constexpr Clay_CornerRadius defaultRadiusAll = {
defaultRadius, defaultRadius,
defaultRadius, defaultRadius
};
extern Clay_Color ContainerBackgrounds(size_t idx);
extern Clay_Color ContainerBorders(size_t idx);
extern Clay_Color TextColors(size_t idx);
extern Clay_Color WindowBackground();
extern Clay_ElementDeclaration WindowStyle();
extern Clay_Color DieColor(enum die_type die);
extern Clay_Color DieButtonColor(enum die_type die, bool selected);
#endif // !STYLE_H