mirror of
https://github.com/Textualize/rich.git
synced 2025-08-04 18:18:22 +00:00
doc fix
This commit is contained in:
parent
2a73d3dccf
commit
7012f3d3aa
2 changed files with 2 additions and 2 deletions
|
@ -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()
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue