Skip to content

Commit

Permalink
text_outline_color: fix BGR TO RGB
Browse files Browse the repository at this point in the history
Previously the outline color would swap the blue and green, making it
inconsistent with how other colors function
  • Loading branch information
flightlessmango committed Dec 10, 2023
1 parent 9998593 commit c38132c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/hud_elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ void HudElements::convert_colors(const struct overlay_params& params)
HUDElements.colors.fps_value_low = convert(params.fps_color[0]);
HUDElements.colors.fps_value_med = convert(params.fps_color[1]);
HUDElements.colors.fps_value_high = convert(params.fps_color[2]);
HUDElements.colors.text_outline = convert(params.text_outline_color);

ImGuiStyle& style = ImGui::GetStyle();
style.Colors[ImGuiCol_PlotLines] = convert(params.frametime_color);
Expand Down
3 changes: 2 additions & 1 deletion src/hud_elements.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ class HudElements{
cpu_load_high,
fps_value_low,
fps_value_med,
fps_value_high;
fps_value_high,
text_outline;
} colors {};

void TextColored(ImVec4 col, const char *fmt, ...);
Expand Down
4 changes: 1 addition & 3 deletions src/overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,7 @@ void RenderOutlinedText(const char* text, ImU32 textColor) {

float outlineThickness = HUDElements.params->text_outline_thickness;
ImVec2 textSize = ImGui::CalcTextSize(text);
ImVec4 colorVec4 = ImGui::ColorConvertU32ToFloat4(HUDElements.params->text_outline_color);
colorVec4.w = HUDElements.params->alpha;
ImU32 outlineColor = ImGui::ColorConvertFloat4ToU32(colorVec4);
ImU32 outlineColor = ImGui::ColorConvertFloat4ToU32(HUDElements.colors.text_outline);
ImVec2 pos = window->DC.CursorPos;

ImDrawList* drawList = ImGui::GetWindowDrawList();
Expand Down
3 changes: 2 additions & 1 deletion src/overlay_params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ parse_overlay_config(struct overlay_params *params,
params->font_scale_media_player = 0.55f;

// Convert from 0xRRGGBB to ImGui's format
std::array<unsigned *, 21> colors = {
std::array<unsigned *, 22> colors = {
&params->cpu_color,
&params->gpu_color,
&params->vram_color,
Expand All @@ -878,6 +878,7 @@ parse_overlay_config(struct overlay_params *params,
&params->fps_color[0],
&params->fps_color[1],
&params->fps_color[2],
&params->text_outline_color,
};

for (auto color : colors){
Expand Down

0 comments on commit c38132c

Please sign in to comment.