Gtk2::Gdk::Color(3)
π Gtk2::Gdk::Color π
okay bestie, welcome to Gtk2::Gdk::Color β it's a wrapper for GdkColor, and honestly? it's giving "tiny module, big feelings". let's get into it π«Ά
β¨ NAME β¨
Gtk2::Gdk::Color β literally just a wrapper for GdkColor. that's the whole name. iconic.
π DESCRIPTION π
so here's the tea: Gdk's colors are 16-bit RGB values. meaning the red, green, and blue components are integer values from 0 to 65535, and 65535 means full saturation. π
and if you're out here living that 0 to 255 life (which, same, most of us are), you just scale those numbers by a factor of 257. yes. 257. not 256. i know. i KNOW. but it's 257, bestie. no cap. π
π¦ HIERARCHY π¦
Glib::Boxed
+----Gtk2::Gdk::Color
so it's a Glib::Boxed and then boom, Gtk2::Gdk::Color right underneath. family tree slay. πΈ
π METHODS π
π« color = Gtk2::Gdk::Color->new ($red, $green, $blue, $pixel=0)
the constructor!! make yourself a whole brand new color, bestie. here's what you feed it:
$red(unsigned)$green(unsigned)$blue(unsigned)$pixel(unsigned) β and look, it defaults to0, cute
π unsigned = $color->blue
hands you back the blue component as an unsigned. that's it. that's the method. π«Ά
β boolean = $colora->equal ($colorb)
does color A equal color B?? a vibe check, basically. it takes:
$colorb(Gtk2::Gdk::Color)
and returns a boolean, so true or false, no in-between. periodt. π
π unsigned = $color->green
same energy as blue but make it green. returns the green component, unsigned. πΏ
π₯ integer = $colora->hash
gives you an integer hash for the color. hash it out, bestie.
π§ color = Gtk2::Gdk::Color->parse ($spec)
parse a color out of a spec string. it takes:
$spec(string)
and returns you a shiny color object. main character behavior fr fr. β¨
π unsigned = $color->pixel
returns the pixel value, unsigned. short, sweet, iconic.
π unsigned = $color->red
the red component, unsigned. hot girl summer red. π
π¦ string = $color->to_string
turns your color into a string, obviously. and check this:
Since: gtk+ 2.12
so if you're on something older than that, this one's not for you, sorry bestie. π
πΈ SEE ALSO πΈ
- Gtk2
- Glib::Boxed
go read those too, i'm not gonna gatekeep. π
π COPYRIGHT π
Copyright (C) 2003-2011 by the gtk2-perl team.
This software is licensed under the LGPL. See Gtk2 for a full notice.
and that's the whole page, bestie!! this was documented for perl v5.42.0 back on 2025-07-25, and honestly it ate. π
β¨ go forth and scale your colors by 257. i believe in you. π«Άπ
π¦ where this page comes from
- fedora 43: perl-Gtk2 1.24993-23.fc43 Β· LicenseRef-Callaway-LGPLv2+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms