#include "style.h" #include "SDL3/SDL_stdinc.h" #include "resources.h" #include namespace cera { Style themeDark{}; Style themeLight{}; Style *theme{&themeDark}; Clay_ElementDeclaration ListContainer(Clay_ElementDeclaration baseCfg) { baseCfg.border = { .color = theme->panelBorder, .width = CLAY_BORDER_ALL(2) }; baseCfg.cornerRadius = CLAY_CORNER_RADIUS(theme->defaultRadius); return baseCfg; } Clay_ElementDeclaration PanelContainer(Clay_ElementDeclaration baseCfg) { baseCfg.backgroundColor = theme->panelBackground; baseCfg.border = { .color = theme->panelBorder, .width = CLAY_BORDER_OUTSIDE(2) }; baseCfg.cornerRadius = CLAY_CORNER_RADIUS(theme->defaultRadius); baseCfg.layout.padding = CLAY_PADDING_ALL(8); return baseCfg; } Clay_ElementDeclaration LeftPanelContainer(Clay_ElementDeclaration baseCfg) { baseCfg = PanelContainer(baseCfg); baseCfg.border.width = { 0, 2, 2, 2, 0 }; baseCfg.cornerRadius = { 0, theme->defaultRadius, 0, theme->defaultRadius }; baseCfg.layout.sizing.height = CLAY_SIZING_GROW(); return baseCfg; } Clay_ElementDeclaration RightPanelContainer(Clay_ElementDeclaration baseCfg) { baseCfg = PanelContainer(baseCfg); baseCfg.border.width = { 2, 0, 2, 2, 0 }; baseCfg.cornerRadius = { theme->defaultRadius, 0, theme->defaultRadius, 0 }; baseCfg.layout.sizing.height = CLAY_SIZING_GROW(); return baseCfg; } Clay_ElementDeclaration Window() { return { .layout = { .sizing = { CLAY_SIZING_GROW(), CLAY_SIZING_GROW() }, .padding = CLAY_PADDING_ALL(theme->windowPadding), .childGap = 0, .layoutDirection = CLAY_LEFT_TO_RIGHT }, .backgroundColor = theme->windowColor }; } Clay_Color ToHoveredColor(Clay_Color color) { float avg = (color.r + color.g + color.b) / 3.f; color.r = SDL_clamp((color.r - avg) * 0.8f + avg - 30, 0., 255.); color.g = SDL_clamp((color.g - avg) * 0.8f + avg - 30, 0., 255.); color.b = SDL_clamp((color.b - avg) * 0.8f + avg - 30, 0., 255.); return color; } }