All Projects → luncheon → reinvented-color-wheel

luncheon / reinvented-color-wheel

Licence: WTFPL license
A vanilla-js touch-friendly HSV color picker inspired by Farbtastic Color Picker.

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to reinvented-color-wheel

React Colorpickr
A themeable colorpicker with HSL and RGB support for React
Stars: ✭ 180 (+318.6%)
Mutual labels:  color, color-picker
ColorHelper
No description or website provided.
Stars: ✭ 34 (-20.93%)
Mutual labels:  color, hsv
Xcolor
Lightweight color picker for X11
Stars: ✭ 209 (+386.05%)
Mutual labels:  color, color-picker
Pikolo
An android color picker library
Stars: ✭ 142 (+230.23%)
Mutual labels:  color, color-picker
react-native-color-panel
React Native Color Panel Component for iOS and Android 🏳️‍🌈
Stars: ✭ 21 (-51.16%)
Mutual labels:  color, color-picker
Colorbook
🎨 Color schemes for UI design - Optimized for foreground, background, border, etc. https://liyasthomas.github.io/colorbook
Stars: ✭ 148 (+244.19%)
Mutual labels:  color, color-picker
ColorPickerLib
A WPF/MVVM implementation of a themeable color picker control.
Stars: ✭ 44 (+2.33%)
Mutual labels:  color, color-picker
Colorpickerwpf
Simple color picker control for WPF
Stars: ✭ 71 (+65.12%)
Mutual labels:  color, color-picker
rgb-tui
Create and get colors code from the terminal using a nice interface.
Stars: ✭ 57 (+32.56%)
Mutual labels:  color, hsv
react-native-image-color-picker
Image color picker based on image source provided and return image different color palettes or average color palette
Stars: ✭ 25 (-41.86%)
Mutual labels:  color, color-picker
Colorwanted
Screen color picker for Windows (Windows 上的屏幕取色器)
Stars: ✭ 105 (+144.19%)
Mutual labels:  color, color-picker
colr pickr
Colr Pickr, a vanilla JavaScript color picker component built with SVGs, with features like saving colors. Similar design to the chrome-dev-tools color picker.
Stars: ✭ 27 (-37.21%)
Mutual labels:  color, color-picker
Bootstrap Colorpicker
Bootstrap Colorpicker is a modular color picker plugin for Bootstrap.
Stars: ✭ 1,351 (+3041.86%)
Mutual labels:  color, color-picker
React Native Color
Color components for React Native 🌈
Stars: ✭ 178 (+313.95%)
Mutual labels:  color, color-picker
Colors App
🎨 A PWA for copying values from popular color palettes. Supports HEX, RGB, and HSL formats.
Stars: ✭ 90 (+109.3%)
Mutual labels:  color, color-picker
Androidphotoshopcolorpicker
A fully featured Color picker Library for Android
Stars: ✭ 220 (+411.63%)
Mutual labels:  color, color-picker
React Colorful
🎨 A tiny (2,5 KB) color picker component for React and Preact apps
Stars: ✭ 951 (+2111.63%)
Mutual labels:  color, color-picker
Leonardo
Generate colors based on a desired contrast ratio
Stars: ✭ 973 (+2162.79%)
Mutual labels:  color, color-picker
ichiColor
Full features javascript color parser module, perfect work with vue.js; support RGB, HSL, HSV/HSB, HSL255, HSL240, HWB, XYZ, LAB, LUV, LHCab, xyY...
Stars: ✭ 23 (-46.51%)
Mutual labels:  color, hsv
SwiftColorWheel
Delightful color picker wheel for iOS in Swift.
Stars: ✭ 37 (-13.95%)
Mutual labels:  color, color-picker

Reinvented Color Wheel

npm jsDelivr WTFPL

image

A vanilla-js touch-friendly HSV color picker inspired by Farbtastic Color Picker.

Demo

Characteristics

  • HSV (hue, saturation, value) cylindrical color model (unlike Farbtastic that takes HSL)
  • Touch-friendly
  • No need jQuery
  • Lightweight (JS + CSS ~ 3.1 KB minified + gzipped)

