Opened 3 years ago

Closed 2 years ago

#17629 closed enhancement (fixed)

Webkit: support rendering dark controls

Reported by: nephele Owned by: nephele
Priority: normal Milestone: R1/beta5
Component: Kits/Web Kit Version: R1/Development
Keywords: Cc: pulkomandy
Blocked By: Blocking:
Platform: All

Description (last modified by nephele)

For webkit we currently render controls in "whatever the system has" This causes quite a bit of problems if the system is in a dark mode but the website is not, and vice versa! To fix this I want to implement support for the color-scheme in webkit, the only problem is that if the system is in light mode we don't know what the dark mode colors are, and for dark mode we don't know what the light mode colors are. I would trefore use the default colors in this case (perhaps the decorator can in the future provide those?)

Please comment on the aproach. example provided below

bool RenderThemeHaiku::paintSliderTrack(const RenderObject& object, const PaintInfo& info, const IntRect& intRect)
{
    rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
+    if (object->useDarkAppearence()) {
+        if (base.Brightness() > 127) // system is in light mode, but we need dark
+            base = BPrivate::kDefaultColors[B_PANEL_BACKGROUND_COLOR];
+    } else {
+        if (base.Brightness() < 127) // system is in dark mode, but we need light
+            base = BPrivate::kDefaultColorsDark[B_PANEL_BACKGROUND_COLOR];
+    }
    rgb_color background = base;
        // TODO: From PaintInfo?
    BRect rect = intRect;

And an example of a hard to see rendering with the current code

Attachments (1)

trac.png (16.7 KB ) - added by nephele 3 years ago.

Download all attachments as: .zip

Change History (6)

by nephele, 3 years ago

Attachment: trac.png added

comment:1 by nephele, 3 years ago

Description: modified (diff)

comment:2 by nephele, 3 years ago

Description: modified (diff)

comment:3 by nephele, 3 years ago

Cc: pulkomandy added
Owner: changed from pulkomandy to nephele
Status: newin-progress

comment:4 by nephele, 3 years ago

Nice ressource to test this: https://color-scheme-demo.glitch.me/

comment:5 by nephele, 2 years ago

Milestone: UnscheduledR1/beta5
Resolution: fixed
Status: in-progressclosed
Note: See TracTickets for help on using tickets.