Gtk2::ColorButton(3)

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

πŸ’– NAME πŸ’–

Gtk2::ColorButton β€” bestie, it's literally just a wrapper for GtkColorButton. That's it, that's the whole vibe. She's a button, you click her, she lets you pick a color. Iconic behavior tbh. 🎨✨

(Oh and for the record, this whole thing lives in the User Contributed Perl Documentation section of the manual, in case you were wondering where you found her.)


πŸ¦‹ HIERARCHY πŸ¦‹

The family tree, and yes she comes from a long line of distinguished ancestors, it's giving generational wealth:

Glib::Object
+----Glib::InitiallyUnowned
     +----Gtk2::Object
          +----Gtk2::Widget
               +----Gtk2::Container
                    +----Gtk2::Bin
                         +----Gtk2::Button
                              +----Gtk2::ColorButton

No cap, she is a Gtk2::Button at heart. Just a button with range. πŸ’…


✨ INTERFACES ✨

She's got her certifications, her little badges, her extracurriculars:

  • Glib::Object::_Unregistered::AtkImplementorIface
  • Gtk2::Buildable
  • Gtk2::Activatable

🌸 METHODS 🌸

Okay so this is the part you actually came here for. Sit down, hydrate, let's go. πŸ“

πŸŽ€ Constructors πŸŽ€

  • widget = Gtk2::ColorButton->new ($color=undef) β€” makes you a fresh color button. Takes an optional:
    • $color β€” a Gtk2::Gdk::Color. Leave it out and it's undef, nbd.
  • widget = Gtk2::ColorButton->new_with_color ($color=undef) β€” same energy, but like, with color. Also takes:
    • $color β€” a Gtk2::Gdk::Color. Defaults to undef.

🧚 Alpha stuff 🧚

  • unsigned = $color_button->get_alpha β€” tells you the current alpha value. Unsigned, so don't come at her with negative numbers.
  • $color_button->set_alpha ($alpha) β€” sets the alpha. Takes:
    • $alpha β€” an unsigned.

πŸ’œ Color stuff πŸ’œ

  • color = $color_button->get_color β€” hands you back the color. A whole Gtk2::Gdk::Color. Slay.
  • $color_button->set_color ($color) β€” sets the color. Takes:
    • $color β€” a Gtk2::Gdk::Color.

🌈 Title stuff 🌈

  • string = $color_button->get_title β€” the title of the color selection dialog, but as a string, obvs.
  • $color_button->set_title ($title) β€” renames the dialog. Takes:
    • $title β€” a string.

πŸ‘‘ Use-alpha stuff πŸ‘‘

  • boolean = $color_button->get_use_alpha β€” is alpha even on? Returns a boolean, so true or false, pick a lane.
  • $color_button->set_use_alpha ($use_alpha) β€” toggles alpha usage. Takes:
    • $use_alpha β€” a boolean.

πŸ’… PROPERTIES πŸ’…

The ✨aesthetic✨ configuration, with all the flags she comes with:

  • 'alpha' (Glib::UInt : default 65535 : readable / writable / private / static-nick / static-blurb) β€” The selected opacity value (0 fully transparent, 65535 fully opaque)
  • 'color' (Gtk2::Gdk::Color : default undef : readable / writable / private / static-nick / static-blurb) β€” The selected color
  • 'title' (string : default "Pick a Color" : readable / writable / private / static-nick / static-blurb) β€” The title of the color selection dialog
  • 'use-alpha' (boolean : default false : readable / writable / private / static-nick / static-blurb) β€” Whether or not to give the color an alpha value

πŸ”₯ SIGNALS πŸ”₯

  • color-set (Gtk2::ColorButton)

That's the one. When the color gets set, she tells you. Main character energy fr fr. πŸ“£


πŸ‘€ SEE ALSO πŸ‘€

The whole friend group, go say hi:

Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget, Gtk2::Container, Gtk2::Bin, Gtk2::Button


Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL. See Gtk2 for a full notice.


okay bestie that's the whole page, you're officially educated πŸ’– This was documented with perl v5.42.0, dated 2025-07-25, and yeah β€” Gtk2::ColorButton(3), that's her full name, put some respect on it. 🫢 Go pick a cute color, you've earned it. 🎨✨🌸

πŸ“¦ where this page comes from