diff options
author | Samuel Mannehed <samuel@cendio.se> | 2019-01-21 13:39:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-21 13:39:31 +0100 |
commit | 36bfcb0714ddeb0107933589bc4fc108ad54cd8d (patch) | |
tree | 8de3738cd432f481f86bd017105ef5d1f57ac069 | |
parent | 7dc0a67808c047223109e798802598e03c72339f (diff) | |
parent | d7791ebbcdbde94fd526d9748243379ee651eede (diff) | |
download | novnc-36bfcb0714ddeb0107933589bc4fc108ad54cd8d.tar.gz |
Merge pull request #1190 from saucelabs/screen_background
Make the screen background customizable
-rw-r--r-- | core/rfb.js | 6 | ||||
-rw-r--r-- | docs/API.md | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/core/rfb.js b/core/rfb.js index 580708f..42c4ad3 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -31,6 +31,7 @@ import TightPNGDecoder from "./decoders/tightpng.js"; // How many seconds to wait for a disconnect to finish const DISCONNECT_TIMEOUT = 3; +const DEFAULT_BACKGROUND = 'rgb(40, 40, 40)'; export default class RFB extends EventTargetMixin { constructor(target, url, options) { @@ -128,7 +129,7 @@ export default class RFB extends EventTargetMixin { this._screen.style.width = '100%'; this._screen.style.height = '100%'; this._screen.style.overflow = 'auto'; - this._screen.style.backgroundColor = 'rgb(40, 40, 40)'; + this._screen.style.background = DEFAULT_BACKGROUND; this._canvas = document.createElement('canvas'); this._canvas.style.margin = 'auto'; // Some browsers add an outline on focus @@ -302,6 +303,9 @@ export default class RFB extends EventTargetMixin { this._refreshCursor(); } + get background() { return this._screen.style.background; } + set background(cssValue) { this._screen.style.background = cssValue; } + // ===== PUBLIC METHODS ===== disconnect() { diff --git a/docs/API.md b/docs/API.md index ae7fb66..d587429 100644 --- a/docs/API.md +++ b/docs/API.md @@ -58,6 +58,12 @@ protocol stream. instead of a zero-sized or fully-transparent cursor if the server sets such invisible cursor. Disabled by default. +`background` + - Is a valid CSS [background](https://developer.mozilla.org/en-US/docs/Web/CSS/background) + style value indicating which background style should be applied + to the element containing the remote session screen. The default value is `rgb(40, 40, 40)` + (solid gray color). + `capabilities` *Read only* - Is an `Object` indicating which optional extensions are available on the server. Some methods may only be called if the corresponding |