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 run build
Running the example
npm install
npm run start
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]
[cpCmykEnabled]
[cpOutputFormat]
[cpAlphaChannel]
[cpFallbackColor]
[cpPosition]
[cpPositionOffset]
[cpPositionRelativeToArrow]
[cpPresetLabel]
[cpPresetColors]
[cpDisableInput]
[cpDialogDisplay]
[cpIgnoredElements]
[cpSaveClickOutside]
[cpCloseClickOutside]
[cpOKButton]
[cpOKButtonText]
[cpOKButtonClass]
[cpCancelButton]
[cpCancelButtonText]
[cpCancelButtonClass]
[cpAddColorButton]
[cpAddColorButtonText]
[cpAddColorButtonClass]
[cpRemoveColorButtonClass]
[cpPresetColorsClass]
[cpMaxPresetColorsLength]
[cpPresetEmptyMessage]
[cpPresetEmptyMessageClass]
[cpUseRootViewContainer]
(colorPickerOpen)
(colorPickerClose)
(colorPickerChange)
(colorPickerCancel)
(colorPickerSelect)
(cpToggleChange)
(cpInputChange)
(cpSliderChange)
(cpSliderDragStart)
(cpSliderDragEnd)
(cpCmykColorChange)
(cpPresetColorsChange)
Available control / helper functions (provided by the directive):
openDialog()
closeDialog()