Chart:...locator(3pm)
๐ NAME ๐
Chart::Clicker::Drawing::ColorAllocator โ it's a color picker, bestie. That's it, that's the whole vibe. (This is one of the user-contributed Perl docs, so you already know it's gonna be a little quirky. ๐)
โจ VERSION โจ
version 2.90 โ yes she's been around a while and yes she still ate. ๐
๐ SYNOPSIS ๐
Okay so here's the whole situation, no cap:
use Graphics::Color::RGB;
use Chart::Clicker::Drawing::ColorAllocator;
my $ca = Chart::Clicker::Drawing::ColorAllocator->new({
colors => [
Graphics::Color::RGB->new(
red => 1.0, green => 0, blue => 0, alpha => 1.0
),
#...
]
});
my $red = $ca->get(0);
#or let Chart::Clicker autmatically pick complementing colors for you
my $ca2 = Chart::Clicker::Drawing::ColorAllocator->new({
seed_hue => 0, #red
});
Like โ you can hand her your own little palette of colors, OR you can just say "girl, you pick" and let Chart::Clicker do the choosing for you. Main character energy either way. ๐ฆ
๐ธ DESCRIPTION ๐ธ
She allocates colors for use in the chart. The position in the color allocator corresponds to the series that will be colored โ so like, slot 0 colors series 0, slot 1 colors series 1, and so on. It's giving matchmaker but for your data series. ๐ฅ
๐ซ AUTOMATIC COLOR ALLOCATION ๐ซ
Not me being obsessed with this feature. This module has the capacity to automatically allocate 96 individual colors using Color::Scheme. Periodt. ๐
Here's how she does it: she picks 4 hues equally spaced in the color wheel from the "seed_hue" โ so if you seed with 0 (red), that gets complimented by 270 (blue), 180 (green) and 90 (yellow). Cute, right? Then after those colors are allocated, she moves on to picking from the colors between those, i.e. 45, 135, 215, 305, etc. Once all values of "hues" have been utilized, she repeats them using a different shade. ๐
The whole effect is that she's generating evenly spaced complementing colors, so your colors stay well ditinguishable from one another and have appropriate contrast. She will never let your chart look a mess. ๐
๐ position
Gets the current position. Simple as that. (Where are we in the color lineup, bestie?)
๐ ATTRIBUTES ๐
๐จ colors
An arrayref of colors that will be used for series that Clicker draws. This is your custom palette โ hand her the crayons and she'll use them.
๐งต color_scheme
A lazy-building Color::Scheme object used to generate the color scheme of the chart. Lazy as in she only builds it when she actually needs it โ efficient queen. ๐
๐ก๏ธ seed_hue
The interger value of the first hue used when computing the tetrade color scheme. Setting this will affect the hue of the first color allocated. Subsequent colors will be allocated based on their distance from this color, to maintain sifficient contrast between colors. If you don't specify it, the seed_hue will default to 270, blue. ๐ So like, if you don't pick, she's picking blue for you. Respect.
๐ฆ hues
An array reference of evenly spaced seed hues for color allocation. By default it will use the seed hue plus 0, 45, 75, 15, 60 and 30 โ which is enough to cover all web-safe colors when using a tetrade color scheme. Yeah she did the math so you don't have to. ๐งฎโจ
๐ shade_order
An array reference of the order in which the different shades of each color will be used for every color scheme generated. It defaults to 1, 3, 0, 2 for optimum color spacing. Iconic ordering tbh.
๐ซถ METHODS ๐ซถ
โ add_to_colors
Add a color to this allocator. A little treat for her. ๐
๐งน clear_colors
Clear this allocator's colors. Boom, gone, empty, fresh start. โจ
๐ข color_count
Get the number of colors in this allocator. How many do we have, bestie?
๐ฏ get_color ($index)
Gets the color at the specified index. Returns undef if that position has no color. So yeah, no color there means you get undef, not a surprise, not a crash โ just undef. ๐
โก๏ธ next
Returns the next color. Each call to next increments the position, so subsequent calls will return different colors. She never gives you the same one twice in a row. Obsessed. ๐
๐งช allocate_color
Determines what the next color should be. The brains of the operation, fr fr.
๐ reset
Resets this allocator back to the beginning. Rewind time, back to square one, slay. โช
โ๏ธ AUTHOR โ๏ธ
Cory G Watson <gphat@cpan.org> โ thank you for your service, king. ๐
๐ COPYRIGHT AND LICENSE ๐
This software is copyright (c) 2016 by Cory G Watson.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Free software, free as in freedom, we love to see it. ๐
Go forth and color your charts, bestie. Your series deserve contrast and your eyes deserve nice things. ๐๐
perl v5.36.0 โ 2022-10-14 โ that's the version and the date this page was generated, mwah, bye! ๐ โจ๐ฆ
๐ฆ where this page comes from
- ubuntu noble: libchart-clicker-perl 2.90-3 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libchart-clicker-perl 2.90-3 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libchart-clicker-perl 2.90-3 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms