-
Notifications
You must be signed in to change notification settings - Fork 819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-render options in OptionList #3304
Comments
If I'm interpreting the issue correctly, it isn't just Code for the app above.from textual.app import App, ComposeResult
from textual.widgets import Checkbox, Footer, Header, DataTable, OptionList
from textual.widgets.option_list import Option
class OptionListApp(App[None]):
CSS = """
OptionList > .option-list--option-hover {
# background: red;
text-opacity: 0%;
opacity: 0%;
text-style: italic;
}
DataTable > .datatable--header {
text-opacity: 0%;
text-style: italic;
}
Checkbox > .toggle--label {
text-opacity: 0%;
text-style: italic;
}
"""
def compose(self) -> ComposeResult:
yield Header()
yield OptionList(
Option("Aerilon", id="aer"),
Option("Aquaria", id="aqu"),
)
dt = DataTable()
dt.add_column("oi")
yield dt
yield Checkbox("text")
yield Footer()
if __name__ == "__main__":
OptionListApp().run() |
This will require a fairly substantial refactor. Essentially the approach of pre-rendering content, and then applying styles to get modifiers like select / hover, isn't going to take alpha in to account. We need to re-render options with different component classes. This may be one for @davep since he built the original. |
I can do it, no problem. |
TL;DR: This will likely be fixed if Textual#3342 is fixed first. |
Recently fixed |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
The OptionList will render all the options, and then apply styles to them post render to indicate a highlight.
The problem with this approach is that alpha / dim etc are not taken in to account. The result is that text with alpha, or the dim style, don't apply to the new highlight background.
I think we can re-render highlighted items so that the alpha applies.
The text was updated successfully, but these errors were encountered: