Better background handling in themes

- Modify view structures so that we're able to
  control background drawing better
- Remove transparent concept from box view
- Add background styles for dialog, menu/status bars
- Relates #824
This commit is contained in:
Janne Valkealahti
2023-10-19 13:12:42 +01:00
parent 860c8dcb93
commit 8de0ef47df
12 changed files with 168 additions and 32 deletions

View File

@@ -245,11 +245,19 @@ public class Catalog {
}
@Override
public void draw(Screen screen) {
protected void drawBackground(Screen screen) {
int bgColor = resolveThemeBackground(getBackgroundStyle(), getBackgroundColor(), -1);
if (bgColor > -1) {
Rectangle rect = getRect();
screen.writerBuilder().build().background(rect, bgColor);
}
}
@Override
protected void drawContent(Screen screen) {
Rectangle rect = getRect();
Writer writer = screen.writerBuilder().style(getStyle()).build();
writer.text(String.format("%-20s %s", getItem().name(), getItem().description()), rect.x(), rect.y());
writer.background(rect, getBackgroundColor());
}
}

View File

@@ -59,6 +59,26 @@ class CatalogConfiguration {
return "bg:blue";
}
@Override
public String dialogBackground() {
return "bg:green";
}
@Override
public String buttonBackground() {
return "bg:red";
}
@Override
public String menubarBackground() {
return "bg:magenta";
}
@Override
public String statusbarBackground() {
return "bg:cyan";
}
}
}