Update badge generator

This commit is contained in:
antonkomarev
2020-07-29 16:33:48 +03:00
parent 82b03c19c3
commit f32bd24fa5
4 changed files with 31 additions and 26 deletions

View File

@@ -51,15 +51,16 @@ You can use any valid HEX color or pick from a predefined set of named colors (`
| color | demo |
| ----- | ---- |
| `brightgreen` | ![](https://img.shields.io/static/v1?label=Profile+views&message=1234567890&color=44cc11) |
| `green` | ![](https://img.shields.io/static/v1?label=Profile+views&message=1234567890&color=97ca00) |
| `yellow` | ![](https://img.shields.io/static/v1?label=Profile+views&message=1234567890&color=dfb317) |
| `yellowgreen` | ![](https://img.shields.io/static/v1?label=Profile+views&message=1234567890&color=a4a61d) |
| `orange` | ![](https://img.shields.io/static/v1?label=Profile+views&message=1234567890&color=fe7d37) |
| `red` | ![](https://img.shields.io/static/v1?label=Profile+views&message=1234567890&color=e05d44) |
| `blue` | ![](https://img.shields.io/static/v1?label=Profile+views&message=1234567890&color=007ec6) |
| `grey` | ![](https://img.shields.io/static/v1?label=Profile+views&message=1234567890&color=555555) |
| `lightgray` | ![](https://img.shields.io/static/v1?label=Profile+views&message=1234567890&color=9f9f9f) |
| `brightgreen` | ![](https://img.shields.io/static/v1?label=Profile+views&message=1234567890&color=brightgreen) |
| `green` | ![](https://img.shields.io/static/v1?label=Profile+views&message=1234567890&color=green) |
| `yellow` | ![](https://img.shields.io/static/v1?label=Profile+views&message=1234567890&color=yellow) |
| `yellowgreen` | ![](https://img.shields.io/static/v1?label=Profile+views&message=1234567890&color=yellowgreen) |
| `orange` | ![](https://img.shields.io/static/v1?label=Profile+views&message=1234567890&color=orange) |
| `red` | ![](https://img.shields.io/static/v1?label=Profile+views&message=1234567890&color=red) |
| `blue` | ![](https://img.shields.io/static/v1?label=Profile+views&message=1234567890&color=blue) |
| `grey` | ![](https://img.shields.io/static/v1?label=Profile+views&message=1234567890&color=grey) |
| `lightgrey` | ![](https://img.shields.io/static/v1?label=Profile+views&message=1234567890&color=lightgrey) |
| `blueviolet` | ![](https://img.shields.io/static/v1?label=Profile+views&message=1234567890&color=blueviolet) |
| `ff69b4` | ![](https://img.shields.io/static/v1?label=Profile+views&message=1234567890&color=ff69b4) |
**Named color**

View File

@@ -27,7 +27,7 @@
},
"require": {
"php": "^7.4",
"badges/poser": "^1.4",
"badges/poser": "^2.0",
"vlucas/phpdotenv": "^5.0",
"webmozart/assert": "^1.9"
},

29
composer.lock generated
View File

@@ -4,32 +4,35 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "268e668398fa52181cf35d8920a04ab9",
"content-hash": "737cdc30cb40061c9293cbe8a281a0b7",
"packages": [
{
"name": "badges/poser",
"version": "v1.4.1",
"version": "v2.0.0",
"source": {
"type": "git",
"url": "https://github.com/badges/poser.git",
"reference": "4281890cbd58e0ea29c6550c4a4aaa16a15b3ce0"
"reference": "72bcde7e3d7ae6886ba23c05626aad74cd933007"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/badges/poser/zipball/4281890cbd58e0ea29c6550c4a4aaa16a15b3ce0",
"reference": "4281890cbd58e0ea29c6550c4a4aaa16a15b3ce0",
"url": "https://api.github.com/repos/badges/poser/zipball/72bcde7e3d7ae6886ba23c05626aad74cd933007",
"reference": "72bcde7e3d7ae6886ba23c05626aad74cd933007",
"shasum": ""
},
"require": {
"ext-gd": "*",
"php": ">=5.3",
"symfony/console": "~2.0|~3.0|~4.0"
"ext-simplexml": "*",
"php": ">=7.4",
"symfony/console": "^4.0|^5.0"
},
"require-dev": {
"behat/behat": "^3.4",
"coduo/phpspec-data-provider-extension": "^1.0",
"friendsofphp/php-cs-fixer": "@stable",
"phpspec/phpspec": "^2.5"
"behat/behat": "^3.7",
"friends-of-phpspec/phpspec-code-coverage": "^4.3",
"friendsofphp/php-cs-fixer": "^2.16",
"moave/phpspec-data-provider-extension": "dev-master",
"phpspec/phpspec": "^6.1",
"vimeo/psalm": "^3.12"
},
"bin": [
"bin/poser"
@@ -37,7 +40,7 @@
"type": "lib",
"extra": {
"branch-alias": {
"dev-master": "1.4.x-dev"
"dev-master": "2.x-dev"
}
},
"autoload": {
@@ -71,7 +74,7 @@
"packagist",
"pin"
],
"time": "2020-06-11T16:17:31+00:00"
"time": "2020-07-29T10:39:06+00:00"
},
{
"name": "graham-campbell/result-type",

View File

@@ -13,10 +13,11 @@ declare(strict_types=1);
namespace Komarev\GitHubProfileViewsCounter;
use PUGX\Poser\Badge;
use PUGX\Poser\Poser;
use PUGX\Poser\Render\SvgFlatRender;
use PUGX\Poser\Render\SvgFlatSquareRender;
use PUGX\Poser\Render\SvgRender;
use PUGX\Poser\Render\SvgPlasticRender;
final class BadgeImageRendererService
{
@@ -25,7 +26,7 @@ final class BadgeImageRendererService
public function __construct()
{
$this->poser = new Poser([
new SvgRender(),
new SvgPlasticRender(),
new SvgFlatRender(),
new SvgFlatSquareRender(),
]);
@@ -52,6 +53,6 @@ final class BadgeImageRendererService
private function renderBadge(string $label, string $message, string $messageBackgroundFill, string $badgeStyle): string
{
return (string) $this->poser->generate($label, $message, $messageBackgroundFill, $badgeStyle);
return (string) $this->poser->generate($label, $message, $messageBackgroundFill, $badgeStyle, Badge::DEFAULT_FORMAT);
}
}