Skip to content

Commit

Permalink
fix: vibrant window should have transparent background (electron#31493)
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere authored and t57ser committed Oct 29, 2021
1 parent f0432e0 commit 3a394d3
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions shell/browser/api/electron_api_browser_window.cc
Expand Up @@ -37,14 +37,22 @@ BrowserWindow::BrowserWindow(gin::Arguments* args,
gin::Dictionary::CreateEmpty(isolate);
options.Get(options::kWebPreferences, &web_preferences);

// Copy the backgroundColor to webContents.
v8::Local<v8::Value> value;
bool transparent = false;
options.Get(options::kTransparent, &transparent);

std::string vibrancy_type;
#if defined(OS_MAC)
options.Get(options::kVibrancyType, &vibrancy_type);
#endif

// Copy the backgroundColor to webContents.
if (options.Get(options::kBackgroundColor, &value)) {
web_preferences.SetHidden(options::kBackgroundColor, value);
} else if (options.Get(options::kTransparent, &transparent) && transparent) {
// If the BrowserWindow is transparent, also propagate transparency to the
// WebContents unless a separate backgroundColor has been set.
} else if (!vibrancy_type.empty() || transparent) {
// If the BrowserWindow is transparent or a vibrancy type has been set,
// also propagate transparency to the WebContents unless a separate
// backgroundColor has been set.
web_preferences.SetHidden(options::kBackgroundColor,
ToRGBAHex(SK_ColorTRANSPARENT));
}
Expand Down

0 comments on commit 3a394d3

Please sign in to comment.