Add example for background transparency.

This commit is contained in:
Rodrigo Girão Serrão
2022-12-14 14:35:11 +00:00
parent 481ec2a3ab
commit afac92439c
3 changed files with 70 additions and 1 deletions

View File

@@ -50,4 +50,4 @@ Label {
width: auto;
height: 1;
background: $accent;
}
}

View File

@@ -0,0 +1,49 @@
#t10 {
background: red 10%;
}
#t20 {
background: red 20%;
}
#t30 {
background: red 30%;
}
#t40 {
background: red 40%;
}
#t50 {
background: red 50%;
}
#t60 {
background: red 60%;
}
#t70 {
background: red 70%;
}
#t80 {
background: red 80%;
}
#t90 {
background: red 90%;
}
#t100 {
background: red 100%;
}
Screen {
layout: horizontal;
}
Static {
height: 100%;
width: 1fr;
content-align: center middle;
}

View File

@@ -0,0 +1,20 @@
from textual.app import App, ComposeResult
from textual.widgets import Static
class BackgroundTransparencyApp(App):
"""Simple app to exemplify different transparency settings."""
def compose(self) -> ComposeResult:
yield Static("10%", id="t10")
yield Static("20%", id="t20")
yield Static("30%", id="t30")
yield Static("40%", id="t40")
yield Static("50%", id="t50")
yield Static("60%", id="t60")
yield Static("70%", id="t70")
yield Static("80%", id="t80")
yield Static("90%", id="t90")
yield Static("100%", id="t100")
app = BackgroundTransparencyApp(css_path="background_transparency.css")