FIX: support dark mode for print option

jira: [STUDIO-9431]
Change-Id: I9b57f684e5a0b21a3f82b2138f568dd233b8d718
This commit is contained in:
xin.zhang 2025-01-01 12:15:57 +08:00 committed by lane.wei
parent 32250bcbd9
commit 2a07fcf8b9
3 changed files with 19 additions and 10 deletions

View File

@ -4546,7 +4546,7 @@ std::string SelectMachineDialog::get_print_status_info(PrintDialogStatus status)
m_ops = ops;
m_param = param;
SetBackgroundColour(*wxWHITE);
SetBackgroundColour(PRINT_OPT_BG_GRAY);
wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *top_sizer = new wxBoxSizer(wxHORIZONTAL);
@ -4605,7 +4605,7 @@ void PrintOption::doRender(wxDC &dc)
{
auto size = GetSize();
dc.SetPen(wxPen(*wxTRANSPARENT_PEN));
dc.SetBrush(wxBrush(0xF8F8F8));
dc.SetBrush(GetBackgroundColour());
dc.DrawRoundedRectangle(0, 0, size.x, size.y, 3);
}
@ -4641,6 +4641,7 @@ PrintOptionItem::PrintOptionItem(wxWindow *parent, std::vector<POItem> ops, std:
m_ops = ops;
m_param = param;
SetBackgroundColour(PRINT_OPT_ITEM_BG_GRAY);
Bind(wxEVT_PAINT, &PrintOptionItem::OnPaint, this);
auto width = ops.size() * FromDIP(56) + FromDIP(8);
@ -4719,7 +4720,7 @@ void PrintOptionItem::doRender(wxDC &dc)
{
auto size = GetSize();
dc.SetPen(wxPen(*wxTRANSPARENT_PEN));
dc.SetBrush(wxBrush(0xEBEBEB));
dc.SetBrush(GetBackgroundColour());
dc.DrawRoundedRectangle(0, 0, size.x, size.y, 5);
auto left = FromDIP(4);
@ -4741,8 +4742,11 @@ void PrintOptionItem::doRender(wxDC &dc)
auto text_value = it->value;
if (text_key == selected_key) {
dc.SetPen(wxPen(0x00AE42));
dc.SetTextForeground(0x00AE42);
const wxColour& clr = wxGetApp().dark_mode() ? StateColor::darkModeColorFor("#00AE42") : "#00AE42";
dc.SetPen(wxPen(clr));
dc.SetTextForeground(clr);
dc.SetFont(::Label::Head_13);
auto text_size = dc.GetTextExtent(text_value);
auto text_left = left + (FromDIP(56) - text_size.x) / 2;
@ -4750,8 +4754,10 @@ void PrintOptionItem::doRender(wxDC &dc)
dc.DrawText(text_value, wxPoint(text_left, text_top));
}
else {
dc.SetPen(wxPen(*wxBLACK));
dc.SetTextForeground(*wxBLACK);
const wxColour& clr = wxGetApp().dark_mode() ? StateColor::darkModeColorFor(*wxBLACK) : *wxBLACK;
dc.SetPen(wxPen(clr));
dc.SetTextForeground(clr);
dc.SetFont(::Label::Body_13);
auto text_size = dc.GetTextExtent(text_value);
auto text_left = left + (FromDIP(56) - text_size.x) / 2;

View File

@ -42,6 +42,9 @@
#include <wx/simplebook.h>
#include <wx/hashmap.h>
#define PRINT_OPT_BG_GRAY 0xF8F8F8
#define PRINT_OPT_ITEM_BG_GRAY 0xEEEEEE
namespace Slic3r { namespace GUI {
enum PrintFromType {

View File

@ -11,9 +11,9 @@ static std::map<wxColour, wxColour> gDarkColors{
{"#D01B1B", "#BB2A3A"},
{"#262E30", "#EFEFF0"},
{"#2C2C2E", "#B3B3B4"},
{"#6B6B6B", "#818183"},
{"#ACACAC", "#54545A"},
{"#EEEEEE", "#4C4C55"},
{"#6B6B6B", "#818183"},/*gray -> */
{"#ACACAC", "#54545A"},/*gray -> */
{"#EEEEEE", "#4C4C55"},/*gray -> */
{"#E8E8E8", "#3E3E45"},
{"#323A3D", "#E5E5E4"},
{"#FFFFFF", "#2D2D31"},