mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add example for background transparency.
This commit is contained in:
@@ -50,4 +50,4 @@ Label {
|
||||
width: auto;
|
||||
height: 1;
|
||||
background: $accent;
|
||||
}
|
||||
}
|
||||
|
||||
49
docs/examples/styles/background_transparency.css
Normal file
49
docs/examples/styles/background_transparency.css
Normal 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;
|
||||
}
|
||||
20
docs/examples/styles/background_transparency.py
Normal file
20
docs/examples/styles/background_transparency.py
Normal 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")
|
||||
Reference in New Issue
Block a user