mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-01 21:17:44 -05:00
impr: Added more fine-grained colors to themes
This commit is contained in:
@@ -168,21 +168,37 @@ namespace hex::plugin::builtin {
|
||||
|
||||
{
|
||||
const static ThemeManager::ColorMap ImHexColorMap = {
|
||||
{ "desc-button", ImGuiCustomCol_DescButton },
|
||||
{ "desc-button-hovered", ImGuiCustomCol_DescButtonHovered },
|
||||
{ "desc-button-active", ImGuiCustomCol_DescButtonActive },
|
||||
{ "toolbar-gray", ImGuiCustomCol_ToolbarGray },
|
||||
{ "toolbar-red", ImGuiCustomCol_ToolbarRed },
|
||||
{ "toolbar-yellow", ImGuiCustomCol_ToolbarYellow },
|
||||
{ "toolbar-green", ImGuiCustomCol_ToolbarGreen },
|
||||
{ "toolbar-blue", ImGuiCustomCol_ToolbarBlue },
|
||||
{ "toolbar-purple", ImGuiCustomCol_ToolbarPurple },
|
||||
{ "toolbar-brown", ImGuiCustomCol_ToolbarBrown },
|
||||
{ "highlight", ImGuiCustomCol_Highlight },
|
||||
{ "IEEE-tool-sign", ImGuiCustomCol_IEEEToolSign },
|
||||
{ "IEEE-tool-exp", ImGuiCustomCol_IEEEToolExp },
|
||||
{ "IEEE-tool-mantissa", ImGuiCustomCol_IEEEToolMantissa },
|
||||
{ "blur-background", ImGuiCustomCol_BlurBackground }
|
||||
{ "desc-button", ImGuiCustomCol_DescButton },
|
||||
{ "desc-button-hovered", ImGuiCustomCol_DescButtonHovered },
|
||||
{ "desc-button-active", ImGuiCustomCol_DescButtonActive },
|
||||
{ "toolbar-gray", ImGuiCustomCol_ToolbarGray },
|
||||
{ "toolbar-red", ImGuiCustomCol_ToolbarRed },
|
||||
{ "toolbar-yellow", ImGuiCustomCol_ToolbarYellow },
|
||||
{ "toolbar-green", ImGuiCustomCol_ToolbarGreen },
|
||||
{ "toolbar-blue", ImGuiCustomCol_ToolbarBlue },
|
||||
{ "toolbar-purple", ImGuiCustomCol_ToolbarPurple },
|
||||
{ "toolbar-brown", ImGuiCustomCol_ToolbarBrown },
|
||||
{ "logger-debug", ImGuiCustomCol_LoggerDebug },
|
||||
{ "logger-info", ImGuiCustomCol_LoggerInfo },
|
||||
{ "logger-warning", ImGuiCustomCol_LoggerWarning },
|
||||
{ "logger-error", ImGuiCustomCol_LoggerError },
|
||||
{ "logger-fatal", ImGuiCustomCol_LoggerFatal },
|
||||
{ "achievement-unlocked", ImGuiCustomCol_AchievementUnlocked },
|
||||
{ "find-highlight", ImGuiCustomCol_FindHighlight },
|
||||
{ "highlight", ImGuiCustomCol_Highlight },
|
||||
{ "diff-added", ImGuiCustomCol_DiffAdded },
|
||||
{ "diff-removed", ImGuiCustomCol_DiffRemoved },
|
||||
{ "diff-changed", ImGuiCustomCol_DiffChanged },
|
||||
{ "advanced-encoding-ascii", ImGuiCustomCol_AdvancedEncodingASCII },
|
||||
{ "advanced-encoding-single", ImGuiCustomCol_AdvancedEncodingSingleChar },
|
||||
{ "advanced-encoding-multi", ImGuiCustomCol_AdvancedEncodingMultiChar },
|
||||
{ "advanced-encoding-unknown", ImGuiCustomCol_AdvancedEncodingUnknown },
|
||||
{ "patches", ImGuiCustomCol_Patches },
|
||||
{ "pattern-selected", ImGuiCustomCol_PatternSelected },
|
||||
{ "IEEE-tool-sign", ImGuiCustomCol_IEEEToolSign },
|
||||
{ "IEEE-tool-exp", ImGuiCustomCol_IEEEToolExp },
|
||||
{ "IEEE-tool-mantissa", ImGuiCustomCol_IEEEToolMantissa },
|
||||
{ "blur-background", ImGuiCustomCol_BlurBackground }
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace hex::plugin::builtin {
|
||||
// Determine achievement border color based on unlock state
|
||||
const auto borderColor = [&] {
|
||||
if (achievement.isUnlocked())
|
||||
return ImGui::GetCustomColorU32(ImGuiCustomCol_ToolbarYellow, 1.0F);
|
||||
return ImGui::GetCustomColorU32(ImGuiCustomCol_AchievementUnlocked, 1.0F);
|
||||
else if (node->isUnlockable())
|
||||
return ImGui::GetColorU32(ImGuiCol_Button, 1.0F);
|
||||
else
|
||||
@@ -118,7 +118,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::Separator();
|
||||
separator = true;
|
||||
|
||||
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarYellow), "[ {} ]", LangEntry("hex.builtin.view.achievements.click"));
|
||||
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_AchievementUnlocked), "[ {} ]", LangEntry("hex.builtin.view.achievements.click"));
|
||||
}
|
||||
|
||||
// Draw achievement description if available
|
||||
@@ -413,7 +413,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::SetNextWindowSize(windowSize);
|
||||
if (ImGui::Begin("##achievement_unlocked", nullptr, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoInputs)) {
|
||||
// Draw unlock text
|
||||
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarYellow), "{}", "hex.builtin.view.achievements.unlocked"_lang);
|
||||
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_AchievementUnlocked), "{}", "hex.builtin.view.achievements.unlocked"_lang);
|
||||
|
||||
// Draw achievement icon
|
||||
ImGui::Image(this->m_currAchievement->getIcon(), scaled({ 20, 20 }));
|
||||
|
||||
@@ -112,9 +112,9 @@ namespace hex::plugin::builtin {
|
||||
// Handle the case where one provider is larger than the other one
|
||||
if (address > otherProvider->getActualSize()) {
|
||||
if (otherIndex == 1)
|
||||
return getDiffColor(ImGui::GetCustomColorU32(ImGuiCustomCol_ToolbarGreen));
|
||||
return getDiffColor(ImGui::GetCustomColorU32(ImGuiCustomCol_DiffAdded));
|
||||
else
|
||||
return getDiffColor(ImGui::GetCustomColorU32(ImGuiCustomCol_ToolbarRed));
|
||||
return getDiffColor(ImGui::GetCustomColorU32(ImGuiCustomCol_DiffRemoved));
|
||||
}
|
||||
|
||||
// Read the current byte from the other provider
|
||||
@@ -123,7 +123,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
// Compare the two bytes, highlight both in yellow if they are different
|
||||
if (otherByte != *data)
|
||||
return getDiffColor(ImGui::GetCustomColorU32(ImGuiCustomCol_ToolbarYellow));
|
||||
return getDiffColor(ImGui::GetCustomColorU32(ImGuiCustomCol_DiffChanged));
|
||||
|
||||
// No difference
|
||||
return std::nullopt;
|
||||
@@ -304,13 +304,13 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TableNextColumn();
|
||||
switch (diff.type) {
|
||||
case DifferenceType::Modified:
|
||||
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarYellow), "hex.builtin.view.diff.modified"_lang);
|
||||
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_DiffChanged), "hex.builtin.view.diff.modified"_lang);
|
||||
break;
|
||||
case DifferenceType::Added:
|
||||
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarGreen), "hex.builtin.view.diff.added"_lang);
|
||||
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_DiffAdded), "hex.builtin.view.diff.added"_lang);
|
||||
break;
|
||||
case DifferenceType::Removed:
|
||||
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed), "hex.builtin.view.diff.removed"_lang);
|
||||
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_DiffRemoved), "hex.builtin.view.diff.removed"_lang);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
ViewFind::ViewFind() : View("hex.builtin.view.find.name") {
|
||||
const static auto HighlightColor = [] { return (ImGui::GetCustomColorU32(ImGuiCustomCol_ToolbarPurple) & 0x00FFFFFF) | 0x70000000; };
|
||||
const static auto HighlightColor = [] { return (ImGui::GetCustomColorU32(ImGuiCustomCol_FindHighlight) & 0x00FFFFFF) | 0x70000000; };
|
||||
|
||||
ImHexApi::HexEditor::addBackgroundHighlightingProvider([this](u64 address, const u8* data, size_t size, bool) -> std::optional<color_t> {
|
||||
hex::unused(data, size);
|
||||
|
||||
@@ -13,15 +13,15 @@ namespace hex::plugin::builtin {
|
||||
|
||||
static ImColor getColor(std::string_view level) {
|
||||
if (level.contains("DEBUG"))
|
||||
return ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarGreen);
|
||||
return ImGui::GetCustomColorVec4(ImGuiCustomCol_LoggerDebug);
|
||||
else if (level.contains("INFO"))
|
||||
return ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarBlue);
|
||||
return ImGui::GetCustomColorVec4(ImGuiCustomCol_LoggerInfo);
|
||||
else if (level.contains("WARN"))
|
||||
return ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarYellow);
|
||||
return ImGui::GetCustomColorVec4(ImGuiCustomCol_LoggerWarning);
|
||||
else if (level.contains("ERROR"))
|
||||
return ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed);
|
||||
return ImGui::GetCustomColorVec4(ImGuiCustomCol_LoggerError);
|
||||
else if (level.contains("FATAL"))
|
||||
return ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarPurple);
|
||||
return ImGui::GetCustomColorVec4(ImGuiCustomCol_LoggerFatal);
|
||||
return ImGui::GetStyleColorVec4(ImGuiCol_Text);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
const auto &patches = provider->getPatches();
|
||||
if (patches.contains(offset) && patches.at(offset) != byte)
|
||||
return ImGui::GetCustomColorU32(ImGuiCustomCol_ToolbarRed);
|
||||
return ImGui::GetCustomColorU32(ImGuiCustomCol_Patches);
|
||||
else
|
||||
return std::nullopt;
|
||||
});
|
||||
|
||||
@@ -131,11 +131,11 @@ namespace hex::plugin::builtin::ui {
|
||||
const auto [decoded, advance] = encodingFile.getEncodingFor(buffer);
|
||||
const ImColor color = [&]{
|
||||
if (decoded.length() == 1 && std::isalnum(decoded[0]))
|
||||
return ImGui::GetCustomColorU32(ImGuiCustomCol_ToolbarBlue);
|
||||
return ImGui::GetCustomColorU32(ImGuiCustomCol_AdvancedEncodingASCII);
|
||||
else if (decoded.length() == 1 && advance == 1)
|
||||
return ImGui::GetCustomColorU32(ImGuiCustomCol_ToolbarRed);
|
||||
return ImGui::GetCustomColorU32(ImGuiCustomCol_AdvancedEncodingSingleChar);
|
||||
else if (decoded.length() > 1 && advance == 1)
|
||||
return ImGui::GetCustomColorU32(ImGuiCustomCol_ToolbarYellow);
|
||||
return ImGui::GetCustomColorU32(ImGuiCustomCol_AdvancedEncodingMultiChar);
|
||||
else if (advance > 1)
|
||||
return ImGui::GetColorU32(ImGuiCol_Text);
|
||||
else
|
||||
@@ -527,7 +527,7 @@ namespace hex::plugin::builtin::ui {
|
||||
|
||||
if (y < this->m_encodingLineStartAddresses.size()) {
|
||||
if (this->m_encodingLineStartAddresses[y] >= this->m_bytesPerRow) {
|
||||
encodingData.emplace_back(y * this->m_bytesPerRow + this->m_provider->getBaseAddress() + this->m_provider->getCurrentPageAddress(), CustomEncodingData(".", 1, ImGui::GetCustomColorU32(ImGuiCustomCol_ToolbarRed)));
|
||||
encodingData.emplace_back(y * this->m_bytesPerRow + this->m_provider->getBaseAddress() + this->m_provider->getCurrentPageAddress(), CustomEncodingData(".", 1, ImGui::GetCustomColorU32(ImGuiCustomCol_AdvancedEncodingUnknown)));
|
||||
this->m_encodingLineStartAddresses.push_back(0);
|
||||
} else {
|
||||
u32 offset = this->m_encodingLineStartAddresses[y];
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace hex::plugin::builtin::ui {
|
||||
auto selected = isPatternSelected(address, size);
|
||||
|
||||
if (selected)
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_HeaderActive));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetCustomColorVec4(ImGuiCustomCol_PatternSelected));
|
||||
|
||||
if constexpr (HasReturn) {
|
||||
auto result = callback();
|
||||
|
||||
Reference in New Issue
Block a user