73 lines
1.8 KiB
C
73 lines
1.8 KiB
C
#include "style.h"
|
|
#include "defs.h"
|
|
#include "dice.h"
|
|
|
|
Clay_Color PanelBackground(size_t idx) {
|
|
return (Clay_Color) {
|
|
255*panelBackground[idx],
|
|
255*panelBackground[idx],
|
|
255*panelBackground[idx],
|
|
255
|
|
};
|
|
}
|
|
|
|
Clay_Color PanelBorder(size_t idx) {
|
|
return (Clay_Color) {
|
|
255*panelBorder[idx],
|
|
255*panelBorder[idx],
|
|
255*panelBorder[idx],
|
|
255
|
|
};
|
|
}
|
|
|
|
Clay_Color TextColors(size_t idx) {
|
|
return (Clay_Color) {
|
|
255*textColorsP[idx],
|
|
255*textColorsP[idx],
|
|
255*textColorsP[idx],
|
|
255
|
|
};
|
|
}
|
|
|
|
Clay_Color WindowBackground() {
|
|
return (Clay_Color) { 255*windowBackground, 255*windowBackground, 255*windowBackground, 255 };
|
|
}
|
|
|
|
Clay_ElementDeclaration WindowStyle() {
|
|
return (Clay_ElementDeclaration) {
|
|
.layout = {
|
|
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
|
.sizing = layoutExpand,
|
|
.padding = CLAY_PADDING_ALL(windowPadding),
|
|
.childGap = containerGap,
|
|
},
|
|
.backgroundColor = WindowBackground()
|
|
};
|
|
}
|
|
|
|
Clay_Color DieColor(enum die_type die) {
|
|
switch(die) {
|
|
case COIN: return (Clay_Color) { 230, 184, 48, 255 };
|
|
case D4: return (Clay_Color) { 177, 56, 52, 255 };
|
|
case D6: return (Clay_Color) { 115, 177, 52, 255 };
|
|
case D8: return (Clay_Color) { 52, 177, 125, 255 };
|
|
case D10: return (Clay_Color) { 52, 177, 176, 255 };
|
|
case D12: return (Clay_Color) { 52, 93, 177, 255 };
|
|
case D20: return (Clay_Color) { 177, 52, 140, 255 };
|
|
case D100: return (Clay_Color) { 95, 52, 177, 255 };
|
|
default: return (Clay_Color) { 0, 0, 0, 255 };
|
|
}
|
|
}
|
|
|
|
Clay_Color DieButtonColor(enum die_type die, bool selected) {
|
|
return selected ? ToHoveredColor(DieColor(die)) : DieColor(die);
|
|
}
|
|
|
|
Clay_Color ToHoveredColor(Clay_Color color) {
|
|
float avg = (color.r + color.g + color.b) / 3.f;
|
|
color.r = (color.r - avg) * 0.8f + avg - 30;
|
|
color.g = (color.g - avg) * 0.8f + avg - 30;
|
|
color.b = (color.b - avg) * 0.8f + avg - 30;
|
|
return color;
|
|
}
|