Overriding existing style #871
|
If I have an existing Text object (or some other renderable), is there a way to override an existing style on it? For instance, let's say that I have a I've tried passing a style on the print() of this object, but the style set on the Text object seem to take precedence, with anything on the print() only being able to set additional styles which were not previously set. The specific use case here is that I want to accept markup text from an external source but then force certain styles on that input (such as disabling blinking) before rendering it. |
Answered by
willmcgugan
Dec 31, 2020
Replies: 1 comment 1 reply
|
You can negate styles, which may have the effect you are looking for. Something like this: t = Text.from_markup("[bold red]some text[/]")
t.stylize("not bold") |
1 reply
Answer selected by
ronf
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can negate styles, which may have the effect you are looking for. Something like this: