Gathering detailed insights and metrics for ngx-color
Gathering detailed insights and metrics for ngx-color
npm install ngx-color
Typescript
Module System
Node Version
NPM Version
95.4
Supply Chain
97.8
Quality
75.7
Maintenance
100
Vulnerability
98.9
License
TypeScript (92.48%)
HTML (6.1%)
JavaScript (0.76%)
CSS (0.66%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
6,705,044
Last Day
1,704
Last Week
50,369
Last Month
203,299
Last Year
2,304,385
MIT License
437 Stars
431 Commits
56 Forks
5 Watchers
1 Branches
13 Contributors
Updated on Dec 24, 2024
Minified
Minified + Gzipped
Latest Version
9.0.0
Package Id
ngx-color@9.0.0
Unpacked Size
1.05 MB
Size
196.06 kB
File Count
177
NPM Version
9.6.4
Node Version
20.1.0
Published on
May 15, 2023
Cumulative downloads
Total Downloads
Last Day
30.9%
1,704
Compared to previous day
Last Week
4.2%
50,369
Compared to previous week
Last Month
31.9%
203,299
Compared to previous month
Last Year
27.8%
2,304,385
Compared to previous year
3
2
DEMO: https://ngx-color.vercel.app
13 Different Pickers - Sketch, Photoshop, Chrome, Twitter and many more
Make Your Own - Use the building block components to make your own
This is a port of react-color by casesandberg
Latest version available for each version of Angular
ngx-color | Angular |
---|---|
4.1.1 | 8.x |
5.1.4 | 9.x |
6.2.0 | 10.x 11.x |
7.3.3 | 12.x 13.x |
8.0.3 | 14.x 15.x |
current | >= 16.x |
1npm install ngx-color --save
1import { ColorSketchModule } from 'ngx-color/sketch'; 2 3@NgModule({ 4 imports: [ 5 ColorSketchModule, // added to imports 6 ], 7}) 8class YourModule {}
1<color-sketch [color]="state" (onChangeComplete)="changeComplete($event)"></color-sketch>
1import { ColorAlphaModule } from 'ngx-color/alpha'; // <color-alpha-picker></color-alpha-picker> 2import { ColorBlockModule } from 'ngx-color/block'; // <color-block></color-block> 3import { ColorChromeModule } from 'ngx-color/chrome'; // <color-chrome></color-chrome> 4import { ColorCircleModule } from 'ngx-color/circle'; // <color-circle></color-circle> 5import { ColorCompactModule } from 'ngx-color/compact'; // <color-compact></color-compact> 6import { ColorGithubModule } from 'ngx-color/github'; // <color-github></color-github> 7import { ColorHueModule } from 'ngx-color/hue'; // <color-hue-picker></color-hue-picker> 8import { ColorMaterialModule } from 'ngx-color/material'; // <color-material></color-material> 9import { ColorPhotoshopModule } from 'ngx-color/photoshop'; // <color-photoshop></color-photoshop> 10import { ColorSketchModule } from 'ngx-color/sketch'; // <color-sketch></color-sketch> 11import { ColorSliderModule } from 'ngx-color/slider'; // <color-slider></color-slider> 12import { ColorSwatchesModule } from 'ngx-color/swatches'; // <color-swatches></color-swatches> 13import { ColorTwitterModule } from 'ngx-color/twitter'; // <color-twitter></color-twitter> 14import { ColorShadeModule } from 'ngx-color/shade'; // <color-shade-picker></color-shade-picker>
Color controls what color is active on the color picker. You can use this to initialize the color picker with a particular color, or to keep it in sync with the state of a parent component.
Color accepts either a string of a hex color '#333'
or a object of rgb or hsl
values { r: 51, g: 51, b: 51 }
or { h: 0, s: 0, l: .10 }
. Both rgb and hsl
will also take a a: 1
value for alpha. You can also use transparent
.
1<color-sketch color="#fff" (onChangeComplete)="handleChangeComplete($event)"></color-sketch>
In this case, the color picker will initialize with the color #fff
. When the
color is changed, handleChangeComplete
will fire and set the new color to
state.
Pass a function to call every time the color is changed. Use this to store the color in the state of a parent component or to make other transformations.
Keep in mind this is called on drag events that can happen quite frequently. If
you just need to get the color once use onChangeComplete
.
1import { Component } from '@angular/core'; 2import { ColorEvent } from 'ngx-color'; 3 4@Component({ 5 selector: 'selector-name', 6 template: ` <color-sketch (onChange)="handleChange($event)"></color-sketch> `, 7}) 8export class NameComponent { 9 constructor() {} 10 11 handleChange($event: ColorEvent) { 12 console.log($event.color); 13 // color = { 14 // hex: '#333', 15 // rgb: { 16 // r: 51, 17 // g: 51, 18 // b: 51, 19 // a: 1, 20 // }, 21 // hsl: { 22 // h: 0, 23 // s: 0, 24 // l: .20, 25 // a: 1, 26 // }, 27 // } 28 } 29}
Pass a function to call once a color change is complete.
Some pickers have specific APIs that are unique to themselves:
316px
16px
horizontal
or vertical
. Default horizontal
170px
['#D9E3F0', '#F47373', '#697689', '#37D67A', '#2CCCE4', '#555555', '#dce775', '#ff8a65', '#ba68c8']
hide
or top
. Default top
onMouseOver
on the
<Swatch>
s within this component. Gives the args (color, event)
false
252px
["#f44336", "#e91e63", "#9c27b0", "#673ab7", "#3f51b5", "#2196f3", "#03a9f4", "#00bcd4", "#009688", "#4caf50", "#8bc34a", "#cddc39", "#ffeb3b", "#ffc107", "#ff9800", "#ff5722", "#795548", "#607d8b"]
28
14
onMouseOver
on the
<Swatch>
s within this component. Gives the args (color, event)
['#4D4D4D', '#999999', '#FFFFFF', '#F44E3B', '#FE9200', '#FCDC00', '#DBDF00', '#A4DD00', '#68CCCA', '#73D8FF', '#AEA1FF', '#FDA1FF', '#333333', '#808080', '#cccccc', '#D33115', '#E27300', '#FCC400', '#B0BC00', '#68BC00', '#16A5A5', '#009CE0', '#7B64FF', '#FA28FF', '#000000', '#666666', '#B3B3B3', '#9F0500', '#C45100', '#FB9E00', '#808900', '#194D33', '#0C797D', '#0062B1', '#653294', '#AB149E']
onMouseOver
on the
<Swatch>
s within this component. Gives the args (color, event)
212px
['#B80000', '#DB3E00', '#FCCB00', '#008B02', '#006B76', '#1273DE', '#004DCF', '#5300EB', '#EB9694', '#FAD0C3', '#FEF3BD', '#C1E1C5', '#BEDADC', '#C4DEF6', '#BED3F3', '#D4C4FB']
hide
, top-left
or top-right
. Default
top-left
onMouseOver
on the
<Swatch>
s within this component. Gives the args (color, event)
316px
16px
horizontal
or vertical
. Default horizontal
None
Color Picker
false
['#D0021B', '#F5A623', '#F8E71C', '#8B572A', '#7ED321', '#417505', '#BD10E0', '#9013FE', '#4A90E2', '#50E3C2', '#B8E986', '#000000', '#4A4A4A', '#9B9B9B', '#FFFFFF']
presetColors may also be described as an array of objects with
color
andtitle
properties:[{ color: '#f00', title: 'red' }]
or a combination of both
200
onMouseOver
on the <Swatch>
s
within this component. Gives the args (color, event)
320
240
onMouseOver
on the
<Swatch>
s within this component. Gives the args (color, event)
276px
['#FF6900', '#FCB900', '#7BDCB5', '#00D084', '#8ED1FC', '#0693E3', '#ABB8C3', '#EB144C', '#F78DA7', '#9900EF']
hide
, top-left
or top-right
. Default
top-left
onMouseOver
on the
<Swatch>
s within this component. Gives the args (color, event)
316px
16px
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 5
Details
Reason
Found 11/28 approved changesets -- score normalized to 3
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
38 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-02-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More