feat: support more color formats for backgroundColor
(#31868)
This commit is contained in:
parent
4b8b492b62
commit
db79734bfb
13 changed files with 144 additions and 55 deletions
|
@ -370,7 +370,7 @@ void BrowserWindow::Blur() {
|
|||
|
||||
void BrowserWindow::SetBackgroundColor(const std::string& color_name) {
|
||||
BaseWindow::SetBackgroundColor(color_name);
|
||||
SkColor color = ParseHexColor(color_name);
|
||||
SkColor color = ParseCSSColor(color_name);
|
||||
web_contents()->SetPageBaseBackgroundColor(color);
|
||||
auto* rwhv = web_contents()->GetRenderWidgetHostView();
|
||||
if (rwhv) {
|
||||
|
@ -384,7 +384,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(ParseHexColor(color_name));
|
||||
web_preferences->SetBackgroundColor(ParseCSSColor(color_name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue