Re: [Vala] GtkColorsButton

On 09/02/2012 08:32 PM, Satyajit Sahoo wrote:
I'm trying to make a small GUI with vala and GTK3 to configure colors of a
GTK theme. I'm quite new to vala and GTK. I didn't get any samples about a
color chooser. But finally I could make it with a ColorButton. Bit there
are still problems.

It shows deprecated function warnings when compiling.

I don't get any. Maybe if you share the exact compiler output you're
getting somebody can shed some light on this.

And also I need to have the color in HEX code, while it returns color in
RGBA. Can anyone suggest what I'm supposed to do?

It's not hard to generate this yourself if you understand what the hex
code is. I assume you're looking for the HTML representation, which is a
textual representation of a 24-bit red/green/blue colour value (one byte
per colour channel), of the format "#RRGGBB", where "RR" is the
two-digit hexadecimal representation of the red colour byte value.
Likewise for green and blue.
String representations of numbers in hexadecimal base are easily
generated using the printf family of functions/methods, for example:

int i = 17;
string s = "%02x".printf(i);
assert ( s == "1a" );

I think you'll manage to piece together a solution now. Anything I said
that you didn't understand should be easy enough to look up on the web.

The code is here -

Sorry for inconvenience. I'm really a noob and cannot find any
documentation about this.

Vala documentation can be sketchy.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]