Consolidate styles (#1116)

* Consolidate styles into a Styles class and clean up code

* Format

* Add style_bg_dark_grey for nav bar

* Fix bugs found in PR

* Rename styles

* Add bg_white style

---------

Co-authored-by: kallanreed <kallanreed@outlook.com>
Co-authored-by: gullradriel <3157857+gullradriel@users.noreply.github.com>
This commit is contained in:
Kyle Reed 2023-06-07 08:33:32 -07:00 committed by GitHub
parent 496b124baf
commit 0f28fefc82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 299 additions and 400 deletions

View file

@ -205,7 +205,7 @@ void TextViewer::paint_text(Painter& painter, uint32_t line, uint16_t col) {
if (result && *result > 0)
painter.draw_string(
{0, r.top() + (int)i * char_height},
style_text, {buffer, *result});
Styles::white_small, {buffer, *result});
// Clear empty line sections. This is less visually jarring than full clear.
int32_t clear_width = max_col - (result ? *result : 0);
@ -214,7 +214,7 @@ void TextViewer::paint_text(Painter& painter, uint32_t line, uint16_t col) {
{(max_col - clear_width) * char_width,
r.top() + (int)i * char_height,
clear_width * char_width, char_height},
style_text.background);
Styles::white_small.background);
}
}
@ -235,8 +235,8 @@ void TextViewer::paint_cursor(Painter& painter) {
};
// Clear old cursor. CONSIDER: XOR cursor?
draw_cursor(paint_state_.line, paint_state_.col, style_text.background);
draw_cursor(cursor_.line, cursor_.col, style_text.foreground);
draw_cursor(paint_state_.line, paint_state_.col, Styles::white_small.background);
draw_cursor(cursor_.line, cursor_.col, Styles::white_small.foreground);
paint_state_.line = cursor_.line;
paint_state_.col = cursor_.col;
}