Gtk2::Gdk::Color(3)

πŸ“¦
version 1.24993 Β· 2 versions
, in fedora 43

πŸ’– 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 to 0, 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 (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