More Color Tweaking

This commit is contained in:
TheBrokenRail 2024-11-21 04:29:05 -05:00
parent 70ef421780
commit c2750bbaec
3 changed files with 53 additions and 40 deletions

View File

@ -27,7 +27,57 @@ static ImVec4 blend_color(const ImVec4 &top, const ImVec4 &bottom) {
out.w = bottom.w; out.w = bottom.w;
return out; return out;
} }
ImVec4 Frame::blend_with_primary(const ImVec4 &color) { static ImVec4 blend_with_primary(const ImVec4 &color) {
static constexpr ImVec4 primary_color = {1.0f, (69.0f / 255.0f), 0.0f, 1.0f}; static constexpr ImVec4 primary_color = {1.0f, (69.0f / 255.0f), 0.0f, 1.0f};
return blend_color(primary_color, color); return blend_color(primary_color, color);
} }
// Modify Colors
void Frame::patch_colors(ImGuiStyle &style) {
// Blend Colors
static int target_colors_blend[] = {
ImGuiCol_FrameBg,
ImGuiCol_FrameBgHovered,
ImGuiCol_FrameBgActive,
ImGuiCol_TitleBgActive,
ImGuiCol_CheckMark,
ImGuiCol_SliderGrab,
ImGuiCol_SliderGrabActive,
ImGuiCol_Button,
ImGuiCol_ButtonHovered,
ImGuiCol_ButtonActive,
ImGuiCol_Header,
ImGuiCol_HeaderHovered,
ImGuiCol_HeaderActive,
ImGuiCol_SeparatorHovered,
ImGuiCol_SeparatorActive,
ImGuiCol_ResizeGrip,
ImGuiCol_ResizeGripHovered,
ImGuiCol_ResizeGripActive,
ImGuiCol_TabHovered,
ImGuiCol_Tab,
ImGuiCol_TabSelected,
ImGuiCol_TabSelectedOverline,
ImGuiCol_TabDimmed,
ImGuiCol_TabDimmedSelected,
ImGuiCol_TextLink,
ImGuiCol_TextSelectedBg,
ImGuiCol_NavCursor
};
for (const int target_color : target_colors_blend) {
ImVec4 &color = style.Colors[target_color];
color = blend_with_primary(color);
}
// Remove Blue Accent From Colors
static int target_colors_modify[] = {
ImGuiCol_Separator,
ImGuiCol_Border,
ImGuiCol_TableHeaderBg,
ImGuiCol_TableBorderStrong,
ImGuiCol_TableBorderLight
};
for (const int target_color : target_colors_modify) {
ImVec4 &color = style.Colors[target_color];
color.z = color.x;
}
}

View File

@ -86,42 +86,5 @@ void Frame::setup_style(const float scale) {
style.WindowBorderSize = 0; style.WindowBorderSize = 0;
ImGui::StyleColorsDark(&style); ImGui::StyleColorsDark(&style);
style.ScaleAllSizes(scale); style.ScaleAllSizes(scale);
// Blend Colors patch_colors(style);
static int target_colors[] = {
ImGuiCol_FrameBg,
ImGuiCol_FrameBgHovered,
ImGuiCol_FrameBgActive,
ImGuiCol_TitleBgActive,
ImGuiCol_CheckMark,
ImGuiCol_SliderGrab,
ImGuiCol_SliderGrabActive,
ImGuiCol_Button,
ImGuiCol_ButtonHovered,
ImGuiCol_ButtonActive,
ImGuiCol_Header,
ImGuiCol_HeaderHovered,
ImGuiCol_HeaderActive,
ImGuiCol_Separator,
ImGuiCol_SeparatorHovered,
ImGuiCol_SeparatorActive,
ImGuiCol_ResizeGrip,
ImGuiCol_ResizeGripHovered,
ImGuiCol_ResizeGripActive,
ImGuiCol_TabHovered,
ImGuiCol_Tab,
ImGuiCol_TabSelected,
ImGuiCol_TabSelectedOverline,
ImGuiCol_TabDimmed,
ImGuiCol_TabDimmedSelected,
ImGuiCol_TextLink,
ImGuiCol_TextSelectedBg,
ImGuiCol_NavCursor
};
for (const int target_color : target_colors) {
ImVec4 &color = style.Colors[target_color];
color = blend_with_primary(color);
}
// Update Border Color
ImVec4 &border_color = style.Colors[ImGuiCol_Border];
border_color.z = border_color.x;
} }

View File

@ -19,5 +19,5 @@ private:
// Internal // Internal
float get_scale(); float get_scale();
void setup_style(float scale); void setup_style(float scale);
static ImVec4 blend_with_primary(const ImVec4 &color); static void patch_colors(ImGuiStyle &style);
}; };