Fullscreen: Light mode corrections

This commit is contained in:
Stenzek 2023-09-20 00:09:31 +10:00
parent 745448f5a6
commit 3a47c1eb52
4 changed files with 31 additions and 44 deletions

View file

@ -2015,9 +2015,9 @@ void Achievements::DrawAchievementsWindow()
static constexpr float heading_alpha = 0.95f;
static constexpr float heading_height_unscaled = 110.0f;
const ImVec4 background(0.13f, 0.13f, 0.13f, alpha);
const ImVec4 heading_background(0.13f, 0.13f, 0.13f, heading_alpha);
const ImVec2 display_size(ImGui::GetIO().DisplaySize);
const ImVec4 background = ImGuiFullscreen::ModAlpha(ImGuiFullscreen::UIBackgroundColor, alpha);
const ImVec4 heading_background = ImGuiFullscreen::ModAlpha(ImGuiFullscreen::UIBackgroundColor, heading_alpha);
const ImVec2 display_size = ImGui::GetIO().DisplaySize;
const float heading_height = ImGuiFullscreen::LayoutScale(heading_height_unscaled);
if (ImGuiFullscreen::BeginFullscreenWindow(
@ -2322,9 +2322,9 @@ void Achievements::DrawLeaderboardsWindow()
ImRect bb;
const ImVec4 background(0.13f, 0.13f, 0.13f, alpha);
const ImVec4 heading_background(0.13f, 0.13f, 0.13f, heading_alpha);
const ImVec2 display_size(ImGui::GetIO().DisplaySize);
const ImVec4 background = ImGuiFullscreen::ModAlpha(ImGuiFullscreen::UIBackgroundColor, alpha);
const ImVec4 heading_background = ImGuiFullscreen::ModAlpha(ImGuiFullscreen::UIBackgroundColor, heading_alpha);
const ImVec2 display_size = ImGui::GetIO().DisplaySize;
const float padding = LayoutScale(10.0f);
const float spacing = LayoutScale(10.0f);
const float spacing_small = spacing / 2.0f;

View file

@ -96,8 +96,8 @@ using ImGuiFullscreen::UIPrimaryLightColor;
using ImGuiFullscreen::UIPrimaryLineColor;
using ImGuiFullscreen::UIPrimaryTextColor;
using ImGuiFullscreen::UISecondaryColor;
using ImGuiFullscreen::UISecondaryDarkColor;
using ImGuiFullscreen::UISecondaryLightColor;
using ImGuiFullscreen::UISecondaryWeakColor;
using ImGuiFullscreen::UISecondaryStrongColor;
using ImGuiFullscreen::UISecondaryTextColor;
using ImGuiFullscreen::UITextHighlightColor;
@ -4672,7 +4672,9 @@ void FullscreenUI::DrawPauseMenu()
ImDrawList* dl = ImGui::GetBackgroundDrawList();
const ImVec2 display_size(ImGui::GetIO().DisplaySize);
dl->AddRectFilled(ImVec2(0.0f, 0.0f), display_size, IM_COL32(0x21, 0x21, 0x21, 200));
const ImU32 text_color = ImGui::GetColorU32(UIBackgroundTextColor) | IM_COL32_A_MASK;
dl->AddRectFilled(ImVec2(0.0f, 0.0f), display_size,
(ImGui::GetColorU32(UIBackgroundColor) & ~IM_COL32_A_MASK) | (200 << IM_COL32_A_SHIFT));
// title info
{
@ -4713,13 +4715,13 @@ void FullscreenUI::DrawPauseMenu()
subtitle_pos.x -= rp_height;
subtitle_pos.y -= rp_height;
DrawShadowedText(dl, g_medium_font, rp_pos, IM_COL32(255, 255, 255, 255), rp.data(), rp.data() + rp.size(),
DrawShadowedText(dl, g_medium_font, rp_pos, text_color, rp.data(), rp.data() + rp.size(),
wrap_width);
}
}
DrawShadowedText(dl, g_large_font, title_pos, IM_COL32(255, 255, 255, 255), title.c_str());
DrawShadowedText(dl, g_medium_font, subtitle_pos, IM_COL32(255, 255, 255, 255), buffer);
DrawShadowedText(dl, g_large_font, title_pos, text_color, title.c_str());
DrawShadowedText(dl, g_medium_font, subtitle_pos, text_color, buffer);
const ImVec2 image_min(display_size.x - LayoutScale(20.0f + 50.0f) - rp_height,
display_size.y - LayoutScale(20.0f + 50.0f) - rp_height);
@ -4735,7 +4737,7 @@ void FullscreenUI::DrawPauseMenu()
buffer.GetCharArray(),
buffer.GetCharArray() + buffer.GetLength()));
const ImVec2 time_pos(display_size.x - LayoutScale(10.0f) - time_size.x, LayoutScale(10.0f));
DrawShadowedText(dl, g_large_font, time_pos, IM_COL32(255, 255, 255, 255), buffer.GetCharArray(),
DrawShadowedText(dl, g_large_font, time_pos, text_color, buffer.GetCharArray(),
buffer.GetCharArray() + buffer.GetLength());
const std::string& serial = System::GetGameSerial();
@ -4750,7 +4752,7 @@ void FullscreenUI::DrawPauseMenu()
buffer.GetCharArray() + buffer.GetLength()));
const ImVec2 session_pos(display_size.x - LayoutScale(10.0f) - session_size.x,
time_pos.y + g_large_font->FontSize + LayoutScale(4.0f));
DrawShadowedText(dl, g_medium_font, session_pos, IM_COL32(255, 255, 255, 255), buffer.GetCharArray(),
DrawShadowedText(dl, g_medium_font, session_pos, text_color, buffer.GetCharArray(),
buffer.GetCharArray() + buffer.GetLength());
buffer.Fmt(FSUI_FSTR("All Time: {}"),
@ -4760,7 +4762,7 @@ void FullscreenUI::DrawPauseMenu()
buffer.GetCharArray() + buffer.GetLength()));
const ImVec2 total_pos(display_size.x - LayoutScale(10.0f) - total_size.x,
session_pos.y + g_medium_font->FontSize + LayoutScale(4.0f));
DrawShadowedText(dl, g_medium_font, total_pos, IM_COL32(255, 255, 255, 255), buffer.GetCharArray(),
DrawShadowedText(dl, g_medium_font, total_pos, text_color, buffer.GetCharArray(),
buffer.GetCharArray() + buffer.GetLength());
}
}

