Update color/README.md

This commit is contained in:
2024-09-27 10:51:33 -04:00
parent 7cdf8cba70
commit 524f9f79ae

View File

@@ -1,5 +1,5 @@
```python
globals().update({color: lambda text, ansi=ansi: f'\x1b[{ansi}m{text}\x1b[0m'
for color, ansi in zip("red green yellow blue magenta cyan".split(), range(91, 97))})
print(red('hello'))
globals().update({color: lambda text, ansi=91+i: f'\x1b[{ansi}m{text}\x1b[0m'
for i, color in enumerate('red green yellow blue magenta cyan'.split())})
print(red('hello'), green('world'))
```