From 8ce8b4c33a1643de2716ee88e4bfa725f4a06140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Gir=C3=A3o=20Serr=C3=A3o?= <5621605+rodrigogiraoserrao@users.noreply.github.com> Date: Tue, 20 Dec 2022 18:47:15 +0000 Subject: [PATCH] Add example for link hover background. --- .../examples/styles/link_hover_background.css | 11 ++++++++ docs/examples/styles/link_hover_background.py | 25 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 docs/examples/styles/link_hover_background.css create mode 100644 docs/examples/styles/link_hover_background.py diff --git a/docs/examples/styles/link_hover_background.css b/docs/examples/styles/link_hover_background.css new file mode 100644 index 000000000..68d564ae2 --- /dev/null +++ b/docs/examples/styles/link_hover_background.css @@ -0,0 +1,11 @@ +#lbl1, #lbl2 { + link-hover-background: red; /* (1)! */ +} + +#lbl3 { + link-hover-background: hsl(60,100%,50%) 50%; +} + +#lbl4 { + /* Empty to show the default hover background */ /* (2)! */ +} diff --git a/docs/examples/styles/link_hover_background.py b/docs/examples/styles/link_hover_background.py new file mode 100644 index 000000000..f1112b355 --- /dev/null +++ b/docs/examples/styles/link_hover_background.py @@ -0,0 +1,25 @@ +from textual.app import App +from textual.widgets import Label + + +class LinkHoverBackgroundApp(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 = LinkHoverBackgroundApp(css_path="link_hover_background.css")