飞行铁砧/徽章生成器

它以.svg格式生成徽章

1.0.3 2019-10-10 12:32 UTC

This package is not auto-updated.

Last update: 2024-09-20 13:32:55 UTC


README

生成徽章的工具,如

coverage php-version

如何使用

可执行脚本

运行generate.php脚本以生成徽章。

它接受一些参数来自定义结果

shortlongdescriptiondefault
ooutput要写入的文件stdout
lleft指定左侧文本
rright指定右侧文本
gno-gradient无值,移除徽章中的渐变省略
pno-percentage-coloring无值,禁用基于右侧文本的自动着色省略
radius边缘半径5.0
left-text-color左侧文本颜色eeeeee
right-text-color右侧文本颜色eeeeee
left-background-color左侧段的背景颜色555555
right-background-color右侧段的背景颜色4B3D6C
low-percent-color使用自动着色时0%的右侧背景颜色B31329
mid-percent-color使用自动着色时50%的右侧背景颜色CDAB58
hight-percent-color使用自动着色时100%的右侧背景颜色2AC258

使用生成器

创建一个生成器并向其提供一些选项

<?php

require_once __DIR__ . '/../vendor/autoload.php';

$badgeOptions = \FlyingAnvil\BadgeGenerator\Application\DataObject\BadgeOptions::create('left', 'right');
$badgeOptions->setLeftText('direction');
$badgeOptions->setRadius(3);
$badgeOptions->setLeftBackgroundColor(\FlyingAnvil\BadgeGenerator\Application\DataObject\Color::createFromHex('00cc00'));

$badgeGenerator = new \FlyingAnvil\BadgeGenerator\Application\Service\Generator();
$badge          = $badgeGenerator->generate($badgeOptions);

echo $badge;