Add example for link background.

This commit is contained in:
Rodrigo Girão Serrão
2022-12-20 18:46:33 +00:00
parent 4aad7cda89
commit 8138961f60
2 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
#lbl1, #lbl2 {
link-background: red; /* (1)! */
}
#lbl3 {
link-background: hsl(60,100%,50%) 50%;
}
#lbl4 {
link-background: $accent;
}

View File

@@ -0,0 +1,25 @@
from textual.app import App
from textual.widgets import Label
class LinkBackgroundApp(App):
def compose(self):
yield Label(
"Visit the [link=https://textualize.io]Textualize[/link] website.",
id="lbl1", # (1)!
)
yield Label(
"Click [@click=app.bell]here[/] for the bell sound.",
id="lbl2", # (2)!
)
yield Label(
"You can also click [@click=app.bell]here[/] for the bell sound.",
id="lbl3", # (3)!
)
yield Label(
"[@click=app.quit]Exit this application.[/]",
id="lbl4", # (4)!
)
app = LinkBackgroundApp(css_path="link_background.css")