mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-13 22:23:45 +00:00
terminal: make background color configurable
This commit is contained in:
parent
b96f0fa2df
commit
c1d2388c76
@ -61,6 +61,15 @@ class Terminal::Color_palette
|
||||
}
|
||||
}
|
||||
|
||||
void apply_config(Xml_node config)
|
||||
{
|
||||
config.for_each_sub_node("color", [&] (Xml_node color) {
|
||||
unsigned const index = min(color.attribute_value("index", 0U), 15U);
|
||||
Color const bg = color.attribute_value("bg", Color());
|
||||
_colors[index] = bg;
|
||||
});
|
||||
}
|
||||
|
||||
Color foreground(Index index, Highlighted highlighted, Inverse inverse) const
|
||||
{
|
||||
if (index.value >= NUM_COLORS/2)
|
||||
|
@ -159,6 +159,8 @@ void Terminal::Main::_handle_config()
|
||||
|
||||
Xml_node const config = _config.xml();
|
||||
|
||||
_color_palette.apply_config(config);
|
||||
|
||||
_font.destruct();
|
||||
|
||||
_root_dir.apply_config(config.sub_node("vfs"));
|
||||
|
@ -175,11 +175,15 @@ class Terminal::Text_screen_surface
|
||||
|
||||
/* clear border */
|
||||
{
|
||||
Color const bg_color =
|
||||
_palette.background(Color_palette::Index{0},
|
||||
Color_palette::Highlighted{false},
|
||||
Color_palette::Inverse{false});
|
||||
Rect r[4] { };
|
||||
Rect const all(Point(0, 0), _geometry.fb_size);
|
||||
_geometry.fb_rect().cut(_geometry.used_rect(), &r[0], &r[1], &r[2], &r[3]);
|
||||
for (unsigned i = 0; i < 4; i++)
|
||||
Box_painter::paint(surface, r[i], Color(0, 0, 0));
|
||||
Box_painter::paint(surface, r[i], bg_color);
|
||||
}
|
||||
|
||||
int const clip_top = 0, clip_bottom = _geometry.fb_size.h(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user