Bug 216795 - System color 'canvas' cannot be set or read
Summary: System color 'canvas' cannot be set or read
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-09-21 12:10 PDT by Дилян Палаузов
Modified: 2020-09-22 15:57 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Дилян Палаузов 2020-09-21 12:10:17 PDT
The way to obtain the default background color set by the user, is to call

function getDefaultBackgroundColor() {
  let div = document.createElement("div");
  div.style.backgroundColor = "canvas";
  document.documentElement.appendChild(div);
  let color = getComputedStyle(div).backgroundColor;
  div.remove();
  return color;
}

This does not work with WebKitGTK 2.28.1/Epiphany 3.36.4.  In particular it allows setting custom CSS, and body.background-color in it, but it is unclear how to use the Canvas keyword as calor there.

• How to configure WebKit to change the default canvas system colour, in terms of https://www.w3.org/TR/css-color-4/#css-system-colors
• Please make the snippet above work.

See also https://bugzilla.mozilla.org/show_bug.cgi?id=1666127 and https://gitlab.gnome.org/GNOME/epiphany/-/issues/1344
Comment 1 Emilio Cobos Álvarez (:emilio) 2020-09-21 12:17:01 PDT
Ideally WebKit would support color: canvas and would allow users to change it, otherwise you need to use user stylesheets which don't reliably work.
Comment 2 Radar WebKit Bug Importer 2020-09-22 15:56:27 PDT
<rdar://problem/69397317>