Update color/README.md
This commit is contained in:
@@ -1,12 +1,5 @@
|
|||||||
```python
|
```python
|
||||||
color = lambda ansi, text: f"\x1b[{ansi}m{text}\x1b[0m"
|
globals().update({color: lambda text, ansi=ansi: f'\x1b[{ansi}m{text}\x1b[0m'
|
||||||
for name, ansi in zip("red green yellow blue magenta cyan".split(), range(91, 97)):
|
for color, ansi in zip("red green yellow blue magenta cyan".split(), range(91, 97))})
|
||||||
setattr(color, name, lambda text, ansi=ansi: color(ansi, text))
|
print(red('hello'))
|
||||||
|
|
||||||
print(color.red("Red"))
|
|
||||||
print(color.green("Green"))
|
|
||||||
print(color.yellow("Yellow"))
|
|
||||||
print(color.blue("Blue"))
|
|
||||||
print(color.magenta("Magenta"))
|
|
||||||
print(color.cyan("Cyan"))
|
|
||||||
```
|
```
|
||||||
Reference in New Issue
Block a user