wiki-grav/plugins/shortcode-core/classes/shortcodes/ColorShortcode.php
2023-06-02 08:07:58 +02:00

16 lines
441 B
PHP

<?php
namespace Grav\Plugin\Shortcodes;
use Thunder\Shortcode\Shortcode\ShortcodeInterface;
class ColorShortcode extends Shortcode
{
public function init()
{
$this->shortcode->getHandlers()->add('color', function(ShortcodeInterface $sc) {
$color = $sc->getParameter('color', $this->getBbCode($sc));
return '<span style="color: ' . $color . ';">' . $sc->getContent() . '</span>';
});
}
}