Setting the background colour in vnc_lite.html

203 views
Skip to first unread message

sblinkhorn

unread,
Oct 21, 2021, 6:22:50 AM10/21/21
to noVNC
I am unable to get control of the background-color setting in vnc_lite.html.
If I set it in the CSS body section, that colour appears briefly as the page loads, but is then overwritten by what I take to be the DEFAULT_BACKGROUND setting.  But if I change that definition in core/rfb.js it has no effect.  It looks to me as if the dark grey background is set programmatically after the CSS has been processed.  But where?

Pierre Ossman

unread,
Nov 3, 2021, 11:07:07 AM11/3/21
to no...@googlegroups.com, sblinkhorn
Yup. It's set by the underlying RFB object. You can change it via the
background property on the object. E.g.:

rfb.background = 'blue';

Regards
--
Pierre Ossman Software Development
Cendio AB https://cendio.com
Teknikringen 8 https://twitter.com/ThinLinc
583 30 Linköping https://facebook.com/ThinLinc
Phone: +46-13-214600

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

Steve Blinkhorn

unread,
Nov 3, 2021, 11:48:11 AM11/3/21
to Pierre Ossman, no...@googlegroups.com, sblinkhorn
You wrote:
>
> On 21/10/2021 12:22, sblinkhorn wrote:
> > I am unable to get control of the background-color setting in vnc_lite.html.
> > If I set it in the CSS body section, that colour appears briefly as the
> > page loads, but is then overwritten by what I take to be the
> > DEFAULT_BACKGROUND setting. But if I change that definition in core/rfb.js
> > it has no effect. It looks to me as if the dark grey background is set
> > programmatically after the CSS has been processed. But where?
> >
>
> Yup. It's set by the underlying RFB object. You can change it via the
> background property on the object. E.g.:
>
> rfb.background = 'blue';

What I ended up with was:

bgc = readQueryVariable('bgc', 'darkblue');
rfb._screen.style.background = bgc;
rfb_body.style.background = bgc;

pulling in the code for readQueryVariable() from, IIRC, vnc.html, or
possibly webutil.js), which allows me to set the background of a
full-screen page with an app in an <iframe> from the query data in a
URL. But it was a long and winding road.

Kind regards,

--
Steve Blinkhorn <st...@prd.co.uk>
Reply all
Reply to author
Forward
0 new messages