ENH: dark mode of StateColor

Change-Id: I5928898c50280c7f2eedbb9389032230c7e251c4
This commit is contained in:
chunmao.guo 2022-10-31 14:12:14 +08:00 committed by Lane.Wei
parent faec57d263
commit b209243b27
20 changed files with 155 additions and 38 deletions

View file

@ -48,6 +48,7 @@ OG_CustomCtrl::OG_CustomCtrl( wxWindow* parent,
{
if (!wxOSX)
SetDoubleBuffered(true);// SetDoubleBuffered exists on Win and Linux/GTK, but is missing on OSX
SetBackgroundColour(parent->GetBackgroundColour());
// BBS: new font
m_font = Label::Body_14;
@ -332,7 +333,7 @@ void OG_CustomCtrl::OnPaint(wxPaintEvent&)
// BBS: new layout
if (!GetLabel().IsEmpty()) {
dc.SetFont(Label::Head_16);
wxColour color("#283436");
wxColour color = StateColor::darkModeColorFor("#283436");
draw_title(dc, {0, v_pos}, GetLabel(), &color, h_pos);
dc.SetFont(m_font);
}
@ -759,10 +760,10 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord h_pos, wxCoord v_pos)
const std::vector<Option>& option_set = og_line.get_options();
wxString label = og_line.label;
wxColour blink_color("#00AE42");
wxColour blink_color = StateColor::darkModeColorFor("#00AE42");
bool is_url_string = false;
if (ctrl->opt_group->label_width != 0 && !label.IsEmpty()) {
const wxColour* text_clr = (option_set.size() == 1 && field ? field->label_color() : og_line.full_Label_color);
const wxColour* text_clr = field ? field->label_color() : og_line.full_Label_color;
for (const Option& opt : option_set) {
Field* field = ctrl->opt_group->get_field(opt.opt_id);
if (field && field->blink()) {
@ -850,7 +851,7 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord h_pos, wxCoord v_pos)
is_url_string = false;
else if(opt == option_set.front())
is_url_string = !suppress_hyperlinks && !og_line.label_path.empty();
static wxColor c("#6B6B6B");
wxColor c = StateColor::darkModeColorFor("#6B6B6B");
h_pos = draw_text(dc, wxPoint(h_pos, v_pos), label, field ? (field->blink() ? &blink_color : &c) : nullptr, ctrl->opt_group->sublabel_width * ctrl->m_em_unit, is_url_string);
h_pos += 8;
}
@ -905,7 +906,7 @@ wxCoord OG_CustomCtrl::CtrlLine::draw_text(wxDC &dc, wxPoint pos, const wxString
wxColour old_clr = dc.GetTextForeground();
wxFont old_font = dc.GetFont();
static wxColor clr_url("#00AE42");
wxColor clr_url = StateColor::darkModeColorFor("#00AE42");
if (is_focused && is_url) {
// temporary workaround for the OSX because of strange Bold font behavior on BigSerf
#ifdef __APPLE__