import React from 'react' import inputStyle from './input.js' import { getColor } from 'react-colorpickr/dist/colorfunc' import ChromePicker from 'react-color/lib/components/chrome/Chrome' function formatColor(color) { const rgb = color.rgb return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${rgb.a})` } /*** Number fields with support for min, max and units and documentation*/ class ColorField extends React.Component { static propTypes = { onChange: React.PropTypes.func.isRequired, name: React.PropTypes.string.isRequired, value: React.PropTypes.string, default: React.PropTypes.number, doc: React.PropTypes.string, } constructor(props) { super(props) this.state = { pickerOpened: false } } togglePicker() { this.setState({ pickerOpened: !this.state.pickerOpened }) } render() { const picker =