Skip Menu |

This queue is for tickets about the Convert-Color-Library CPAN distribution.

Report information
The Basics
Id: 100404
Status: resolved
Priority: 0/
Queue: Convert-Color-Library

People
Owner: Nobody in particular
Requestors: leonerd-cpan [...] leonerd.org.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.04
Fixed in: 0.05



Subject: Wrong 'fuchsia' is picked for #FF00FF
$ perl -MConvert::Color -E 'say Convert::Color->new( "rgb:1,0,1" )->as_html->name' fuscia This isn't the actual name of the colour in the HTML spec, and many browsers won't understand it, converting it instead to #f00c0a which will come out looking red. -- Paul Evans
Fixed by ignoring the misspelled version. -- Paul Evans
Subject: rt100404.patch
=== modified file 'lib/Convert/Color/HTML.pm' --- lib/Convert/Color/HTML.pm 2014-11-13 19:16:18 +0000 +++ lib/Convert/Color/HTML.pm 2014-11-17 14:50:35 +0000 @@ -100,8 +100,10 @@ unless( keys %palette ) { %palette = map { my $color = $class->new( $_ ); - $color->hex => $color - } Color::Library::Dictionary::HTML->color_names; + $color->hex => $color + } + # RT100404 - omit the misspelled 'fuscia' + grep { $_ ne "fuscia" } Color::Library::Dictionary::HTML->color_names; } return $palette{$hex} || $class->new( "#$hex" ); === added file 't/90rt100404.t' --- t/90rt100404.t 1970-01-01 00:00:00 +0000 +++ t/90rt100404.t 2014-11-17 14:50:35 +0000 @@ -0,0 +1,14 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; + +use Convert::Color; +use Convert::Color::Library; + +is( Convert::Color->new( 'rgb:1,0,1' )->as_html->name, "fuchsia", + 'fuchsia is correctly spelled' ); + +done_testing;
Released as 0.05 -- Paul Evans