UI: Fix minor dark mode issues (#1654)

* Fix black text after graphic pack is disabled in dark mode
* Fix background colour of audio debugger in dark mode
* Make placeholder game list icons black when using dark mode
* Some tweaks to the HotkeySettings window:
  - Make strings translatable
  - Makes the column headers bold for clarity
  - Makes the border darker on Linux, fixed by @goeiecool9999
  - Make the column headers have some padding to make it look nicer.
This commit is contained in:
Crementif 2025-07-26 22:45:28 +02:00 committed by GitHub
parent 55a735dcfa
commit 191357c518
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 23 additions and 23 deletions

View file

@ -24,7 +24,6 @@ wxEND_EVENT_TABLE()
AudioDebuggerWindow::AudioDebuggerWindow(wxFrame& parent) AudioDebuggerWindow::AudioDebuggerWindow(wxFrame& parent)
: wxFrame(&parent, wxID_ANY, _("AX voice viewer"), wxDefaultPosition, wxSize(1126, 580), wxCLOSE_BOX | wxCLIP_CHILDREN | wxCAPTION | wxRESIZE_BORDER) : wxFrame(&parent, wxID_ANY, _("AX voice viewer"), wxDefaultPosition, wxSize(1126, 580), wxCLOSE_BOX | wxCLIP_CHILDREN | wxCAPTION | wxRESIZE_BORDER)
{ {
wxPanel* mainPane = new wxPanel(this); wxPanel* mainPane = new wxPanel(this);
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
@ -141,8 +140,6 @@ AudioDebuggerWindow::AudioDebuggerWindow(wxFrame& parent)
} }
RefreshVoiceList(); RefreshVoiceList();
wxFrame::SetBackgroundColour(*wxWHITE);
// start refresh timer // start refresh timer
static const int INTERVAL = 100; // milliseconds static const int INTERVAL = 100; // milliseconds
refreshTimer = new wxTimer(this, REFRESH_TIMER_ID); refreshTimer = new wxTimer(this, REFRESH_TIMER_ID);

View file

@ -131,11 +131,11 @@ void GraphicPacksWindow2::FillGraphicPackList() const
{ {
auto tmp_text = m_graphic_pack_tree->GetItemText(node); auto tmp_text = m_graphic_pack_tree->GetItemText(node);
m_graphic_pack_tree->SetItemText(node, tmp_text + " (Unsupported version)"); m_graphic_pack_tree->SetItemText(node, tmp_text + " (Unsupported version)");
m_graphic_pack_tree->SetItemTextColour(node, 0x0000CC); m_graphic_pack_tree->SetItemTextColour(node, m_incompatible_colour);
canEnable = false; canEnable = false;
} }
else if (p->IsActivated()) else if (p->IsActivated())
m_graphic_pack_tree->SetItemTextColour(node, 0x009900); m_graphic_pack_tree->SetItemTextColour(node, m_activated_colour);
m_graphic_pack_tree->MakeCheckable(node, p->IsEnabled()); m_graphic_pack_tree->MakeCheckable(node, p->IsEnabled());
if (!canEnable) if (!canEnable)
@ -509,7 +509,7 @@ void GraphicPacksWindow2::OnTreeChoiceChanged(wxTreeEvent& event)
if (!requiresRestart) if (!requiresRestart)
{ {
ReloadPack(graphic_pack); ReloadPack(graphic_pack);
m_graphic_pack_tree->SetItemTextColour(item, 0x009900); m_graphic_pack_tree->SetItemTextColour(item, m_activated_colour);
} }
} }
else else
@ -517,7 +517,7 @@ void GraphicPacksWindow2::OnTreeChoiceChanged(wxTreeEvent& event)
if (!requiresRestart) if (!requiresRestart)
{ {
DeleteShadersFromRuntimeCache(graphic_pack); DeleteShadersFromRuntimeCache(graphic_pack);
m_graphic_pack_tree->SetItemTextColour(item, *wxBLACK); m_graphic_pack_tree->SetItemTextColour(item, m_default_colour);
} }
GraphicPack2::DeactivateGraphicPack(graphic_pack); GraphicPack2::DeactivateGraphicPack(graphic_pack);
} }

View file

@ -53,6 +53,9 @@ private:
std::string m_gp_name, m_gp_description; std::string m_gp_name, m_gp_description;
float m_ratio = 0.55f; float m_ratio = 0.55f;
wxColour m_default_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
wxColour m_activated_colour = wxSystemSettings::SelectLightDark(wxColour(0x00, 0xCC, 0x00), wxColour(0x42, 0xB3, 0x42));
wxColour m_incompatible_colour = wxSystemSettings::SelectLightDark(wxColour(0xCC, 0x00, 0x00), wxColour(0xDE, 0x49, 0x49));
wxTreeItemId FindTreeItem(const wxTreeItemId& root, const wxString& text) const; wxTreeItemId FindTreeItem(const wxTreeItemId& root, const wxString& text) const;
void LoadPresetSelections(const GraphicPackPtr& gp); void LoadPresetSelections(const GraphicPackPtr& gp);

View file

