Thoughts:
Is the "kb2.html" required in the URL? I seem to get the same site if I omit that.
Shift-click doesn't select from the previous key clicked, to the one shift-clicked :) If you're going to implement ctrl+click, then shift+click should also work.
You might want to add pellcheck="false" to the <textarea> attributes, to stop your browser showing you a bloodbath of "spelling mistakes"
Increasing a key width doesn't shuffle along all the remaining keys. The controls UI and the JSON have totally different ideas about spacing, with JSON operating relative and the controls UI operating absolute. There's no controls UI way to shift a block of keys across. Also, there is no UI way to set a bigass enter or J enter as you can only load keyboard presets, instead of keycap presets.
Setting the + field of X to 1 instead of 0 is WEIRD. For shift (a wide key) the keys gets wider instead of moving horizontally. For a 1-unit key it leaves a dead key behind, forming a permanent key group. The dead key cannot have a caption. The Y field then only applies to the "real" key, not the dead one. This has got to be broken, as it makes no sense whatsoever. Either way, some tooltips would be useful to remind people what these fields are for, as the controls, the keyboard, and the JSON code all work completely differently and it's not remotely obvious what you're supposed to do with any of it.
There are two colour fields, and changing either one forces the other one to the same value, so that makes no sense. If they can't have separate values, then one of them needs to go.
In terms of colours, ideally you'd have a small palette of entries, where clicking any key then a palette entry would set the key to that palette index. Then maybe:
Code: Select all
{
meta: { version: 0.3, default_bg: 0, legend: 2 },
palette: [ #EEEEEE, #CCCCCC, #000000 ],
rows: [
[ { l1: "Esc", bg: 1 } ]
]
}
Probably the palette would have: Add colour, Edit colour, Remove colour. For example, the two-tone would start out with [ #EEEEEE, #CCCCCC ]. To have a Red esc, just hit Add colour, dial in red, click Esc and then click the new palette entry. This way, you can alter the colours centrally, like with matt3o's colour chooser. The need to set explicit colours on single keys is not a great enough need to have so much fiddly complexity associated with setting primary and secondary colours. (Though perhaps altering a keycap's colour directly would add a palette entry automatically)
Or, if you want to keep the colours on the keys for readability at a cost of duplicated data and more difficult manual entry:
Code: Select all
{
meta: { version: 0.3, default_bg: #EEEEEE, default_fg: #000000 },
rows: [
[ { l1: "Esc", bg: #CCCCCC } ]
]
}
bg is background of course; fg is foreground, i.e. legend colour. You may need fg1, fg2 etc if you ever want to allow each legend line to have its own colour.
Clearing the background colour field would draw the default colour instead of black. At the moment, there's no way to have the default background be any colour besides pale grey (not without rooting through all the JSON code and finding all the colour resets and changing them), and the format has no way to indicate to the parser what it should be expecting. If this software is successful, people are going to be plugging in older code with potentially a different data format and causing it to render garbage or crash unless the editor can pick up on the older format and convert it to the latest version and emit newer JSON code into the text box. (You might have to warn the user that the data needs to be rewritten in the newer format.)
It's rather hard to create a succinct data structure and I'm not wholly sure that you want to. For example, it's come at a cost of some keys (those with any parameters) taking up TWO list indices, one for the parameter block and another for the caption, which is just weird. On the other hand, ISO and J enter have no JSON shortcuts, e.g. shape: "ISO Enter". (J enter is a pain as there are so many shapes.)
Finally, I would add 1 px of spacing between keycaps for improved aesthetics. Maybe one day you can add support for simulating cylindrical keycaps ;-)