View file

@ -73,8 +73,8 @@ ImVec4 UIPrimaryTextColor;
ImVec4 UITextHighlightColor;
ImVec4 UIPrimaryLineColor;
ImVec4 UISecondaryColor;
ImVec4 UISecondaryLightColor;
ImVec4 UISecondaryDarkColor;
ImVec4 UISecondaryWeakColor;
ImVec4 UISecondaryStrongColor;
ImVec4 UISecondaryTextColor;
static u32 s_menu_button_index = 0;
@ -566,20 +566,6 @@ void ImGuiFullscreen::PopPrimaryColor()
ImGui::PopStyleColor(5);
}
void ImGuiFullscreen::PushSecondaryColor()
{
ImGui::PushStyleColor(ImGuiCol_Text, UISecondaryTextColor);
ImGui::PushStyleColor(ImGuiCol_Button, UISecondaryDarkColor);
ImGui::PushStyleColor(ImGuiCol_ButtonActive, UISecondaryColor);
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, UISecondaryLightColor);
ImGui::PushStyleColor(ImGuiCol_Border, UISecondaryLightColor);
}
void ImGuiFullscreen::PopSecondaryColor()
{
ImGui::PopStyleColor(5);
}
bool ImGuiFullscreen::BeginFullscreenColumns(const char* title, float pos_y, bool expand_to_screen_width)
{
ImGui::SetNextWindowPos(ImVec2(expand_to_screen_width ? 0.0f : g_layout_padding_left, pos_y));
@ -1162,7 +1148,7 @@ bool ImGuiFullscreen::ToggleButton(const char* title, const char* summary, bool*
}
else
{
col_bg = ImGui::GetColorU32(ImLerp(HEX_TO_IMVEC4(0x8C8C8C, 0xff), UISecondaryLightColor, t));
col_bg = ImGui::GetColorU32(ImLerp(HEX_TO_IMVEC4(0x8C8C8C, 0xff), UISecondaryStrongColor, t));
col_knob = IM_COL32(255, 255, 255, 255);
}
@ -1241,10 +1227,10 @@ bool ImGuiFullscreen::ThreeWayToggleButton(const char* title, const char* summar
col_bg = IM_COL32(0x75, 0x75, 0x75, 0xff);
else if (hovered)
col_bg = ImGui::GetColorU32(ImLerp(v->has_value() ? HEX_TO_IMVEC4(0xf05100, 0xff) : HEX_TO_IMVEC4(0x9e9e9e, 0xff),
UISecondaryLightColor, color_t));
UISecondaryStrongColor, color_t));
else
col_bg = ImGui::GetColorU32(ImLerp(v->has_value() ? HEX_TO_IMVEC4(0xc45100, 0xff) : HEX_TO_IMVEC4(0x757575, 0xff),
UISecondaryLightColor, color_t));
UISecondaryStrongColor, color_t));
dl->AddRectFilled(toggle_pos, ImVec2(toggle_pos.x + toggle_width, toggle_pos.y + toggle_height), col_bg,
toggle_height * 0.5f);
@ -1484,7 +1470,8 @@ bool ImGuiFullscreen::EnumChoiceButtonImpl(const char* title, const char* summar
void ImGuiFullscreen::DrawShadowedText(ImDrawList* dl, ImFont* font, const ImVec2& pos, u32 col, const char* text,
const char* text_end /*= nullptr*/, float wrap_width /*= 0.0f*/)
{
dl->AddText(font, font->FontSize, pos + LayoutScale(1.0f, 1.0f), IM_COL32(0, 0, 0, 100), text, text_end, wrap_width);
dl->AddText(font, font->FontSize, pos + LayoutScale(1.0f, 1.0f),
s_light_theme ? IM_COL32(255, 255, 255, 100) : IM_COL32(0, 0, 0, 100), text, text_end, wrap_width);
dl->AddText(font, font->FontSize, pos, col, text, text_end, wrap_width);
}
@ -2356,7 +2343,7 @@ void ImGuiFullscreen::DrawBackgroundProgressDialogs(ImVec2& position, float spac
const float window_height = LayoutScale(75.0f);
ImGui::PushStyleColor(ImGuiCol_WindowBg, UIPrimaryDarkColor);
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, UISecondaryLightColor);
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, UISecondaryStrongColor);
ImGui::PushStyleVar(ImGuiStyleVar_PopupRounding, LayoutScale(4.0f));
ImGui::PushStyleVar(ImGuiStyleVar_PopupBorderSize, LayoutScale(1.0f));
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, LayoutScale(10.0f, 10.0f));
@ -2679,8 +2666,8 @@ void ImGuiFullscreen::SetTheme(bool light)
UITextHighlightColor = HEX_TO_IMVEC4(0x90caf9, 0xff);
UIPrimaryLineColor = HEX_TO_IMVEC4(0xffffff, 0xff);
UISecondaryColor = HEX_TO_IMVEC4(0x0d47a1, 0xff);
UISecondaryLightColor = HEX_TO_IMVEC4(0x63a4ff, 0xff);
UISecondaryDarkColor = HEX_TO_IMVEC4(0x002171, 0xff);
UISecondaryStrongColor = HEX_TO_IMVEC4(0x63a4ff, 0xff);
UISecondaryWeakColor = HEX_TO_IMVEC4(0x002171, 0xff);
UISecondaryTextColor = HEX_TO_IMVEC4(0xffffff, 0xff);
}
else
@ -2698,8 +2685,8 @@ void ImGuiFullscreen::SetTheme(bool light)
UITextHighlightColor = HEX_TO_IMVEC4(0x8e8e8e, 0xff);
UIPrimaryLineColor = HEX_TO_IMVEC4(0x000000, 0xff);
UISecondaryColor = HEX_TO_IMVEC4(0x3d5afe, 0xff);
UISecondaryLightColor = HEX_TO_IMVEC4(0xc0cfff, 0xff);
UISecondaryDarkColor = HEX_TO_IMVEC4(0x0031ca, 0xff);
UISecondaryStrongColor = HEX_TO_IMVEC4(0x0031ca, 0xff);
UISecondaryWeakColor = HEX_TO_IMVEC4(0xc0cfff, 0xff);
UISecondaryTextColor = HEX_TO_IMVEC4(0x000000, 0xff);
}
}

View file

@ -49,8 +49,8 @@ extern ImVec4 UIPrimaryTextColor;
extern ImVec4 UITextHighlightColor;
extern ImVec4 UIPrimaryLineColor;
extern ImVec4 UISecondaryColor;
extern ImVec4 UISecondaryLightColor;
extern ImVec4 UISecondaryDarkColor;
extern ImVec4 UISecondaryWeakColor; // Not currently used.
extern ImVec4 UISecondaryStrongColor;
extern ImVec4 UISecondaryTextColor;
static ALWAYS_INLINE float DPIScale(float v)
@ -150,8 +150,6 @@ void ResetCloseMenuIfNeeded();
void PushPrimaryColor();
void PopPrimaryColor();
void PushSecondaryColor();
void PopSecondaryColor();
void DrawWindowTitle(const char* title);