@ -140,8 +140,8 @@ wxGameList::wxGameList(wxWindow* parent, wxWindowID id)
{ {
const auto& config = GetWxGUIConfig(); const auto& config = GetWxGUIConfig();
char transparent_bitmap[kIconWidth * kIconWidth * 4] = {wxIMAGE_ALPHA_TRANSPARENT}; char transparent_bitmap[kIconWidth * kIconWidth * 4] = {};
memset((void*)transparent_bitmap, wxIMAGE_ALPHA_TRANSPARENT, sizeof(transparent_bitmap)); memset((void*)transparent_bitmap, wxSystemSettings::GetAppearance().IsDark() ? 0xFF : 0x00, sizeof(transparent_bitmap));
wxBitmap blank(transparent_bitmap, kIconWidth, kIconWidth); wxBitmap blank(transparent_bitmap, kIconWidth, kIconWidth);
blank.UseAlpha(true); blank.UseAlpha(true);

View file

@ -23,8 +23,6 @@ ModuleWindow::ModuleWindow(DebuggerWindow2& parent, const wxPoint& main_position
{ {
this->SetSizeHints(wxDefaultSize, wxDefaultSize); this->SetSizeHints(wxDefaultSize, wxDefaultSize);
// this->wxWindowBase::SetBackgroundColour(*wxWHITE);
wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
m_modules = new wxListView(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT); m_modules = new wxListView(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT);

View file

@ -89,11 +89,11 @@ std::optional<std::string> SaveScreenshot(std::vector<uint8> data, int width, in
if (SaveScreenshotToClipboard(image)) if (SaveScreenshotToClipboard(image))
{ {
if (!save_screenshot) if (!save_screenshot)
return "Screenshot saved to clipboard"; return _tr("Screenshot saved to clipboard");
} }
else else
{ {
return "Failed to open clipboard"; return _tr("Failed to open clipboard");
} }
} }
if (save_screenshot) if (save_screenshot)
@ -102,11 +102,11 @@ std::optional<std::string> SaveScreenshot(std::vector<uint8> data, int width, in
if (imagePath.has_value() && SaveScreenshotToFile(imagePath.value(), image)) if (imagePath.has_value() && SaveScreenshotToFile(imagePath.value(), image))
{ {
if (mainWindow) if (mainWindow)
return "Screenshot saved"; return _tr("Screenshot saved");
} }
else else
{ {
return "Failed to save screenshot to file"; return _tr("Failed to save screenshot to file");
} }
} }
return std::nullopt; return std::nullopt;
@ -140,7 +140,7 @@ HotkeySettings::HotkeySettings(wxWindow* parent)
m_sizer->AddGrowableCol(1); m_sizer->AddGrowableCol(1);
m_sizer->AddGrowableCol(2); m_sizer->AddGrowableCol(2);
m_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE); m_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_THEME);
m_panel->SetSizer(m_sizer); m_panel->SetSizer(m_sizer);
Center(); Center();
@ -150,13 +150,13 @@ HotkeySettings::HotkeySettings(wxWindow* parent)
CreateColumnHeaders(); CreateColumnHeaders();
/* global modifier */ /* global modifier */
CreateHotkeyRow("Hotkey modifier", s_cfgHotkeys.modifiers); CreateHotkeyRow(_tr("Hotkey modifier"), s_cfgHotkeys.modifiers);
m_hotkeys.at(0).keyInput->Hide(); m_hotkeys.at(0).keyInput->Hide();
/* hotkeys */ /* hotkeys */
CreateHotkeyRow("Toggle fullscreen", s_cfgHotkeys.toggleFullscreen); CreateHotkeyRow(_tr("Toggle fullscreen"), s_cfgHotkeys.toggleFullscreen);
CreateHotkeyRow("Take screenshot", s_cfgHotkeys.takeScreenshot); CreateHotkeyRow(_tr("Take screenshot"), s_cfgHotkeys.takeScreenshot);
CreateHotkeyRow("Toggle fast-forward", s_cfgHotkeys.toggleFastForward); CreateHotkeyRow(_tr("Toggle fast-forward"), s_cfgHotkeys.toggleFastForward);
m_controllerTimer = new wxTimer(this); m_controllerTimer = new wxTimer(this);
Bind(wxEVT_TIMER, &HotkeySettings::OnControllerTimer, this); Bind(wxEVT_TIMER, &HotkeySettings::OnControllerTimer, this);
@ -214,13 +214,15 @@ void HotkeySettings::Init(MainWindow* mainWindowFrame)
void HotkeySettings::CreateColumnHeaders(void) void HotkeySettings::CreateColumnHeaders(void)
{ {
auto* emptySpace = new wxStaticText(m_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL); auto* emptySpace = new wxStaticText(m_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL);
auto* keyboard = new wxStaticText(m_panel, wxID_ANY, "Keyboard", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL); auto* keyboard = new wxStaticText(m_panel, wxID_ANY, _tr("Keyboard"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL);
auto* controller = new wxStaticText(m_panel, wxID_ANY, "Controller", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL); auto* controller = new wxStaticText(m_panel, wxID_ANY, _tr("Controller"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL);
keyboard->SetFont(keyboard->GetFont().Bold().Larger());
controller->SetFont(controller->GetFont().Bold().Larger());
keyboard->SetMinSize(m_minButtonSize); keyboard->SetMinSize(m_minButtonSize);
controller->SetMinSize(m_minButtonSize); controller->SetMinSize(m_minButtonSize);
auto flags = wxSizerFlags().Expand(); auto flags = wxSizerFlags().Expand().Border(wxTOP, 10);
m_sizer->Add(emptySpace, flags); m_sizer->Add(emptySpace, flags);
m_sizer->Add(keyboard, flags); m_sizer->Add(keyboard, flags);
m_sizer->Add(controller, flags); m_sizer->Add(controller, flags);