Seregon/ShadPKG

A tool for deriving PKG packet encryption keys for ps4 written in c++

C++/47.3 KB/No license
gui/include/StyleManager.h
ShadPKG / gui / include / StyleManager.h
1// SPDX-FileCopyrightText: Copyright 2025 shadPKG
2// SPDX-License-Identifier: GPL-2.0-or-later
3 
4#pragma once
5 
6#include "common/assert.h"
7#include <assert.h>
8#include <filesystem>
9#ifndef IM_ASSERT
10#define IM_ASSERT(_EXPR) ASSERT(_EXPR)
11#endif
12#include "IconsFontAwesome6.h"
13#include "imgui.h"
14 
15// ╔══════════════════════════════════════════════════════════════════════════╗
16// ║ StyleManager: Cyber-Dark Theme for ShadPKG GUI ║
17// ║ ║
18// ║ Color Palette: ║
19// ║ ┌──────────────────┬───────────┬─────────────────────────────────────┐ ║
20// ║ │ Element │ HEX │ Description │ ║
21// ║ ├──────────────────┼───────────┼─────────────────────────────────────┤ ║
22// ║ │ Window BG │ #1E1E1E │ Deep dark gray │ ║
23// ║ │ Panels/Child │ #252526 │ Slightly lighter for separation │ ║
24// ║ │ Accent/Primary │ #00ADB5 │ ShadPKG Cyan │ ║
25// ║ │ Text │ #EEEEEE │ Off-white for readability │ ║
26// ║ │ Success │ #4CAF50 │ Green │ ║
27// ║ │ Error │ #F44336 │ Red pastel │ ║
28// ║ │ Warning │ #FF9800 │ Orange │ ║
29// ║ └──────────────────┴───────────┴─────────────────────────────────────┘ ║
30// ╚══════════════════════════════════════════════════════════════════════════╝
31 
32namespace ShadPKG::GUI {
33 
34// Color constants for use throughout the application
35namespace Colors {
36// Base colors (ImVec4 format: R, G, B, A in 0.0-1.0 range)
37// Base colors (ImVec4 format: R, G, B, A in 0.0-1.0 range)
38constexpr ImVec4 WindowBg = ImVec4(0.09f, 0.09f, 0.10f, 1.0f); // Deep rich dark
39constexpr ImVec4 ChildBg =
40 ImVec4(0.13f, 0.13f, 0.14f, 1.0f); // Slightly lighter panels
41constexpr ImVec4 PopupBg =
42 ImVec4(0.11f, 0.11f, 0.12f, 0.98f); // Almost opaque popup
43 
44// Accent colors
45constexpr ImVec4 Primary =
46 ImVec4(0.0f, 0.75f, 0.78f, 1.0f); // More vibrant Cyan
47constexpr ImVec4 PrimaryHover =
48 ImVec4(0.0f, 0.85f, 0.88f, 1.0f); // Bright Cyan hover
49constexpr ImVec4 PrimaryActive =
50 ImVec4(0.0f, 0.60f, 0.63f, 1.0f); // Deep Cyan active
51 
52// Text colors
53constexpr ImVec4 Text =
54 ImVec4(1.00f, 1.00f, 1.00f, 1.00f); // Pure White for max contrast
55constexpr ImVec4 TextDim =
56 ImVec4(0.70f, 0.70f, 0.70f, 1.00f); // Lighter gray for better readability
57 
58// Status colors
59constexpr ImVec4 Success = ImVec4(0.35f, 0.75f, 0.35f, 1.0f); // Brighter Green
60constexpr ImVec4 Error = ImVec4(0.95f, 0.30f, 0.25f, 1.0f); // Vivid Red
61constexpr ImVec4 Warning = ImVec4(1.0f, 0.65f, 0.0f, 1.0f); // Bright Orange
62 
63// UI elements
64constexpr ImVec4 Border =
65 ImVec4(0.35f, 0.35f, 0.40f, 0.40f); // Subtle blue-ish border
66constexpr ImVec4 FrameBg =
67 ImVec4(0.18f, 0.18f, 0.20f, 1.0f); // Dark frame background
68constexpr ImVec4 FrameBgHover = ImVec4(0.24f, 0.24f, 0.26f, 1.0f);
69constexpr ImVec4 NavBarBg =
70 ImVec4(0.07f, 0.07f, 0.08f, 1.0f); // Very dark navbar
71} // namespace Colors
72 
73// ┌─────────────────────────────────────────────────────────────────────────┐
74// │ Icon Mappings (FontAwesome 6) │
75// │ Usage: ImGui::Text(ICON_FA_FILE " PKG File") │
76// └─────────────────────────────────────────────────────────────────────────┘
77// Already defined in IconsFontAwesome6.h, just ensuring compatibility
78#define ICON_FA_MAGNIFYING_GLASS ICON_FA_SEARCH
79#define ICON_FA_CIRCLE_INFO ICON_FA_INFO_CIRCLE
80 
81// Setup the complete ImGui style
82void SetupImGuiStyle();
83 
84// Load custom fonts (Roboto, JetBrainsMono, FontAwesome)
85// Returns true if fonts were loaded successfully
86bool LoadFonts(ImGuiIO &io, float baseFontSize = 16.0f);
87bool LoadFonts(ImGuiIO &io, const std::filesystem::path &executableDir,
88 float baseFontSize = 16.0f);
89 
90// Get font pointers after loading
91ImFont *GetDefaultFont(); // Roboto-Medium 16px
92ImFont *GetMonospaceFont(); // JetBrainsMono 14px
93ImFont *GetIconFont(); // FontAwesome (merged with default)
94 
95} // namespace ShadPKG::GUI
96