Socket
Socket
Sign inDemoInstall

react-colorblender

Package Overview
Dependencies
1
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-colorblender

React color picker with colorblender


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
550 kB
Created
Weekly downloads
 

Readme

Source

React Colorblender

A powerful color picker in react.

Installation

npm install react-colorblender

Import

import { ColorPicker } from 'react-colorblender';

Usage

import React from 'react';
import { ColorPicker, useColor } from 'react-colorblender';

import 'react-colorblender/dist/style.css';

export default function Home() {
  const [color, setColor] = useColor('#ff0000');

  return <ColorPicker color={color} onChange={setColor} />;
}

API

ColorPicker

<ColorPicker color={color} onChange={setColor} />
PropertyRequiredDescriptionTypeDefault
colortrueThe color valueColor-
onChangetrueThe color change event(color: Color) => void-
widthfalseThe width of the pickernumber250
classNamefalseThe class name of the pickerstring-
hideAlphafalseHide the alpha sliderbooleanfalse

useColor

const [color, setColor] = useColor('#ff0000');
ArgsDescriptionType
initialColorThe initial colorColor

ColorPickerProps

interface ColorPickerProps {
  width?: number;
  hideAlpha?: boolean;
  hideInput?: boolean;
  color: Color;
  onChange: (color: Color) => void;
  className?: string;
}

Color

import type { HexColor, HsvaColor, RgbaColor } from 'colorblender';

type ColorType = HexColor | RgbaColor | HsvaColor;

class Color {
  hex: HexColor;
  rgb: RgbaColor;
  rgbString: string;
  hsv: HsvaColor;
  hsvString: string;

  constructor(color: ColorType, model: Models);
}

HexColor

type HexColor = string;

RgbaColor

interface RgbaColor {
  r: number;
  g: number;
  b: number;
  a: number;
}

HsvaColor

interface HsvaColor {
  h: number;
  s: number;
  v: number;
  a: number;
}

Roadmap

  • Picker with HEX
  • Alpha
  • RGB
  • HSV
  • HSL
  • HWB
  • CMYK
  • XYZ
  • LAB
  • LCH
  • Copy color
  • Custom css variables
  • Pick color from page
  • Multiple color models with useColor hook
  • And more...

Issues

Please file an issue for bugs, missing documentation, or unexpected behavior.

File an issue

LICENSE

MIT

Keywords

FAQs

Last updated on 15 Mar 2024

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc