Skip to content

One liner to construct mixed color text for console.print? #1775

Answered by willmcgugan
hemna asked this question in Q&A
Discussion options

You must be logged in to vote

Two options:

msg = Text.from_markup("This is a [green]test[/] and another [blue]test2[/] and something")
msg = Text.assemble(
    "This is a ",
    ("test", "green"),
    " and another ",
    ("test2, blue"),
    " and something"
)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@hemna
Comment options

Answer selected by hemna
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants