textual
textual copied to clipboard
DataTable appears not to respect link CSS?
Hopefully this is self-explanatory.. links inside Rich Text in a DataTable appear not to respect link-color, link-background, link-style.... end result being links and non-links are indistinguishable until you trace the mouse over table contents? Here is a simple example. Sorry for formatting, not sure how to upload a code example yet:
from textual.app import App, ComposeResult
from rich.text import Text
from textual.widgets import Static
from textual.widgets import DataTable
ROWS = [
("lane", "swimmer"),
(4, "Table Text only appears to respect link CSS [@click=app.bell]when you position the mouse over the link itself? i.e. respects link-style-hover, link-color-hover, link-background-hover but not link-color, link-background, link-style[/]"),
]
class TableApp(App):
CSS = """
* {
link-color: blue;
link-background: purple;
link-style: underline blink;
link-style-hover: blink;
link-color-hover: green;
link-background-hover: yellow;
}
"""
def compose(self) -> ComposeResult:
yield Static("Regular text respects link css [@click=app.bell]all the time[/]")
yield DataTable()
def on_mount(self) -> None:
table = self.query_one(DataTable)
table.add_columns(*ROWS[0])
for row in ROWS[1:]:
styled_row = [
Text.from_markup(str(cell), style="italic #03AC13", justify="right") for cell in row
]
table.add_row(*styled_row)
app = TableApp()
if __name__ == "__main__":
app.run()
Textual Diagnostics
Versions
| Name | Value |
|---|---|
| Textual | 0.77.0 |
| Rich | 13.7.1 |
Python
| Name | Value |
|---|---|
| Version | 3.12.7 |
| Implementation | CPython |
| Compiler | GCC 14.2.1 20240910 |
| Executable | /home/lee/trend/.venv/bin/python3.12 |
Operating System
| Name | Value |
|---|---|
| System | Linux |
| Release | 6.11.10-2-MANJARO |
| Version | #1 SMP PREEMPT_DYNAMIC Mon, 25 Nov 2024 05:29:44 +0000 |
Terminal
| Name | Value |
|---|---|
| Terminal Application | Unknown |
| TERM | xterm-256color |
| COLORTERM | truecolor |
| FORCE_COLOR | Not set |
| NO_COLOR | Not set |
Rich Console options
| Name | Value |
|---|---|
| size | width=210, height=52 |
| legacy_windows | False |
| min_width | 1 |
| max_width | 210 |
| is_terminal | True |
| encoding | utf-8 |
| max_height | 52 |
| justify | None |
| overflow | None |
| no_wrap | False |
| highlight | None |
| markup | None |
| height | None |
We found the following entry in the FAQ which you may find helpful:
Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.
This is an automated reply, generated by FAQtory
Anyone?