Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
react-pick-color
Advanced tools
Changelog
Readme
Small color picker component for React written in TypeScript.
npm install react-pick-color
# or
yarn add react-pick-color
import React, { useState } from 'react';
import ColorPicker from 'react-pick-color';
const App = () => {
const [color, setColor] = useState('#fff');
return <ColorPicker color={color} onChange={color => setColor(color.hex)} />;
};
color
string | { r: number, g: number, b: number, a: number } | { h: number, s: number, l: number, a: number }
| optional
The initial color as a hex string or rgba/hsla object.
onChange
(color: { hex: string, rgb: object, hsl: object, alpha: number }) => void
| optional
onChange callback with the current color object.
presets
array
| optional
combinations
"analogous" | "monochromatic" | "splitcomplement" | "triad" | "tetrad" | "complement"
| optional
Provide combinations
as a string or an array of combinations
.
hideAlpha
boolean
| optional | default: false
Hide the alpha range handler.
hideInputs
boolean
| optional | default: false
Hide color inputs
theme
{ background: string, inputBackground: string, color: string, borderColor: string, borderRadius: string, boxShadow: string, width: string }
| optional | default: themes.light
You can add a custom theme for styling the colorpicker component or choose one from the predefined themes.
Custom Theme
import ColorPicker from 'react-pick-color';
const ThemedColorPicker = () => {
return (
<ColorPicker
color="#3573CB"
theme={{
background: 'lightgrey',
inputBackground: 'grey',
borderColor: 'darkgrey',
borderRadius: '8px',
color: 'black',
width: '320px'
}}
/>
);
};
Predefined Theme
react-pick-color
exports a dark
and a light
theme.
import ColorPicker, { themes } from 'react-pick-color';
const ThemedColorPicker = () => {
return <ColorPicker color="#3573CB" theme={themes.dark} />;
};
FAQs
A modern color picker for react
The npm package react-pick-color receives a total of 2,261 weekly downloads. As such, react-pick-color popularity was classified as popular.
We found that react-pick-color demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.