1

I'm working on a little side project console-based python script. I'm using a module called rich to add colours but i was wondering if you could also set the background colour as well.

I know the color command exists but it's very limited. Any help would be appreciated!

Spooky
  • 81
  • 1
  • 6
  • This probably has already been answered, try this link https://stackoverflow.com/questions/62932477/set-different-background-color-using-rich – Aiden Hanney Sep 04 '22 at 23:24

1 Answers1

1

This will change the background to yellow on supported consoles:

print("\033]11;#ffff00\007")

The pattern is: "\033]11;#rrggbb\007", where rr, gg and bb are the red, green and blue values in hexadecimal ranging from 0x00 to 0xFF.

AndresR
  • 596
  • 3
  • 17