json-editor
json-editor copied to clipboard
Color picker for colors with enumerated values
{
"type": "string",
"format": "color",
"enum": ["#0000ff","#ff0000","#00ff00"]
}
This should render as a radio group with the colors shown in small squares.
It would be nice to integrate spectrum.js and this feature is what you want http://bgrins.github.io/spectrum/#options-showPalette
Incidentally I've used Spectrum with json-editor myself and demonstrated it here:
https://github.com/TrevorPage/jdorn-json-editor-android
This demonstration is for Android and in my situation I absolutely had to use Spectrum because the Android browser's native colour picker doesn't seem to work.
I'm afraid I've not done any integration with the json-editor library as such. I'm just using jQuery to substitute in Spectrum in place of selected text fields, after json-editor has rendered its HTML.
I create a spectrum-editor ^_^: https://github.com/hellobugme/json-editor.zh-CN/tree/master/plugin/spectrum-editor
@hellobugme – this is awesome!