python: console make text color/bold


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  1. def color(t, c):
  2. return chr(0x1b)+"["+str(c)+"m"+t+chr(0x1b)+"[0m"
  3. def black(t):
  4. return color(t, 30)
  5. def red(t):
  6. return color(t, 31)
  7. def green(t):
  8. return color(t, 32)
  9. def yellow(t):
  10. return color(t, 33)
  11. def blue(t):
  12. return color(t, 34)
  13. def mangenta(t):
  14. return color(t, 35)
  15. def cyan(t):
  16. return color(t, 36)
  17. def white(t):
  18. return color(t, 37)
  19. def bold(t):
  20. return color(t, 1)

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.