Add example to show auto selection of text color.

This commit is contained in:
Rodrigo Girão Serrão
2022-12-15 17:25:39 +00:00
parent f0ea8a8664
commit decdc892e9
2 changed files with 40 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
Label {
color: auto 80%;
content-align: center middle;
height: 1fr;
width: 100%;
}
#lbl1 {
background: red 80%;
}
#lbl2 {
background: yellow 80%;
}
#lbl3 {
background: blue 80%;
}
#lbl4 {
background: pink 80%;
}
#lbl5 {
background: green 80%;
}

View File

@@ -0,0 +1,14 @@
from textual.app import App
from textual.widgets import Label
class ColorApp(App):
def compose(self):
yield Label("The quick brown fox jumps over the lazy dog!", id="lbl1")
yield Label("The quick brown fox jumps over the lazy dog!", id="lbl2")
yield Label("The quick brown fox jumps over the lazy dog!", id="lbl3")
yield Label("The quick brown fox jumps over the lazy dog!", id="lbl4")
yield Label("The quick brown fox jumps over the lazy dog!", id="lbl5")
app = ColorApp(css_path="color_auto.css")