Google Answers Logo
View Question
Q: Gnome::ZvtTerm set_color_scheme ( Answered 5 out of 5 stars,   0 Comments )
Subject: Gnome::ZvtTerm set_color_scheme
Category: Computers > Programming
Asked by: russ_man-ga
List Price: $5.00
Posted: 23 Jul 2002 12:12 PDT
Expires: 22 Aug 2002 12:12 PDT
Question ID: 44221
I'm using perl mod Gnome::ZvtTerm and want to change the defualt color
using $term->set_color_scheme($red, $green, $blue); The problem is no
matter how I plug-in the data I get this :\

need an array ref in set_color_scheme at line 518.

Can someone please show me a simple example to set the bg = black and
fg = white


Request for Question Clarification by studboy-ga on 23 Jul 2002 15:19 PDT
Hi Russ

Can you tell me how you plugged in the numbers?

Let me know if this works--thanks:

$red = [0x0000, 0xaaaa, 0x0000, 0xaaaa, 0x0000, 0xaaaa,
       0x0000, 0xaaaa, 0x5555, 0xffff, 0x5555, 0xffff,
       0x5555, 0xffff, 0x5555, 0xffff, 0xaaaa, 0x0];
$green = [0x0000, 0x0000, 0xaaaa, 0x5555, 0x0000, 0x0000,
         0xaaaa, 0xaaaa, 0x5555, 0x5555, 0xffff, 0xffff,
         0x5555, 0x5555, 0xffff, 0xffff, 0xaaaa, 0x0];
$blue = [0x0000, 0x0000, 0x0000, 0x0000, 0xaaaa, 0xaaaa,
        0xaaaa, 0xaaaa, 0x5555, 0x5555, 0x5555, 0x5555,
        0xffff, 0xffff, 0xffff, 0xffff, 0xaaaa, 0x0];
$term->set_color_scheme($red, $green, $blue);

Clarification of Question by russ_man-ga on 24 Jul 2002 08:29 PDT
Yes, that worked for me! Now I have some kind of realize() problem to
work out but I'm closer then ever before.

Clarification of Question by russ_man-ga on 24 Jul 2002 09:21 PDT
I don't mean to wast your time but could you please explain how this
sets the foreground = white and background = black. The reason is I
want the user to pick a color using the Gtk::ColorSelectionDialog and
I'm not sure how to do this yet.

Thanks for your time.


Request for Question Clarification by studboy-ga on 24 Jul 2002 09:51 PDT
Hi Russ

I will type up a formal answer for you by the end of the day.

Basically the (hex value) array in $red, $green, $blue form 3-tuples--
if you read it in this order:

($red[0], $green[0], $blue[0])
($red[1], $green[1], $blue[1])

you will get

(0, 0, 0),
           (43690, 0, 0),
           (0, 43690, 0),
           (43690, 21845, 0),
           (0, 0, 43690),
           (43690, 0, 43690),
           (0, 43690, 43690),
           (43690, 43690, 43690),
           (21845, 21845, 21845),
           (65535, 21845, 21845),
           (21845, 65535, 21845),
           (65535, 65535, 21845),
           (21845, 21845, 65535),
           (65535, 21845, 65535),
           (21845, 65535, 65535),
           (65535, 65535, 65535),
           (43690, 43690, 43690),
           (0, 0, 0)

Each of the 3-tuples specify a color component as defined 
in gnome-terminal.c
Subject: Re: Gnome::ZvtTerm set_color_scheme
Answered By: studboy-ga on 24 Jul 2002 14:53 PDT
Rated:5 out of 5 stars
Hi Russell

As previously mentioned in my clarification,

the arrays $red, $green, $blue defines the RGB color palletes in 3-tuples.

There are 18 elements [0 ... 17] in each array, for your purpose,
you're only concerned about the last two: elements 16 and 17.
Element 16 is the foreground and element 17 is the background.

So something like

           (65535, 65535, 65535), for element 16
           (0, 0, 0), for element 17
translates into white on black.

In the sample I posted I used 

           (43690, 43690, 43690), for element 16.

You can try different values to see what works best for your terminal.

Hope this helps!
russ_man-ga rated this answer:5 out of 5 stars
This was great answer to my question! Good response time too. I just
want to say thanks:)

There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  

Google Home - Answers FAQ - Terms of Service - Privacy Policy