it-blaster / color-picker-type-bundle
The FormType for choosing a color
Installs: 29 527
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 8
Forks: 0
Open Issues: 1
Requires
- php: >=5.3.2
- symfony/framework-bundle: ~2.1
This package is not auto-updated.
Last update: 2024-11-09 17:40:32 UTC
README
The FormType for choosing a color based on Iris.
Installation
Add it-blaster/color-picker-type-bundle to your composer.json
file and run composer
... "require": { "it-blaster/color-picker-type-bundle": "1.0.*" } ...
Register the bundle in your AppKernel.php
... new Fenrizbes\ColorPickerTypeBundle\FenrizbesColorPickerTypeBundle(), ...
Include bundle's scripts and Iris' dependencies in your page:
... <script src="path/to/jquery.js"></script> <script src="path/to/jquery-ui.js"></script> <script src="{{ asset('bundles/fenrizbescolorpickertype/lib/js/iris.min.js') }}"></script> <script src="{{ asset('bundles/fenrizbescolorpickertype/js/color_picker_type.js') }}"></script> ...
Usage
Just set the color_picker
FormType for your field as follows:
... ->add('color', 'color_picker') ...
Options
You can pass all the Iris' options as a picker_options
value:
... ->add('color', 'color_picker', array( 'picker_options' => array( 'color' => false, 'mode' => 'hsl', 'hide' => true, 'border' => true, 'target' => false, 'width' => 200, 'palettes' => false, 'controls' => array( 'horiz' => 's', 'vert' => 'l', 'strip' => 'h' ) ) )) ...