e-monsite / color-twig-extension
Manipulate colors with twig
Installs: 25 805
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^7.3|^8.0
- marcovo/shade-blend-convert: ^1.0
- mikealmond/color: ^0.1.3
- twig/twig: ^2.12|^3.0
Requires (Dev)
- phpunit/phpunit: ^8.4
README
install
composer require e-monsite/color-twig-extension
Then add the bundle to yours bundles if you are on Symfony:
// config/bundles.php return [ Emonsite\ColorTwigExtension\ColorExtensionBundle::class => ['all' => true], ];
Usage
There is some examples:
{{ 'rgb(138, 7, 7)' | darken(20) }} {{ '#8a0707' | lighten(40) }} {{ 'green' | alpha(0.5) }} {% if myColor is dark %} ... {% endif %} {% if myColor2 is light %} ... {% endif %}