terminal: make background color configurable

This commit is contained in:
Norman Feske 2018-06-08 16:52:46 +02:00 committed by Christian Helmuth
parent b96f0fa2df
commit c1d2388c76
3 changed files with 16 additions and 1 deletions

View File

@ -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)

View File

@ -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"));

View File

@ -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(),