mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add example to show auto selection of text color.
This commit is contained in:
26
docs/examples/styles/color_auto.css
Normal file
26
docs/examples/styles/color_auto.css
Normal 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%;
|
||||
}
|
||||
14
docs/examples/styles/color_auto.py
Normal file
14
docs/examples/styles/color_auto.py
Normal 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")
|
||||
Reference in New Issue
Block a user