Graph::colour(3)

πŸ’… NAME πŸ’…

GD::Graph::colour β€” colour manipulation routines for use with GD::Graph. yes bestie, it's literally the colour department ✨

πŸŽ€ SYNOPSIS πŸŽ€

use GD::Graph::colour qw(:colours :lists :files :convert);

that one line? iconic. imports everything you need in one go 🫢

🌈 DESCRIPTION 🌈

okay so the GD::Graph::colour package hands you a few routines for working with colours. and the way its functionality is defined? mostly by whatever the GD::Graph modules needed, both now and historically. no cap β€” it's a "built to serve the graphs" situation πŸ’…


✨ FUNCTIONS ✨

🌸 colour_list( number of colours )

returns a list of number of colours colour names that the package knows about. yep, that's the whole vibe. exported with the :lists tag πŸŽ€

🌸 sorted_colour_list( number of colours )

same deal β€” returns a list of number of colours colour names known to the package, except sorted by luminance or hue. NB: right now it always sorts by luminance, fr fr. an option to decide the sorting method at run time will be added in a later stage. exported with the :lists tag ✨

🌸 _rgb( colour name )

returns a list of the RGB values of colour name. and here's the cute part β€” if colour name is a string of the form that's acceptable to the hex2rgb sub, then the colour gets added to the list dynamically πŸ”₯ exported with the :colours tag.

🌸 _hue( R,G,B )

returns the hue of the colour with the specified RGB values. exported with the :colours tag πŸ¦‹

🌸 _luminance( R,G,B )

returns the luminance of the colour with the specified RGB values. exported with the :colours tag 🌟

🌸 add_colour(colourname => [$r, $g, $b]) or add_colour('#7fe310')

self-explanatory, bestie πŸ’… exported with the :colours tag.

🌸 rgb2hex($red, $green, $blue) and hex2rgb('#7fe310')

these functions translate a list of RGB values into a hexadecimal string β€” the kind commonly used in HTML and the Image::Magick API β€” and vice versa. both directions, we love a two-way street 🫢 exported with the :convert tag.

🌸 read_rgb( file name )

reads in colours from an rgb file as used by the X11 system.

doing something like:

use GD::Graph::bars;
use GD::Graph::colour;

GD::Graph::colour::read_rgb("rgb.txt") or die "cannot read colours";

will allow you to use any colours defined in rgb.txt in your graph. main character move tbh πŸ‘‘ exported with the :files tag.


🎨 PREDEFINED COLOUR NAMES 🎨

the whole roster, in order, no skips:

white, lgray, gray, dgray, black, lblue, blue, dblue, gold, lyellow, yellow, dyellow, lgreen, green, dgreen, lred, red, dred, lpurple, purple, dpurple, lorange, orange, pink, dpink, marine, cyan, lbrown, dbrown.

that's 29 little icons and they all ate πŸ’–


πŸ‘‘ AUTHOR πŸ‘‘

Martien Verbruggen <mgjv@tradingpost.com.au>

GIFgraph: Copyright (c) 1995-1999 Martien Verbruggen. Chart::PNGgraph: Copyright (c) 1999 Steve Bonds. GD::Graph: Copyright (c) 1999 Martien Verbruggen.

all rights reserved. this package is free software; you can redistribute it and/or modify it under the same terms as Perl itself 🌸


πŸ” SEE ALSO πŸ”

GD::Graph, GD::Graph::FAQ

go read those too, iykyk πŸ’œ


okay that's the whole page, and yes it was giving documentation excellence the entire time 😭 this was perl v5.42.0, dated 2024-03-22 β€” remember it fondly bestie, mwah πŸ’‹

πŸ“¦ where this page comes from