Update tint example to use labels.

This commit is contained in:
Rodrigo Girão Serrão
2023-01-06 14:53:07 +00:00
parent 69a143442c
commit ee4b2cfe9e
2 changed files with 4 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
Static {
Label {
height: 3;
width: 100%;
text-style: bold;
background: white;
color: black;

View File

@@ -1,13 +1,13 @@
from textual.app import App
from textual.color import Color
from textual.widgets import Static
from textual.widgets import Label
class TintApp(App):
def compose(self):
color = Color.parse("green")
for tint_alpha in range(0, 101, 10):
widget = Static(f"tint: green {tint_alpha}%;")
widget = Label(f"tint: green {tint_alpha}%;")
widget.styles.tint = color.with_alpha(tint_alpha / 100)
yield widget