View Full Version : Colors
Vinicius Lima
07-31-2007, 01:10 PM
Hi,
I was working with Vizard and I tried to change the color of some objects throught the script but I am not sure how to name some colors. Is there any link where I could find the way Vizard labels hues?
Thanks,
Vinicius
farshizzo
07-31-2007, 01:56 PM
Hi,
Vizard uses RGB to specify color values. Each component is specified with a value between 0 and 1. Here is a link to the Wikipedia page on RGB:
http://en.wikipedia.org/wiki/RGB
Vinicius Lima
07-31-2007, 01:58 PM
Thanks, I've figured that out already. My problem is that sometimes colors have names like SKYBLUE and I don't know how exactly the other RGB colors are called.
farshizzo
07-31-2007, 02:31 PM
Hi,
Vizard defines some common color values. Here are the names and values:WHITE = (1,1,1)
BLACK = (0,0,0)
GRAY = (0.5,0.5,0.5)
RED = (1,0,0)
GREEN = (0,1,0)
BLUE = (0,0,1)
YELLOW = (1,1,0)
ORANGE = (1,0.5,0)
PURPLE = (0.5,0,0.5)
SKYBLUE = (0.5,0.5,1)If you need another color then you will need to define it yourself.
Vinicius Lima
07-31-2007, 03:17 PM
Thanks!
Vinicius
tianmoran
01-21-2017, 06:37 AM
Hi, I have a further question. How do I map a color in Vizard, like (0.5,0.5,0.5) gray, to a color represented by 8-bit? Is it (128,128,128) in the example?
Yes, the following code will apply that color to a box:
import viz
import vizact
viz.go()
import vizshape
box = vizshape.addBox(pos=[0,1.8,4])
vizact.onkeydown(' ',box.color,[0.5,0.5,0.5])
You can press Alt + 1 in the Vizard editor to display a color dialog that inserts RGB values in the script for you.
tianmoran
01-25-2017, 10:58 AM
That's very helpful. Thanks!
vBulletin® v3.8.7, Copyright ©2000-2024, vBulletin Solutions, Inc.