Why is my color not like I have defined?

HippoEDIT style color configuration is VERY flexible but in same time not easy predictable :)

Because of that, “question” like “WTF? Why the color is not like I have defined!??” comes rather often. It is not easy to answer what is the reason of the problem in every concrete case, but below you can find a list of possible reasons that can influence the end color, used by the editor to draw styles:

  1. Style inheritance. Some syntax styles are inherited from parent syntaxes. The inheritance is indicated in round brackets aside to style name in Font & Colors configuration dialog. In this way, if you change the style configuration in child syntax, the change will result in not only current syntax but parent syntax and all other syntaxes inheriting from the parent (owning) syntax. From another side, if you change style settings in parent syntax (in Default, for example), it does not mean, that the change will reflect in all syntaxes because some of the inheriting syntaxes may overwrite the style configuration. You may only notice that by checking leaf/end syntax.
  2. Style layering/stapling. When drawing, HippoEDIT does not use single style but applies all matching styles one on top of other, following defined style priorities. Window style + text style + line style + selection style etc. The layering applies to colors and styles. If a color has defined transparency (alpha > 0%), the resulting color will be a mixture of bottom style color and top style color. If alpha is 0, resulting color is equal to top color. The layering is applied to background and foreground colors separately. Because of such dynamic layering, the result is highly dependent on the document and may differ depending on how many styles were applied.
  3. On top of everything, the editor will apply contrast ratio rules, on final text and background color, and will modify a text color (foreground color) in a way that minimal contrast ratio is ensured.

Why is color different from defined on example below?

  1. Sample preview in configuration dialog tries to predict possible layering and show you the final result of it. It will take window style and apply current style on top, merging colors for background and foreground and considering defined contrast ratio. The sample shows text color which different that one sees in the color drop down. Why?
    Color configuration
  2. Highlight 4 - is referencing color, from current palette.
    Palette Color
    The color has defined 50% of transparency and resulting color will be a mix of window text color and Highlight 4 color.
  3. But if we change style color to explicit one, without transparency, the color is still not like we have defined!
    Explicit color definition
  4. Let us check then Contrast Ratio for current scheme, and change it from default Normal (5:1) to Do not Change.
  5. Finally, we got the desired result :)
    Setting contrast ratio