Opened 3 years ago
Closed 22 months 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 )
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)
Change History (6)
by , 3 years ago
comment:1 by , 3 years ago
Description: | modified (diff) |
---|
comment:2 by , 3 years ago
Description: | modified (diff) |
---|
comment:3 by , 3 years ago
Cc: | added |
---|---|
Owner: | changed from | to
Status: | new → in-progress |
comment:4 by , 3 years ago
comment:5 by , 22 months ago
Milestone: | Unscheduled → R1/beta5 |
---|---|
Resolution: | → fixed |
Status: | in-progress → closed |
Nice ressource to test this: https://color-scheme-demo.glitch.me/