Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
react-color-palette
Advanced tools
yarn add react-color-palette
npm install react-color-palette
import { ColorPicker, useColor } from "react-color-palette";
import "react-color-palette/css";
export function App() {
const [color, setColor] = useColor("#561ecb");
return <ColorPicker color={color} onChange={setColor} />;
}
rgb()
in useColor()
import { ColorPicker, useColor } from "react-color-palette";
import "react-color-palette/css";
export function App() {
const [color, setColor] = useColor("rgb(86 30 203)");
return <ColorPicker color={color} onChange={setColor} />;
}
<named-color>
in useColor()
import { ColorPicker, useColor } from "react-color-palette";
import "react-color-palette/css";
export function App() {
const [color, setColor] = useColor("cyan");
return <ColorPicker color={color} onChange={setColor} />;
}
import { Saturation, Hue, useColor } from "react-color-palette";
import "react-color-palette/css";
export function App() {
const [color, setColor] = useColor("hsl(120 100% 50% / .5)");
return (
<div className="custom-layout">
<Saturation height={300} color={color} onChange={setColor} />
<Hue color={color} onChange={setColor} />
</div>
);
}
import { ColorPicker, useColor } from "react-color-palette";
import "react-color-palette/css";
export function App() {
const [color, setColor] = useColor("#123123");
return <ColorPicker hideInput={["rgb", "hsv"]} color={color} onChange={setColor} />
}
import { ColorPicker, useColor, type IColor } from "react-color-palette";
import "react-color-palette/css";
export function App() {
const [color, setColor] = useColor("#123123");
const onChangeComplete = (color: IColor) => localStorage.setItem("color", color.hex);
return <ColorPicker hideInput={["rgb", "hsv"]} color={color} onChange={setColor} onChangeComplete={onChangeComplete} />
}
<ColorPicker />
The main component, which includes: <Saturation />, <Hue />, <Alpha /> and <Fields /> components for instant use.
If you need a custom layout, then you can use <Saturation />, <Hue /> and <Alpha /> components separately, which are also exported from the library.
Prop | Type | Default | Description |
---|---|---|---|
height | number | 200 | Height of the Saturation component in pixels. |
hideAlpha | boolean | false | Hides the Alpha component. |
hideInput | (keyof IColor)[] | boolean | false | If boolean: hides all inputs if true or displays all inputs if false. If array: hides all inputs listed in the array. |
color | IColor | Current color. | |
disabled | boolean | false | Disables interactivity. |
onChange | Function | Сallback function will be fired when color changes. | |
onChangeComplete | Function | Callback function will be fired when the interaction is complete with the color picker. |
<Saturation />
Prop | Type | Default | Description |
---|---|---|---|
height | number | Height of the saturation element in pixels. | |
color | IColor | Current color. | |
disabled | boolean | false | Disables interactivity. |
onChange | Function | Сallback function will be fired when color changes. | |
onChangeComplete | Function | Callback function will be fired when the interaction is complete with the saturation picker. |
<Hue />
Prop | Type | Default | Description |
---|---|---|---|
color | IColor | Current color. | |
disabled | boolean | false | Disables interactivity. |
onChange | Function | Сallback function will be fired when color changes. | |
onChangeComplete | Function | Callback function will be fired when the interaction is complete with the hue picker. |
<Alpha />
Prop | Type | Default | Description |
---|---|---|---|
color | IColor | Current color. | |
disabled | boolean | false | Disables interactivity. |
onChange | Function | Сallback function will be fired when color changes. | |
onChangeComplete | Function | Callback function will be fired when the interaction is complete with the alpha picker. |
useColor()
Arg | Type | Default | Description |
---|---|---|---|
initialColor | TColor | Initial сolor. |
TColor
Value can be specified using one of the methods listed below:
<named-color>
<hex-color>
hsl()
, hwb()
or rgb()
IColor
Field | Type |
---|---|
hex | string |
rgb | IColorRgb |
hsv | IColorHsv |
IColorRgb
Field | Type |
---|---|
r | number |
g | number |
b | number |
a | number |
IColorHsv
Field | Type |
---|---|
h | number |
s | number |
v | number |
a | number |
Code released under the MIT license.
FAQs
🎨 Lightweight Color Picker component for React.
The npm package react-color-palette receives a total of 30,261 weekly downloads. As such, react-color-palette popularity was classified as popular.
We found that react-color-palette demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.