Re: Scintilla Colours

From: Date: Thu, 30 Jan 2003 04:12:56 +0000
Subject: Re: Scintilla Colours
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-2990@lists.php.net to get a copy of this message
Yeah, I went there too. Basically at the point of collection the 'amount of redness/greenness/blueness' comes back expressed as a float/double/percentage (whichever you love best). So from an elderly colourwheel: if($cs->get_color() !== array(1.0, 1.0, 1.0, 1.0)) { $newcolourparts = $cs->get_color(); $part1 = $newcolourparts[0]; echo $part1."\n"; $rr = dechex ($part1*255); echo $rr."\n"; $part2 = $newcolourparts[1]; $gg = dechex ($part2*255); $part3 = $newcolourparts[2]; $bb = dechex ($part3*255); } - where the entire hex colour value is #f5ff5e, this prints: 0.96205214893657 f5 with the 'missing link' being the decimal 255 * 0.96205214893657 (245.32329797882535, which probably comes close to the kind of value you're looking for) hth, I know it's a mucky subject .. ----- Original Message ----- From: "Aaron Bishell" <aragorn@gamer.net.nz> To: <php-gtk-general@lists.php.net> Sent: Thursday, January 30, 2003 2:55 AM Subject: [PHP-GTK] Scintilla Colours > Using methods such as "set_sel_fore" on a scintilla widget demands that > the second argument be an integer representing the colour. > > I went to the scintilla homepage here: > http://www.scintilla.org/ScintillaDoc.html#colour > > And it says: > > Colours are set using the RGB format (Red, Green, Blue). The intensity of > each colour is set in the range 0 to 255. If you have three such > intensities, they are combined as: red | (green << 8) | (blue << 16). > > I know the << operator is a binary shift operator but I don't know exactly > how it works in terms of decimal numbers. > > Basically id like an example of how to convert three RGB numbers (e.g. > R:10, G:36, B:106) to this integer equivalent. I had a look through > PHPmole and all the settings are in the integer form so not much help. > > Any help appreciated. > > > -- > PHP-GTK General Mailing List (http://gtk.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.gtk.general (#2990) next »