Files
ObsidianDragon/src/ui/theme_loader.h
DanS 3aee55b49c ObsidianDragon - DragonX ImGui Wallet
Full-node GUI wallet for DragonX cryptocurrency.
Built with Dear ImGui, SDL3, and OpenGL3/DX11.

Features:
- Send/receive shielded and transparent transactions
- Autoshield with merged transaction display
- Built-in CPU mining (xmrig)
- Peer management and network monitoring
- Wallet encryption with PIN lock
- QR code generation for receive addresses
- Transaction history with pagination
- Console for direct RPC commands
- Cross-platform (Linux, Windows)
2026-02-27 00:26:01 -06:00

70 lines
1.9 KiB
C++

// DragonX Wallet - ImGui Edition
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
#pragma once
#include "material/color_theme.h"
#include "theme.h"
#include <string>
namespace dragonx {
namespace ui {
/**
* @brief Color utility and theme derivation helpers
*
* Provides color parsing, luminance calculation, default color computation,
* and acrylic theme derivation from Material Design color themes.
*
* Theme loading is handled by the UISchema overlay system (ui.toml +
* dark.toml / light.toml). This class retains the utility methods
* that UISchema and other subsystems depend on.
*/
class ThemeLoader {
public:
/**
* @brief Parse any supported color string to ImU32
*
* Supports all formats:
* - "0xRRGGBB" / "0xRRGGBBAA" (hex)
* - "#RRGGBB" / "#RRGGBBAA" (web hex)
* - "rgba(r,g,b,a)" (CSS-style, a is 0.0-1.0)
* - "transparent" (fully transparent)
*/
static bool parseColorString(const std::string& str, ImU32& outColor);
/**
* @brief Parse hex color string to ImU32
*
* Supports formats:
* - "0xRRGGBB" (6 hex digits, alpha = 255)
* - "0xRRGGBBAA" (8 hex digits, includes alpha)
* - "#RRGGBB" / "#RRGGBBAA" (web format)
*/
static bool parseHexColor(const std::string& hexStr, ImU32& outColor);
/**
* @brief Convert ImU32 color to hex string
*/
static std::string colorToHexString(ImU32 color, bool includeAlpha = false);
/**
* @brief Calculate relative luminance of a color (0.0 - 1.0)
*/
static float getLuminance(ImU32 color);
/**
* @brief Compute default colors for missing fields
*/
static void computeDefaults(material::ColorTheme& theme, bool isDark);
/**
* @brief Auto-generate AcrylicTheme from a ColorTheme
*/
static AcrylicTheme deriveAcrylicTheme(const material::ColorTheme& theme);
};
} // namespace ui
} // namespace dragonx