Angular2 Color Picker
Angular 2 Color Picker Directive/Component with no dependencies required.
Installation
npm i --save ng-color-picker
Usage
- Use it in your HTML elements, for example:
- Or:
- Add ColorPickerModule in your app.module.ts:
; @
- Set color the variable. You can use ColorPickerService in your component if you want extra functions.
;; @ private color: string = "#127bdc"; { }
Build
git clone https://github.com/zskhan/ng-color-pickercd ng-color-pickernpm i && npm run peerinstallnpm run build
Options
Default option is the first item.
[cpOutputFormat]="'hex', 'rgba', 'hsla'"[cpPosition]="'right', 'left', 'top', 'bottom'"[cpPositionOffset]="'0%'"[cpPositionRelativeToArrow]="false, true"[cpWidth]="'230px'"[cpHeight]="'auto'"[cpSaveClickOutside]="true, false"[cpOKButton]="false, true"[cpOKButtonClass]="''"[cpOKButtonText]="'OK'"[cpCancelButton]="false, true"[cpCancelButtonClass]="''"[cpCancelButtonText]="'Cancel'"[cpFallbackColor]="'#fff'"[cpPresetLabel]="'Preset colors'"[cpPresetColors]="[]", e.g: "['#fff', '#000']"[cpToggle] = "false, true"[cpIgnoredElements]="[]"[cpDialogDisplay]="'popup,' 'inline'"[cpAlphaChannel]="'hex6', 'hex8', 'disabled'"
Tested in:
- Chrome
- Firefox
- Microsoft Edge
- Opera
- Safari
- Internet Explorer