Hello pra,
Welcome to the Monastery. What about Term::ANSIColor/Function Interface/colorvalid, sample of code bellow:
#!/usr/bin/perl use strict; use warnings; use feature 'say'; use Term::ANSIColor qw(colorvalid); use Term::ANSIScreen qw/:color :constants/; my $valid = colorvalid ('magenta'); say "Color string is ", $valid ? "valid" : "invalid"; say MAGENTA . "Magenta" . RESET; __END__ $ perl test.pl Color string is valid Magenta
Hope this helps, BR.
In reply to Re: Best way to validate a string as a color?
by thanos1983
in thread Best way to validate a string as a color?
by pra
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |