For quite some time it came to my mind that the colors used for syntax highlighting should be automatically generated by the application, removing the need of forcing the user to manually edit each and every color everytime a new color scheme is chosen for the whole system. In the SpeedCrunch case, there's at least the need of choosing 3 colors for the expression editor syntax highlighting: variables, functions and numerals.
The problem is when the text box background or the text color is not the expected (generally white and black, respectively). So I started playing with some code in order to try to reach an easy and acceptable enough algorithm that could make SpeedCrunch adapt to any text and background color combinations (or at least the most common and wise ones). Certainly, predefined color sets (that also include and overwrite the system background and text colors) shall always be provided, in order to ensure that nobody needs to switch off syntax highlighting.
Let's look at the examples. The surrounding color represents the system base color, used for text input boxes, for instance. The first colored square represents the system text color. The remaining squares are the generated colors for highlighting. If you see no surrounding color, that's because it's white.
KDE / Windows * / MacOs X / BeOS
Solaris
CDE
Digital CDE
Black on light grey
Blue on almost black
Blue on black
Blue on dark blue
Green on black
White on black
White on dark blue
White on light grey
Yellow on blue
All the three squares to the right of each image where generated from the first one from the left and the background color. It seems to me that even in "dummy" color sets like in the last example, the algorithm performs really well. I guess I'll introduce this in SpeedCrunch for 0.10.
Edit: this feature is now in SpeedCrunch's trunk. 0.10 will come with it.
No comments:
Post a Comment