Files
hkkb-layout-web/internal/hhkb/palette.go
2026-05-27 18:50:35 +09:00

30 lines
897 B
Go

package hhkb
// KeycodeGroup is one labelled section of the keycode palette.
type KeycodeGroup struct {
Name string
Codes []byte
}
// Palette groups the assignable scancodes for the editor, roughly the way the
// official tool and QMK present them.
var Palette = []KeycodeGroup{
{"Letters", codeRange(0x04, 0x1d)},
{"Numbers", codeRange(0x1e, 0x27)},
{"Symbols", []byte{0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38}},
{"Editing", []byte{0x29, 0x2a, 0x2b, 0x28, 0x2c, 0x39}},
{"Navigation", codeRange(0x49, 0x52)},
{"Function", codeRange(0x3a, 0x45)},
{"Modifiers", []byte{0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7}},
{"Media", []byte{0xe8, 0xe9, 0xea, 0xeb}},
{"Special", []byte{0x00, 0x01, 0x46, 0x47, 0x48}},
}
func codeRange(lo, hi byte) []byte {
out := make([]byte, 0, int(hi-lo)+1)
for c := lo; c <= hi; c++ {
out = append(out, c)
}
return out
}