(modifiers == (Modifiers::AltKey | Modifiers::IsRight));
}
+SkColor ParseHexColor(const std::string& name) {
+ SkColor result = 0xFF000000;
+ unsigned value = 0;
+ auto color = name.substr(1);
+ unsigned length = color.size();
+ if (length != 3 && length != 6)
+ return result;
+ for (unsigned i = 0; i < length; ++i) {
+ if (!base::IsHexDigit(color[i]))
+ return result;
+ value <<= 4;
+ value |= (color[i] < 'A' ? color[i] - '0' : (color[i] - 'A' + 10) & 0xF);
+ }
+ if (length == 6) {
+ result |= value;
+ return result;
+ }
+ result |= (value & 0xF00) << 12 | (value & 0xF00) << 8
+ | (value & 0xF0) << 8 | (value & 0xF0) << 4
+ | (value & 0xF) << 4 | (value & 0xF);
+ return result;
+}
+
class NativeWindowClientView : public views::ClientView {
public:
NativeWindowClientView(views::Widget* widget,
// Add web view.
SetLayoutManager(new MenuLayout(this, kMenuBarHeight));
- set_background(views::Background::CreateStandardPanelBackground());
+
+ // web views' background color.
+ std::string background_color = "#fff";
+ options.Get(switches::kBackgroundColor, &background_color);
+ set_background(views::Background::CreateSolidBackground(
+ ParseHexColor(background_color)));
+
AddChildView(web_view_);
#if defined(OS_WIN)
// Use the OS X's standard window instead of the textured window.
const char kStandardWindow[] = "standard-window";
+// Default browser window background color.
+const char kBackgroundColor[] = "background-color";
+
// Path to client certificate.
const char kClientCertificate[] = "client-certificate";
extern const char kType[];
extern const char kDisableAutoHideCursor[];
extern const char kStandardWindow[];
+extern const char kBackgroundColor[];
extern const char kClientCertificate[];
extern const char kExperimentalFeatures[];
key is pressed.
* `enable-larger-than-screen` Boolean - Enable the window to be resized larger
than screen.
+* `background-color` String - Window's background color as Hexadecimal value.
+```javascript
+var win = new BrowserWindow({ width: 800, height: 600, 'background-color': '#66CD00' })
+
+// #abc will be expanded to #aabbcc
+var win = new BrowserWindow({ width: 800, height: 600, 'background-color': '#fff' })
+```
* `dark-theme` Boolean - Forces using dark theme for the window, only works on
some GTK+3 desktop environments.
* `transparent` Boolean - Makes the window [transparent](frameless-window.md).