feat: reorganized and cleaned up style namespace

This commit is contained in:
Sara Gerretsen 2025-09-22 19:38:39 +02:00
parent 037f18bf5c
commit 94f2211f20
4 changed files with 15 additions and 15 deletions

View file

@ -73,7 +73,7 @@ static void DebugInfoLegend() {
.border = { {255, 0, 255, 255 }, CLAY_BORDER_OUTSIDE(3) }
});
elements::Body(CLAY_STRING("Underpopulated"), {
.textColor = style::TextColors(0)
.textColor = style::TextColor(0)
});
}
CLAY_AUTO_ID({
@ -88,7 +88,7 @@ static void DebugInfoLegend() {
.border = { {255, 0, 0, 255 }, CLAY_BORDER_OUTSIDE(3) }
});
elements::Body(CLAY_STRING("Overpopulated"), {
.textColor = style::TextColors(0)
.textColor = style::TextColor(0)
});
}
CLAY_AUTO_ID({
@ -103,11 +103,11 @@ static void DebugInfoLegend() {
.border = { {0, 255, 0, 255 }, CLAY_BORDER_OUTSIDE(3) }
});
elements::Body(CLAY_STRING("Born"), {
.textColor = style::TextColors(0)
.textColor = style::TextColor(0)
});
}
elements::Body(CLAY_STRING("Warning: Drawing simulation changes\ngreatly lowers performance"), {
.textColor = style::TextColors(3)
.textColor = style::TextColor(3)
});
}
}

View file

@ -18,7 +18,7 @@ void TextButton(Clay_String text, Clay_Color color, OnHoveredFn onHovered, intpt
}) {
Clay_OnHover(onHovered, onHoveredData);
elements::Body(text, {
.textColor = style::TextColors(0),
.textColor = style::TextColor(0),
.textAlignment = CLAY_TEXT_ALIGN_CENTER,
});
}
@ -62,7 +62,7 @@ void Toggle(Clay_String label, Clay_Color selected, bool &state) {
},
}) { }
Body(label, {
.textColor = style::TextColors(0)
.textColor = style::TextColor(0)
});
}
}

View file

@ -57,7 +57,7 @@ Clay_Color PanelBorder(size_t idx) {
};
}
Clay_Color TextColors(size_t idx) {
Clay_Color TextColor(size_t idx) {
return {
255*textColorsP[idx],
255*textColorsP[idx],

View file

@ -33,6 +33,10 @@ constexpr Clay_Padding panelPadding = {
Clay_ElementDeclaration ListContainer(size_t depth, Clay_ElementDeclaration baseCfg);
Clay_ElementDeclaration PanelContainer(size_t depth, Clay_ElementDeclaration baseCfg);
Clay_ElementDeclaration LeftPanelContainer(size_t depth, Clay_ElementDeclaration baseCfg);
Clay_ElementDeclaration RightPanelContainer(size_t depth, Clay_ElementDeclaration baseCfg);
Clay_Color PanelBackground(size_t idx);
Clay_Color PanelBorder(size_t idx);
Clay_ElementDeclaration Window();
////////////////////////////////////
// TEXT STYLE
@ -49,6 +53,8 @@ constexpr uint16_t headerSizes[] = {
28, 16
};
Clay_Color TextColor(size_t idx);
////////////////////////////////////
// BUTTONS
////////////////////////////////////
@ -71,6 +77,8 @@ constexpr Clay_CornerRadius buttonRadii = {
3, 3, 3, 3
};
Clay_Color ToHoveredColor(Clay_Color color);
////////////////////////////////////
// COMPILATIONS
// | Functions and expressions that combine styling data from the settings above.
@ -91,14 +99,6 @@ constexpr Clay_Color transparent{ 255, 255, 255, 0 };
constexpr Clay_Color black{ 0, 0, 0, 255 };
constexpr Clay_Color white{ 255, 255, 255, 255 };
}
Clay_Color PanelBackground(size_t idx);
Clay_Color PanelBorder(size_t idx);
Clay_Color TextColors(size_t idx);
Clay_Color WindowBackground();
Clay_ElementDeclaration Window();
Clay_Color ToHoveredColor(Clay_Color color);
}
#endif // !STYLE_H