gus
gus

Reputation: 103

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 ?

Upvotes: 0

Views: 89

Answers (2)

jasonharper
jasonharper

Reputation: 9587

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()

Upvotes: 2

Adrien Leravat
Adrien Leravat

Reputation: 2789

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", i.e. a special sequence of characters that will be interpreted as coloration.

See: Print in terminal with colors using Python?

Upvotes: 0

Related Questions