diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 8e52cd1..18395a5 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -41,6 +41,7 @@ class Configuration implements ConfigurationInterface ->scalarNode('distortion')->defaultValue(true)->end() ->scalarNode('max_front_lines')->defaultValue(null)->end() ->scalarNode('max_behind_lines')->defaultValue(null)->end() + ->arrayNode('backgroundColor')->prototype('scalar')->end() ->end() ; diff --git a/Generator/CaptchaGenerator.php b/Generator/CaptchaGenerator.php index 68256b9..900b756 100644 --- a/Generator/CaptchaGenerator.php +++ b/Generator/CaptchaGenerator.php @@ -98,6 +98,15 @@ class CaptchaGenerator $this->builder->setMaxFrontLines($options['max_front_lines']); $this->builder->setMaxBehindLines($options['max_behind_lines']); + if ($options['backgroundColor'] != array()) { + if (count($options['backgroundColor'])!=3) { + throw new \RuntimeException('backgroundColor should be an array of r, g and b'); + } + + $color = $options['backgroundColor']; + $this->builder->setBackgroundColor($color[0], $color[1], $color[2]); + } + $fingerprint = isset($options['fingerprint']) ? $options['fingerprint'] : null; $content = $this->builder->build( diff --git a/composer.json b/composer.json index 9fa731f..2e2b0ce 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ ], "require": { "php": ">=5.3.0", - "gregwar/captcha": "v1.0.2" + "gregwar/captcha": "v1.0.3" }, "autoload": { "psr-0": {