mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 02:29:21 +00:00
LibWeb/CSS: Implement the scrollbar-color
property
This allows the user to set the scrollbar thumb and track colors.
This commit is contained in:
parent
285bc005cb
commit
e2d0d8e2b9
Notes:
github-actions[bot]
2025-06-01 22:18:57 +00:00
Author: https://github.com/tcl3
Commit: e2d0d8e2b9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4893
24 changed files with 212 additions and 10 deletions
|
@ -1001,17 +1001,20 @@ void DisplayListPlayerSkia::paint_scrollbar(PaintScrollBar const& command)
|
|||
|
||||
auto& canvas = surface().canvas();
|
||||
|
||||
auto gutter_fill_color = Color(Color::NamedColor::WarmGray).with_alpha(192);
|
||||
auto gutter_fill_color = command.track_color;
|
||||
SkPaint gutter_fill_paint;
|
||||
gutter_fill_paint.setColor(to_skia_color(gutter_fill_color));
|
||||
canvas.drawRect(gutter_rect, gutter_fill_paint);
|
||||
|
||||
auto thumb_fill_color = Color(Color::NamedColor::DarkGray).with_alpha(gutter_rect.isEmpty() ? 128 : 192);
|
||||
auto thumb_fill_color = command.thumb_color;
|
||||
if (command.gutter_rect.is_empty() && thumb_fill_color == CSS::InitialValues::scrollbar_color().thumb_color)
|
||||
thumb_fill_color = thumb_fill_color.with_alpha(128);
|
||||
|
||||
SkPaint thumb_fill_paint;
|
||||
thumb_fill_paint.setColor(to_skia_color(thumb_fill_color));
|
||||
canvas.drawRRect(thumb_rrect, thumb_fill_paint);
|
||||
|
||||
auto stroke_color = Color(Color::NamedColor::LightGray).with_alpha(128);
|
||||
auto stroke_color = thumb_fill_color.lightened();
|
||||
SkPaint stroke_paint;
|
||||
stroke_paint.setStroke(true);
|
||||
stroke_paint.setStrokeWidth(1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue