mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 19:57:45 +03:00
LibGUI: Use inactive selection colors from palette instead of hardcoding them
This commit is contained in:
parent
99192fd29f
commit
4d95163400
Notes:
sideshowbarker
2024-07-19 09:18:46 +09:00
Author: https://github.com/xTibor Commit: https://github.com/SerenityOS/serenity/commit/4d951634009 Pull-request: https://github.com/SerenityOS/serenity/pull/1224
@ -94,8 +94,10 @@ void ColumnsView::paint_event(PaintEvent& event)
|
||||
Color background_color = palette().color(background_role());
|
||||
Color text_color = palette().color(foreground_role());
|
||||
|
||||
if (next_column != nullptr && next_column->parent_index == index)
|
||||
background_color = background_color.blend(palette().selection().with_alpha(100));
|
||||
if (next_column != nullptr && next_column->parent_index == index) {
|
||||
background_color = palette().inactive_selection();
|
||||
text_color = palette().inactive_selection_text();
|
||||
}
|
||||
|
||||
if (is_selected_row) {
|
||||
background_color = palette().selection();
|
||||
|
@ -269,7 +269,7 @@ void ItemView::paint_event(PaintEvent& event)
|
||||
bool is_selected_item = selection().contains(model_index);
|
||||
Color background_color;
|
||||
if (is_selected_item) {
|
||||
background_color = is_focused() ? palette().selection() : Color::from_rgb(0x606060);
|
||||
background_color = is_focused() ? palette().selection() : palette().inactive_selection();
|
||||
} else {
|
||||
background_color = widget_background_color;
|
||||
}
|
||||
@ -289,7 +289,7 @@ void ItemView::paint_event(PaintEvent& event)
|
||||
|
||||
Color text_color;
|
||||
if (is_selected_item)
|
||||
text_color = palette().selection_text();
|
||||
text_color = is_focused() ? palette().selection_text() : palette().inactive_selection_text();
|
||||
else
|
||||
text_color = model()->data(model_index, Model::Role::ForegroundColor).to_color(palette().color(foreground_role()));
|
||||
painter.fill_rect(text_rect, background_color);
|
||||
|
@ -126,7 +126,7 @@ void ListView::paint_event(PaintEvent& event)
|
||||
|
||||
Color background_color;
|
||||
if (is_selected_row) {
|
||||
background_color = is_focused() ? palette().selection() : Color::from_rgb(0x606060);
|
||||
background_color = is_focused() ? palette().selection() : palette().inactive_selection();
|
||||
} else {
|
||||
Color row_fill_color = palette().color(background_role());
|
||||
if (alternating_row_colors() && (painted_item_index % 2)) {
|
||||
@ -151,7 +151,7 @@ void ListView::paint_event(PaintEvent& event)
|
||||
} else {
|
||||
Color text_color;
|
||||
if (is_selected_row)
|
||||
text_color = palette().selection_text();
|
||||
text_color = is_focused() ? palette().selection_text() : palette().inactive_selection_text();
|
||||
else
|
||||
text_color = model()->data(index, Model::Role::ForegroundColor).to_color(palette().color(foreground_role()));
|
||||
auto text_rect = row_rect;
|
||||
|
@ -85,8 +85,8 @@ void TableView::paint_event(PaintEvent& event)
|
||||
Color background_color;
|
||||
Color key_column_background_color;
|
||||
if (is_selected_row) {
|
||||
background_color = is_focused() ? palette().selection() : Color::from_rgb(0x606060);
|
||||
key_column_background_color = is_focused() ? palette().selection() : Color::from_rgb(0x606060);
|
||||
background_color = is_focused() ? palette().selection() : palette().inactive_selection();
|
||||
key_column_background_color = is_focused() ? palette().selection() : palette().inactive_selection();
|
||||
} else {
|
||||
if (alternating_row_colors() && (painted_item_index % 2)) {
|
||||
background_color = widget_background_color.darkened(0.8f);
|
||||
@ -125,7 +125,7 @@ void TableView::paint_event(PaintEvent& event)
|
||||
} else {
|
||||
Color text_color;
|
||||
if (is_selected_row)
|
||||
text_color = palette().selection_text();
|
||||
text_color = is_focused() ? palette().selection_text() : palette().inactive_selection_text();
|
||||
else
|
||||
text_color = model()->data(cell_index, Model::Role::ForegroundColor).to_color(palette().color(foreground_role()));
|
||||
painter.draw_text(cell_rect, data.to_string(), font, column_metadata.text_alignment, text_color, Gfx::TextElision::Right);
|
||||
|
@ -213,13 +213,13 @@ void TreeView::paint_event(PaintEvent& event)
|
||||
|
||||
Color text_color = palette().color(foreground_role());
|
||||
if (is_selected_row)
|
||||
text_color = Color::White;
|
||||
text_color = is_focused() ? palette().selection_text() : palette().inactive_selection_text();
|
||||
|
||||
Color background_color;
|
||||
Color key_column_background_color;
|
||||
if (is_selected_row) {
|
||||
background_color = is_focused() ? palette().selection() : Color::from_rgb(0x606060);
|
||||
key_column_background_color = is_focused() ? palette().selection() : Color::from_rgb(0x606060);
|
||||
background_color = is_focused() ? palette().selection() : palette().inactive_selection();
|
||||
key_column_background_color = is_focused() ? palette().selection() : palette().inactive_selection();
|
||||
} else {
|
||||
if (alternating_row_colors() && (painted_row_index % 2)) {
|
||||
background_color = Color(220, 220, 220);
|
||||
|
Loading…
Reference in New Issue
Block a user