fix: default to system accent color on invalid user color (#47921)
fix: default to system accent color on invalid user color" Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
parent
61ba91a254
commit
c787127e91
11 changed files with 38 additions and 41 deletions
|
@ -234,7 +234,7 @@ void BrowserWindow::Blur() {
|
|||
|
||||
void BrowserWindow::SetBackgroundColor(const std::string& color_name) {
|
||||
BaseWindow::SetBackgroundColor(color_name);
|
||||
SkColor color = ParseCSSColor(color_name);
|
||||
SkColor color = ParseCSSColor(color_name).value_or(SK_ColorWHITE);
|
||||
if (api_web_contents_) {
|
||||
api_web_contents_->SetBackgroundColor(color);
|
||||
// Also update the web preferences object otherwise the view will be reset
|
||||
|
@ -242,7 +242,7 @@ void BrowserWindow::SetBackgroundColor(const std::string& color_name) {
|
|||
auto* web_preferences =
|
||||
WebContentsPreferences::From(api_web_contents_->web_contents());
|
||||
if (web_preferences) {
|
||||
web_preferences->SetBackgroundColor(ParseCSSColor(color_name));
|
||||
web_preferences->SetBackgroundColor(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue