Opened 3 years ago

Last modified 22 months ago

#17629 closed enhancement

Webkit: support rendering dark controls — at Version 1

Reported by: nephele Owned by: pulkomandy
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 dark mode
+            base = BPrivate::kDefaultColorsDark[B_PANEL_BACKGROUND_COLOR];
+    } else {
+        if (base.Brightness() < 127) // system is in dark mode
+            base = BPrivate::kDefaultColors[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

Change History (2)

by nephele, 3 years ago

Attachment: trac.png added

comment:1 by nephele, 3 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.