@severfam/angular-color-picker 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -42
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,76 +1,80 @@
|
|
|
1
1
|
# Angular Color Picker
|
|
2
2
|
|
|
3
|
-
Angular
|
|
3
|
+
Angular color picker component with shade and saturation selection. Renders on Canvas, auto-scales and recalculates sizes on container resize.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install color-picker
|
|
8
|
+
npm install @severfam/angular-color-picker
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Requirements
|
|
12
12
|
|
|
13
13
|
- Angular 21.2+
|
|
14
|
-
-
|
|
14
|
+
- Uses `OnPush` change detection
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## Usage
|
|
17
17
|
|
|
18
|
-
### 1.
|
|
18
|
+
### 1. Import
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Standalone component — import directly in your component's `imports`:
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
|
-
import { Component } from '@angular/core';
|
|
24
|
-
import { ColorPicker } from 'color-picker';
|
|
23
|
+
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
|
|
24
|
+
import { ColorPicker } from '@severfam/angular-color-picker';
|
|
25
25
|
|
|
26
26
|
@Component({
|
|
27
27
|
selector: 'app-root',
|
|
28
28
|
imports: [ColorPicker],
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
(changeModel)="onColorChange($event)"
|
|
33
|
-
/>
|
|
34
|
-
`,
|
|
29
|
+
templateUrl: './app.html',
|
|
30
|
+
styleUrl: './app.scss',
|
|
31
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
35
32
|
})
|
|
36
33
|
export class AppComponent {
|
|
37
|
-
color = '#2889e9';
|
|
34
|
+
color = signal('#2889e9');
|
|
38
35
|
|
|
39
36
|
onColorChange(color: string | null) {
|
|
40
|
-
this.color
|
|
37
|
+
this.color.set(color);
|
|
41
38
|
}
|
|
42
39
|
}
|
|
43
40
|
```
|
|
44
41
|
|
|
42
|
+
```html
|
|
43
|
+
<lib-color-picker
|
|
44
|
+
[inColor]="color()"
|
|
45
|
+
(changeModel)="onColorChange($event)"
|
|
46
|
+
/>
|
|
47
|
+
```
|
|
48
|
+
|
|
45
49
|
## API
|
|
46
50
|
|
|
47
51
|
### Inputs
|
|
48
52
|
|
|
49
|
-
| Input |
|
|
50
|
-
|
|
51
|
-
| `inColor` | `string \| null` |
|
|
52
|
-
| `colorDefault` | `string` | `'#000000'` |
|
|
53
|
-
| `hasTransparent` | `boolean` | `true` |
|
|
54
|
-
| `hasEyeDropper` | `boolean` | `false` |
|
|
55
|
-
| `eyeColor` | `string \| null` | — |
|
|
53
|
+
| Input | Type | Default | Description |
|
|
54
|
+
|-------|------|---------|-------------|
|
|
55
|
+
| `inColor` | `string \| null` | **required** | Current color (hex). Supports `#RGB` and `#RRGGBB`. |
|
|
56
|
+
| `colorDefault` | `string` | `'#000000'` | Default color when `hasTransparent = false` and no color is selected. |
|
|
57
|
+
| `hasTransparent` | `boolean` | `true` | Show "no color" (transparent) button. |
|
|
58
|
+
| `hasEyeDropper` | `boolean` | `false` | Show eyedropper icon. |
|
|
59
|
+
| `eyeColor` | `string \| null` | — | Color for eyedropper preview (separate from selected color). |
|
|
56
60
|
|
|
57
61
|
### Outputs
|
|
58
62
|
|
|
59
|
-
| Output |
|
|
60
|
-
|
|
61
|
-
| `changeModel` | `string \| null` |
|
|
62
|
-
| `changeEnd` | `void` |
|
|
63
|
-
| `startEye` | `Event` |
|
|
63
|
+
| Output | Type | Description |
|
|
64
|
+
|--------|------|-------------|
|
|
65
|
+
| `changeModel` | `string \| null` | Emits on every color change (input field, palette selection). |
|
|
66
|
+
| `changeEnd` | `void` | Emits when selection ends (mouse/touch release). |
|
|
67
|
+
| `startEye` | `Event` | Emits on eyedropper icon click. |
|
|
64
68
|
|
|
65
|
-
###
|
|
69
|
+
### Selector
|
|
66
70
|
|
|
67
71
|
```html
|
|
68
72
|
<lib-color-picker></lib-color-picker>
|
|
69
73
|
```
|
|
70
74
|
|
|
71
|
-
##
|
|
75
|
+
## Examples
|
|
72
76
|
|
|
73
|
-
###
|
|
77
|
+
### Basic
|
|
74
78
|
|
|
75
79
|
```html
|
|
76
80
|
<lib-color-picker
|
|
@@ -79,35 +83,35 @@ export class AppComponent {
|
|
|
79
83
|
/>
|
|
80
84
|
```
|
|
81
85
|
|
|
82
|
-
###
|
|
86
|
+
### Without transparency
|
|
83
87
|
|
|
84
88
|
```html
|
|
85
89
|
<lib-color-picker
|
|
86
|
-
[inColor]="color"
|
|
90
|
+
[inColor]="color()"
|
|
87
91
|
[hasTransparent]="false"
|
|
88
92
|
[colorDefault]="'#ffffff'"
|
|
89
93
|
(changeModel)="onColorChange($event)"
|
|
90
94
|
/>
|
|
91
95
|
```
|
|
92
96
|
|
|
93
|
-
###
|
|
97
|
+
### With eyedropper
|
|
94
98
|
|
|
95
99
|
```html
|
|
96
100
|
<lib-color-picker
|
|
97
|
-
[inColor]="color"
|
|
101
|
+
[inColor]="color()"
|
|
98
102
|
[hasEyeDropper]="true"
|
|
99
|
-
[eyeColor]="originalColor"
|
|
103
|
+
[eyeColor]="originalColor()"
|
|
100
104
|
(changeModel)="onColorChange($event)"
|
|
101
105
|
(changeEnd)="saveColor()"
|
|
102
106
|
(startEye)="activateEyedropper()"
|
|
103
107
|
/>
|
|
104
108
|
```
|
|
105
109
|
|
|
106
|
-
##
|
|
110
|
+
## Styles
|
|
107
111
|
|
|
108
|
-
|
|
112
|
+
Component uses SCSS. Base styles are included automatically via `styleUrls`.
|
|
109
113
|
|
|
110
|
-
|
|
114
|
+
To customize, override CSS variables or styles via `::ng-deep`:
|
|
111
115
|
|
|
112
116
|
```scss
|
|
113
117
|
lib-color-picker {
|
|
@@ -116,6 +120,6 @@ lib-color-picker {
|
|
|
116
120
|
}
|
|
117
121
|
```
|
|
118
122
|
|
|
119
|
-
##
|
|
123
|
+
## License
|
|
120
124
|
|
|
121
125
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@severfam/angular-color-picker",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Angular color picker component with shade and saturation selection. Renders on Canvas, auto-scales and recalculates sizes on container resize.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|