简体   繁体   中英

python visualize 1 RGB pixel

I have a RGB color with the following specifications: R = 62, B = 120, G = 70

Is there a way in Python to generate one pixel of this specific RGB color in order to be able to see what the color looks like ?

One pixel doesn't seem like it would be visible enough. How about a small window full of the color?

color = (62, 70, 120)
from Tkinter import Tk    # lower case T if you're using Python 3.x
root = Tk()
root['bg'] = "#%02x%02x%02x" % color
root.mainloop()

Assuming your talking about a console application, that's possible on linux based OS. You would basically instruct the shell to "Add some color", using what's called "ANSI escape sequences", ie a special sequence of characters that will be interpreted as coloration.

See: Print in terminal with colors using Python?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM