Angular Color Picker
This is a simple color picker based on the cool angular2-color-picker by Alberplz.
This documentation is for the latest 5/6.x.x version which requires Angular 5 or newer. For Angular 4 you need to use the latest 4.x.x version. Documentation for the 4.x.x can be found from here.
Quick links
Example application
|
StackBlitz example
Building the library
npm install
npm start
Running the example
cd example
npm install
npm start
Library development
npm link
cd example
npm link ngx-color-picker
Installing and usage
npm install ngx-color-picker --save
Load the module for your app:
import { ColorPickerModule } from 'ngx-color-picker';
@NgModule({
...
imports: [
...
ColorPickerModule
]
})
Use it in your HTML template:
<input [(colorPicker)]="color" [style.background]="color"/>
[colorPicker]
[cpWidth]
[cpHeight]
[cpToggle]
[cpDisabled]
[cpColorMode]
[cpOutputFormat]
[cpAlphaChannel]
[cpFallbackColor]
[cpPosition]
[cpPositionOffset]
[cpPositionRelativeToArrow]
[cpPresetLabel]
[cpPresetColors]
[cpDisableInput]
[cpDialogDisplay]
[cpIgnoredElements]
[cpSaveClickOutside]
[cpOKButton]
[cpOKButtonText]
[cpOKButtonClass]
[cpCancelButton]
[cpCancelButtonText]
[cpCancelButtonClass]
[cpAddColorButton]
[cpAddColorButtonText]
[cpAddColorButtonClass]
[cpRemoveColorButtonClass]
[cpMaxPresetColorsLength]
[cpPresetEmptyMessage]
[cpPresetEmptyMessageClass]
[cpUseRootViewContainer]
(colorPickerOpen)
(colorPickerClose)
(colorPickerChange)
(colorPickerCancel)
(colorPickerSelect)
(cpToggleChange)
(cpInputChange)
(cpSliderChange)
(cpSliderDragEnd)
(cpSliderDragStart)
(cpPresetColorsChange)
Available control / helper functions (provided by the directive):
openDialog()
closeDialog()