Syntax Highlighting Style Priorities
When editor draws text, it merges (layers) different styles applied to text to get resulted style of the text block to draw (text color, back color, italic/bold/…, hot-spot etc). All styles stapled into a stack and then merged with each other from bottom to top.
The following rules are used for merging:
- Font properties (italic/bold/strikeout/underline), Style properties (text/overview/hotspot) are merged as 3 state variables (on/off/undefined). If a top property is not “undefined” it will overwrite property of bottom style. If a top property is undefined, the property style of resulting (merged) style will be equal to the state of the bottom property
- Color properties (foreground and background, underline and box colors) are merged using alpha values of the corresponding color property. If alpha of the top style 100% color of the resulting style will be equal to the color of the bottom style. If alpha of the top stale 0% color of the resulting style will be equal to top color. If alpha is 50%, the color of resulting style will be equal to color mixture of the top and bottom style colors. Changing of the alpha value you can influence resulting color.
The following layering priorities are considered, when stapling styles:
- Window color or Read-Only color
- Embedded syntax color
- Inactive Code style
- Nesting color
- User text highlighting + text explicit highlighting from plugins
- Syntax driven styles (keywords, comments, strings etc)
- White space style
- Trailing white space
- Colored braces
- Search, Current Scope and Smart Highlighting
- Plugin text block highlighting
- Text Selection
- Alternated line style
- Protected areas line style
- Bookmark line style
- Breakpoint line style
- Current line style
- Execution line style
- Error line style