Skip to content

Commit 19224d8

Browse files
committed
Active property upon pallete.
1 parent ac735e9 commit 19224d8

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const App = () => {
6363
| `color` | `String` | `` | Yes | The stop color, can be either hex of rgb format.
6464
| `offset`| `Number` | `` | `Yes` | The stop color offset in percent.
6565
| `opacity`| `Number` | `1` | `No` | The stop color opacity.
66+
| `active`| `Boolean` | `` | `No` | Rather the current color is active (selected) or not.
6667

6768
## Angle Picke Usage
6869
<img width="200" alt="gradient_preview" src="/assets/ap.png"> <br/>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-linear-gradient-picker",
3-
"version": "1.1.4",
3+
"version": "1.2.0",
44
"description": "React linear gradient picker",
55
"main": "dist/index.js",
66
"scripts": {

src/components/GradientPicker/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,12 @@ const GradientPicker = ({
9292

9393
const handlePaletteChange = (palette) => {
9494
const sortedPalette = sortPalette(palette)
95-
.map(({ offset, ...rest }) => ({ offset: Number(offset).toFixed(3), ...rest }));
95+
.map(({ offset, id, ...rest }) => ({
96+
id,
97+
offset: Number(offset).toFixed(3),
98+
active: id === activeColorId,
99+
...rest
100+
}));
96101

97102
onPaletteChange(sortedPalette);
98103
};

0 commit comments

Comments
 (0)