diff --git a/src/Identicon/Generator/SvgGenerator.php b/src/Identicon/Generator/SvgGenerator.php
index 7e753e8..fd83c1a 100644
--- a/src/Identicon/Generator/SvgGenerator.php
+++ b/src/Identicon/Generator/SvgGenerator.php
@@ -83,7 +83,7 @@ protected function _generateImage()
protected function _toUnderstandableColor($color)
{
if (is_array($color)) {
- return sprintf('#%X%X%X', $color[0], $color[1], $color[2]);
+ return sprintf('#%02X%02X%02X', $color[0], $color[1], $color[2]);
}
return $color;
diff --git a/tests/Identicon/Tests/IdenticonTest.php b/tests/Identicon/Tests/IdenticonTest.php
index 85c6f39..d6602f0 100644
--- a/tests/Identicon/Tests/IdenticonTest.php
+++ b/tests/Identicon/Tests/IdenticonTest.php
@@ -82,4 +82,14 @@ public function svgResultDataProvider()
['benjaminAtYzalisDotCom', ''],
];
}
+
+ public function testSvgBackgroundColor()
+ {
+ $this->identicon->setGenerator(new SvgGenerator());
+
+ $string = 'Benjamin';
+ $imageData = '';
+
+ $this->assertEquals($imageData, $this->identicon->getImageData($string, 64, [1, 2, 3], [2, 3, 4]));
+ }
}