5 ms·
Seems interesting they chose to limit it to a maximum of 6 colors. Is there some technical reason for that? I'm currently using "Bracket Pair Colorizer" with 8
by iaml 5y ago
Seems interesting they chose to limit it to a maximum of 6 colors. Is there some technical reason for that? I'm currently using "Bracket Pair Colorizer" with 8 colors and even with that I can remember a couple places where I've seen this limit got exceeded and coloring started from beginning.
- svat 5y ago> Seems interesting they chose to limit it to a maximum of 6 colors. Where do you see this? The article talks about nesting levels being bounded by O(log N) levels where N is the length of the document, and from what I can tell this is just for analysis and it supports arbitrary nesting levels… Oh, is your question about the actual colours used for the brackets, i.e. arbitrary levels of matching are supported, but the colours repeat every 6 levels (e.g. brackets at levels i and i+6 have the same colour)? If so this is a UX choice (I can't see any technical reason) and I imagine the considerations might be something like: - There are only finitely many colours that can be usefully distinguished visually by the average person, so we need to pick some limit L, - The limit L needs to be small enough that all L colours are easily distinguishable and memorable, but large enough that it would never be confusing whether a certain coloured bracket is at nesting level i or i ± L. I guess the thinking may have been that 6 is large enough typically, e.g. it's likely to be clear from context whether a certain bracket (say blue) is at (say) level 2 or level 8.
- Gehinnn 5y agoIf there is demand, please file an issue and we can discuss increasing this limit. However, these colors are themeable and thus there can only be finitely many. There is no technical reason for this limit of 6.
- iaml 5y agoI see, I'll definitely make one.
- iaml 5y agoIt's in the release notes [0]. > All colors are themeable and up to six colors can be configured. [0] https://code.visualstudio.com/updates/v1_60#_high-performance-bracket-pair-colorization https://code.visualstudio.com/updates/v1_60#_high-performanc...
- hoseja 5y agoThere's actually not that many simultaneously distinct and pleasing colors in RGB.
- iaml 5y agoTrue, it's hard to make a decent theme for this purpose. I've made a tool [0] to help me with that using d3's chromatic scales. [0] https://iaml.gitlab.io/utils/BracketTheme https://iaml.gitlab.io/utils/BracketTheme