NAME Color::RGB::Util - Utilities related to RGB colors VERSION This document describes version 0.57 of Color::RGB::Util (from Perl distribution Color-RGB-Util), released on 2014-12-05. SYNOPSIS use Color::RGB::Util qw( mix_2_rgb_colors rand_rgb_color rgb2grayscale rgb2sepia reverse_rgb_color rgb_luminance ); say mix_2_rgb_colors('#ff0000', '#ffffff'); # pink (red + white) say mix_2_rgb_colors('ff0000', 'ffffff', 0.75); # pink with a whiter shade say rand_rgb_color(); say rand_rgb_color('000000', '333333'); # limit range say rgb2grayscale('0033CC'); # => 555555 say rgb2sepia('0033CC'); # => 4d4535 say reverse_rgb_color('0033CC'); # => ffcc33 say rgb_luminance('d090aa'); # => ffcc33 DESCRIPTION FUNCTIONS None are exported by default, but they are exportable. mix_2_rgb_colors($rgb1, $rgb2, $pct) => STR Mix 2 RGB colors. $pct is a number between 0 and 1, by default 0.5 (halfway), the closer to 1 the closer the resulting color to $rgb2. rand_rgb_color([$low_limit[, $high_limit]]) => STR Generate a random RGB color. You can specify the limit. Otherwise, they default to the full range (000000 to ffffff). rgb2grayscale($rgb) => RGB Convert $rgb to grayscale RGB value. rgb2sepia($rgb) => RGB Convert $rgb to sepia tone RGB value. reverse_rgb_color($rgb) => RGB Reverse $rgb. rgb_luminance($rgb) => NUM Calculate standard/objective luminance from RGB value using this formula: (0.2126*R) + (0.7152*G) + (0.0722*B) where R, G, and B range from 0 to 1. Return a number from 0 to 1. tint_rgb_color($rgb, $tint_rgb, $pct) => RGB Tint $rgb with $tint_rgb. $pct is by default 0.5. It is similar to mixing, but the less luminance the color is the less it is tinted with the tint color. This has the effect of black color still being black instead of becoming tinted. TODO mix_rgb_colors() to mix several RGB colors. Args might be $rgb1, $rgb2, ... or $rgb1, $part1, $rgb2, $part2, ... (e.g. 'ffffff', 1, 'ff0000', 1, '00ff00', 2). SEE ALSO Color::ANSI::Util HOMEPAGE Please visit the project's homepage at . SOURCE Source repository is at . BUGS Please report any bugs or feature requests on the bugtracker website When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. AUTHOR perlancar COPYRIGHT AND LICENSE This software is copyright (c) 2014 by perlancar@cpan.org. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.