You can use the ctypes
module in Python to color text in Windows 10 cmd. Here is an example code snippet that demonstrates how to print colored text in the command prompt:
main.py738 chars28 lines
In this code snippet, we define different colors using hexadecimal values and then use the SetConsoleTextAttribute
function from kernel32
DLL to set the text color. Don't forget to reset the color after you're done with colored text to avoid applying colors to subsequent text.
gistlibby LogSnag