0.0.3 • Published 7 years ago
react-freecolor v0.0.3
可组合拾色器
组件部分参考自casesandberg/react-color。相比react-color,该组件更加组合化和客制化,可以任意选择需要的组件进行组合,调整布局,设置各组件样式,并允许添加自定义组件。
示例代码
class ColorPickerExample extends React.Component {
handleChange (colorObj) {
console.log(colorObj)
}
render () {
return (
<ColorPicker color='blue' onChange={ (a) => this.handleChange(a) }>
<Saturation/>
<Hue style={ style.hueStyle } direction='vertical'/>
<Fields style={ style.fields }>
<EditableInput style={ style.inputStyle } label='r'/>
<EditableInput style={ style.inputStyle } label='g'/>
<EditableInput style={ style.inputStyle } label='b'/>
<div style={ style.divider }></div>
<EditableInput style={ style.inputStyle } label='h'/>
<EditableInput style={ style.inputStyle } label='s'/>
<EditableInput style={ style.inputStyle } label='l'/>
</Fields>
</ColorPicker>
)
}
}