This commit is contained in:
Will McGugan 2020-07-23 17:51:00 +01:00
parent 2a73d3dccf
commit 7012f3d3aa
2 changed files with 2 additions and 2 deletions

View file

@ -52,7 +52,7 @@ Here's a silly example that highlights every character with a different color::
class RainbowHighlighter(Highlighter):
def highlight(self, text):
for index in range(len(text)):
text.stylize(index, index + 1, str(randint(16, 255)))
text.stylize(str(randint(16, 255)), index, index + 1)
rainbow = RainbowHighlighter()

View file

@ -9,7 +9,7 @@ One way to add a style to Text is the :meth:`~rich.text.Text.stylize` method whi
from rich.text import Text
text = Text("Hello, World!")
text.stylize(0, 6, "bold magenta")
text.stylize("bold magenta", 0, 6)
console.print(text)
This will print "Hello, World!" to the terminal, with the first word in bold magenta.