
글자의 색을 바꾸고자 할 때는 Fore을 이용하고 print가 끝나면 autoreset에 의해서 색상은 복원됩니다.
import colorama
colorama.init(autoreset=True)
print(f"Hello, {colorama.Fore.RED}World")
print("Hello, World")
중간에 강제로 색을 복원할 필요가 있을 경우 RESET을 사용합니다.
import colorama
colorama.init(autoreset=True)
print(f"{colorama.Fore.RED}Hello, {colorama.Fore.RESET}World")
사용 가능한 글자의 색은 다음과 같습니다.
| VARIABLE | COLOR |
|---|---|
| BLACK | BLACK |
| RED | RED |
| GREEN | GREEN |
| YELLOW | YELLOW |
| BLUE | BLUE |
| MAGENTA | MAGENTA |
| CYAN | CYAN |
| WHITE | WHITE |
배경의 색을 바꾸고자 할 때는 Back을 이용하고
print가 끝나면 autoreset에 의해서 색상은 복원됩니다.
import colorama
colorama.init(autoreset=True)
print(f"Hello, {colorama.Back.RED}World")
print("Hello, World")
중간에 강제로 색을 복원할 필요가 있을 경우 RESET을 사용합니다.
import colorama
colorama.init(autoreset=True)
print(f"{colorama.Back.RED}Hello, {colorama.Back.RESET}World")
사용 가능한 배경의 색은 다음과 같습니다.
| VARIABLE | COLOR |
|---|---|
| BLACK | BLACK |
| RED | RED |
| GREEN | GREEN |
| YELLOW | YELLOW |
| BLUE | BLUE |
| MAGENTA | MAGENTA |
| CYAN | CYAN |
| WHITE | WHITE |
글자의 밝기를 바꾸고자 할 때는 Style을 이용하고 print가 끝나면 autoreset에 의해서 색상은 복원됩니다.
import colorama
colorama.init(autoreset=True)
print(f"Hello, {colorama.Style.DIM}World")
print("Hello, World")
중간에 강제로 밝기를 복원할 필요가 있을 경우 RESET_ALL을 사용합니다.
import colorama
colorama.init(autoreset=True)
print(f"{colorama.Style.DIM}Hello, {colorama.Style.RESET_ALL}World")
사용 가능한 밝기는 다음과 같습니다.
| VARIABLE | COLOR |
|---|---|
| DIM | DIM |
| NORMAL | NORMAL |
| BRIGHT | BRIGHT |