Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (2) </ [1] 2 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Colors in Flua?, welcoming any color-related input< Next Oldest | Next Newest >
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Jan. 10 2006,03:24 QUOTE

I don't understand the way colors are used in flua.  I can set one of 16 colors with a number, and most of those can also be set with Color.<colorname>.  But flua has support for many more colors than those 16, and i'm finding it difficult to use them with what i'm getting from the documentation.  Even the input.lua script provided in the flua package uses a color picker, but i'm having trouble understanding what it's doing.

Does anyone here have experience with using colors in flua, or can understand the docs well enough to explain the syntax to me?

Thanks for your time.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: Jan. 10 2006,06:35 QUOTE

Not sure of your question.
I am using the color chooser in my wallpaper.lua to select solid color backgrounds for dsl v2.2. The color choose is pretty easy to use, give it a starting color in decimal for R G B and it will return a new decimal value choosen. Then I convert to hex for xsri. For example the jwm default background that I chose was #336699 so I load up color_chooser with rgb set to 51,102,153 and then let the use choose from there what they would want. The result is a success flag and the three rgb values.

But maybe your question is on get_color and set_color? Those appear to be setting or extracting the rgb values for a color by name or number. Which you could then use by such name or number for the duration of your program.
Back to top
Profile PM WEB 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Jan. 10 2006,14:50 QUOTE

Yes, it is mostly get_color/set_color that i was messing with...it seems to be the only way to set specific rgb color instead of choosing one of the defaults from the 16-color palette (or using the color picker...i'm looking for a non-interactive way of setting arbitrary colors).  It appears that "color=Color.get_color(n,n,n)" works, but the integers needed do not seem to follow the pattern you'd find in rgb.txt: 0-255 for red, green, and blue respectively.  Also tried Color.gray_ramp(n), but can't get that to work either.

Specifically, this is the sort of thing I'm trying to accomplish.  Say I want my button label text to be equivalent to "orange1", so I try this:
label_color=Color.get_color(255,165,0)
..but it makes something like aquamarine instead.

Maybe i need to first define a color name using rgb values, and then set a color property by that name?


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Jan. 10 2006,16:05 QUOTE

Found one way to do it, after a lot of trial and error...

Instead of setting RGB within the widget properties, I use a number like usual, such as 5, which is magenta by default.  However, at the top of the file i set the color 5 to 255,165,0 to make it orange instead of magenta:
Code Sample
Color:set_color(5,255,165,0)

This also changes Color.magenta, so i assume the color names refer to the color numbers.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
clacker Offline





Group: Members
Posts: 570
Joined: June 2004
Posted: Jan. 10 2006,18:41 QUOTE

mikshaw, I use other numbers than the named ones and it still works.  I don't know how many entries I can make into the color table, but it looks like color numbers below 1001 work but funny things happen after 1024.  Here is my example (using your orange):
Code Sample
-- set up four colors
-- color table goes up to "small number" according to docs

temp = Color:set_color(17,255,165,0)
temp = Color:set_color(124,125,125,256)
temp = Color:set_color(254,25,25,125)
temp = Color:set_color(1001,25,125,125)

w = Window{320,200,"Test Window"}
w.color = 17

name = Input{76,10,210,25,"Name:"}
name.color = 124

myBox = Box{20,40,100,100}
myBox.color = 254
myBox.box = Boxtype.flat

myBox = Box{140,40,60,60}
myBox.color = 1001
myBox.box = Boxtype.flat

w:end_layout()
w:show()
Back to top
Profile PM 
7 replies since Jan. 10 2006,03:24 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (2) </ [1] 2 >/
reply to topic new topic new poll
Quick Reply: Colors in Flua?

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code