Return `PaletteEntry` by key in package
Opened this issue · 2 comments
thekingofcity commented
Looking for a helper method that takes an id and returns the PaletteEntry
.
getPaletteEntryByID: (id: string) => PaletteEntry | undefined
If it's hard to make such a map, take the city name and ID should also be accepted :)
wongchito commented
After discussing with @thekingofcity offline, we understand that the motivations are:
- allowing users to use keyboard shortcuts to select colours;
- the current Palette - Picker is not friendly enough for keyboard users.
However, we find that adding such utility method is not feasible due to:
- the IDs of the lines covered in Palette are 'made-up' by contributors or maintainer and they are not necessarily the acronyms of the line names;
- palettes are stored as multiple JSON files by city, so implementing this method requires reverse indexing on these files and generating either a huge indexed file or hundreds of files by ID, which may impact the performance.
As a temporary solution, we're going to improve the a11y of the Palette - Picker (#1043 ) to reduce the steps needed for selecting a colour as a workaroud for now.
thekingofcity commented
Any enhancements on the palette picker are welcomed!