dice-gui/src/style.h
2025-09-16 21:49:42 +02:00

88 lines
1.9 KiB
C++

#ifndef STYLE_H
#define STYLE_H
#include "defs.h"
#include <clay/clay.h>
#include <stdint.h>
////////////////////////////////////
// CONTAINER STYLE
////////////////////////////////////
constexpr uint16_t containerGap = 5;
constexpr Clay_Padding containerPadding = {
32, 32,
16, 16
};
constexpr Clay_Color containerColors[] = {
{ 255*0.25, 255*0.25, 255*0.25, 255 },
{ 255*0.2, 255*0.2, 255*0.2, 255 },
{ 255*0.1, 255*0.1, 255*0.1, 255 },
};
constexpr Clay_Sizing layoutExpand = {
.width = CLAY_SIZING_GROW(0),
.height = CLAY_SIZING_GROW(0)
};
constexpr float defaultRadius = 5.f;
constexpr Clay_CornerRadius defaultRadiusAll = {
defaultRadius, defaultRadius,
defaultRadius, defaultRadius
};
#define INNER_CONTAINER(depth_) \
backgroundColor = containerColors[depth_],\
.cornerRadius = defaultRadiusAll
////////////////////////////////////
// WINDOW STYLE
////////////////////////////////////
constexpr float windowPadding = 5;
constexpr Clay_Color windowBackground = {
255*0.35, 255*0.35, 255*0.35, 255
};
constexpr Clay_ElementDeclaration windowStyle = {
.layout = {
.layoutDirection = CLAY_TOP_TO_BOTTOM,
.sizing = layoutExpand,
.padding = CLAY_PADDING_ALL(windowPadding),
.childGap = containerGap,
},
.backgroundColor = windowBackground
};
////////////////////////////////////
// TEXT STYLE
////////////////////////////////////
constexpr float paragraphGap = 10;
constexpr uint16_t baseFontSize = 16;
constexpr Clay_Color textColors[] = {
{ 250, 250, 250, 255 },
{ 250, 250, 250, 255 },
{ 250, 250, 250, 255 },
};
constexpr uint16_t headerSizes[] = {
64, 32, 28, 16
};
#define TEXT_STYLE(color_)\
textColor = textColors[color_]
#define BODY(color_)\
fontId = FONT_DEFAULT,\
.fontSize = baseFontSize,\
.TEXT_STYLE(color_)
#define H(level_, color_)\
fontId = FONT_BOLD,\
.fontSize = headerSizes[(level_)-1],\
.TEXT_STYLE(color_)
#endif // !STYLE_H