venca-x / latte-contrast-yiq
Plugin for Nette. Default usage is for Latte templates. From RGB color return contrast color black/white
dev-master
2018-01-05 11:15 UTC
Requires
- php: >= 5.3.7
- nette/nette: >=2.2.0
Requires (Dev)
- nette/tester: @dev
This package is auto-updated.
Last update: 2024-11-07 05:29:02 UTC
README
Plugin for Nette. Default usage is for Latte templates. From RGB color return contrast color black/white. Typical set contrast text color for dynamic color background.
Installation
- Add the bundle to your dependencies:
Install with composer:
composer require venca-x/latte-contrast-yiq:~0.2
// composer.json
{
// ...
"require": {
// ...
"venca-x/latte-contrast-yiq": "@dev",
}
}
-
Use Composer to download and install the bundle:
composer update
Configuration
BasePresenter.php
protected function beforeRender() { parent::beforeRender(); $this->template->addFilter('contrastYIQ', function ($text) { $contrastYIQ = new \ContrastYIQ(); return $contrastYIQ->getContrastYIQ($text); }); }
Usage
{$o->color|contrastYIQ}