From 898f0a2ca502415dc3088f185029e757ba085c65 Mon Sep 17 00:00:00 2001 From: davidleston Date: Wed, 12 Jul 2017 17:15:13 -0700 Subject: [PATCH] Closes svg/svgo#759. Upper case hex color now converts to shortname. --- plugins/convertColors.js | 7 +++++-- test/plugins/convertColors.03.svg | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/convertColors.js b/plugins/convertColors.js index b856e1309..77279e942 100644 --- a/plugins/convertColors.js +++ b/plugins/convertColors.js @@ -95,8 +95,11 @@ exports.fn = function(item, params) { } // Convert hex to short name - if (params.shortname && val in collections.colorsShortNames) { - val = collections.colorsShortNames[val]; + if (params.shortname) { + var lowerVal = val.toLowerCase(); + if (lowerVal in collections.colorsShortNames) { + val = collections.colorsShortNames[lowerVal]; + } } attr.value = val; diff --git a/test/plugins/convertColors.03.svg b/test/plugins/convertColors.03.svg index 330851568..a90cbe6df 100644 --- a/test/plugins/convertColors.03.svg +++ b/test/plugins/convertColors.03.svg @@ -1,5 +1,5 @@ - + @@@