feat(theme): flat light-theme buttons (match the portfolio modal)

Per the request for a flatter look like the Manage-portfolio modal's plain
buttons, render TactileButton FLAT on light themes: DrawButtonGlassOverlay now
early-returns in light themes with just a subtle defining edge (--rim-light),
skipping the white glass sheen (--glass-fill) and the tactile 3D depth (bright top
edge + the hardcoded bottom shadow that couldn't be removed via TOML).
ImGui::Button still draws the fill/hover/active (the darkened ImGuiCol_Button
overlays), so the button reads as a flat, defined element. Dark themes keep the
raised glass/tactile look. Re-adds the IsLightTheme() luminance helper (early in
the header so the overlay can use it). Applies to all TactileButtons app-wide in
light themes, not just Settings.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-04 17:16:22 -05:00
parent 7c90d72ded
commit a523611779

View File

@@ -35,6 +35,15 @@ inline ImU32 ScaleAlpha(ImU32 col, float scale) {
return (col & ~IM_COL32_A_MASK) | (static_cast<ImU32>(a) << IM_COL32_A_SHIFT);
}
// True when the active theme is light (app background luminance is high).
inline bool IsLightTheme() {
ImU32 bg = Background();
float r = ((bg >> IM_COL32_R_SHIFT) & 0xFF) / 255.0f;
float g = ((bg >> IM_COL32_G_SHIFT) & 0xFF) / 255.0f;
float b = ((bg >> IM_COL32_B_SHIFT) & 0xFF) / 255.0f;
return (0.299f * r + 0.587f * g + 0.114f * b) > 0.5f;
}
// Animated "loading" ellipsis: "", ".", "..", "..." cycling on a ~3Hz phase.
inline const char* LoadingDots() {
int n = ((int)(ImGui::GetTime() * 3.0f)) % 4;
@@ -227,6 +236,14 @@ inline void DrawButtonGlassOverlay(ImDrawList* dl, const ImVec2& bMin,
const ImVec2& bMax, float rounding,
bool active, bool hovered)
{
// Light themes: flat buttons (like the Manage-portfolio modal's plain buttons). Skip the glass
// sheen + tactile 3D — ImGui::Button already draws the fill/hover/active — and add just a subtle
// defining edge, which reads cleaner on light surfaces than the raised glass look.
if (IsLightTheme()) {
ImU32 rim = schema::UI().resolveColor("var(--rim-light)", IM_COL32(0, 0, 0, 50));
dl->AddRect(bMin, bMax, active ? ScaleAlpha(rim, 0.6f) : rim, rounding, 0, 1.0f);
return;
}
// Frosted glass highlight — subtle fill on top
if (!active) {
ImU32 col = hovered