Installation

via npm (with a module bundler)

$ npm install reinvented-color-wheel
import "reinvented-color-wheel/css/reinvented-color-wheel.min.css";
import ReinventedColorWheel from "reinvented-color-wheel";

via CDN (jsDelivr)

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/reinvented-color-wheel.min.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script>/* `window.ReinventedColorWheel` object is available */</script>

or for modern browsers:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/reinvented-color-wheel.min.css">
<script type="module">
  import ReinventedColorWheel from "https://cdn.jsdelivr.net/npm/[email protected]/es/reinvented-color-wheel.bundle.min.js";
</script>

Download directly

reinvented-color-wheel.min.css
reinvented-color-wheel.min.js

Usage

// create a new color picker
var colorWheel = new ReinventedColorWheel({
  // appendTo is the only required property. specify the parent element of the color wheel.
  appendTo: document.getElementById("my-color-picker-container"),

  // followings are optional properties and their default values.

  // initial color (can be specified in hsv / hsl / rgb / hex)
  hsv: [0, 100, 100],
  // hsl: [0, 100, 50],
  // rgb: [255, 0, 0],
  // hex: "#ff0000",

  // appearance
  wheelDiameter: 200,
  wheelThickness: 20,
  handleDiameter: 16,
  wheelReflectsSaturation: true,

  // handler
  onChange: function (color) {
    // the only argument is the ReinventedColorWheel instance itself.
    // console.log("hsv:", color.hsv[0], color.hsv[1], color.hsv[2]);
  },
});

// set color in HSV / HSL / RGB / HEX
colorWheel.hsv = [240, 100, 100];
colorWheel.hsl = [120, 100, 50];
colorWheel.rgb = [255, 128, 64];
colorWheel.hex = '#888888';

// get color in HSV / HSL / RGB / HEX
console.log("hsv:", colorWheel.hsv[0], colorWheel.hsv[1], colorWheel.hsv[2]);
console.log("hsl:", colorWheel.hsl[0], colorWheel.hsl[1], colorWheel.hsl[2]);
console.log("rgb:", colorWheel.rgb[0], colorWheel.rgb[1], colorWheel.rgb[2]);
console.log("hex:", colorWheel.hex);

// please call redraw() after changing some appearance properties.
colorWheel.wheelDiameter = 400;
colorWheel.wheelThickness = 40;
colorWheel.redraw();

Web Components

This package contains the Web Components wrapping the color wheel.
The tag is <reinvented-color-wheel>.
The options above except for appendTo can be specified with kebab-case, and each option is optional.

<!-- CSS is included in JS: no <link> is needed. -->
<script src="reinvented-color-wheel/webcomponents/index.js"></script>

<reinvented-color-wheel
  hex="#ff3e00"
  wheel-diameter="200"
  wheel-thickness="20"
  handle-diameter="16"
  wheel-reflects-saturation="false"
></reinvented-color-wheel>

<!-- hsv, hsl or rgb can be specified as a comma-separated string. -->
<reinvented-color-wheel rgb="255,62,0"></reinvented-color-wheel>

React Component

This package contains the React component wrapping the color wheel.
The options above except for appendTo can be specified, and each option is optional.

import React from 'react'
import ReinventedColorWheel from 'reinvented-color-wheel/react'
import 'reinvented-color-wheel/css/reinvented-color-wheel.min.css'

const App = () => {
  const [hex, setHex] = React.useState('#000000')
  return (
    <>
      <ReinventedColorWheel
        // hsv={[0, 100, 100]}
        // hsl={[0, 100, 50]}
        // rgb={[255, 0, 0]}
        // hex="#ff0000"
        hex={hex}
        wheelDiameter={200}
        wheelThickness={20}
        handleDiameter={16}
        wheelReflectsSaturation
        onChange={({ hex }) => setHex(hex)}
      />
      <input value={hex} onChange={e => setHex(e.target.value)} />
    </>
  )
}

License

WTFPL

Sister Package

lch-color-wheel: L*C*h color wheel

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].