fesch / Structorizer.Desktop

Structorizer is a little tool which you can use to create Nassi-Schneiderman Diagrams (NSD).
https://structorizer.fisch.lu
GNU General Public License v3.0
65 stars 20 forks source link

GUI: Code preview is white on grey #966

Closed laalsaas closed 3 years ago

laalsaas commented 3 years ago

If you set look and feel to GTK+ and use a dark theme e.g. "breeze dark", the code preview font has the theme color: white and the background of the code preview still uses the same Blueish grey. This way, you can barely see the code. I think it would be best do set the background color of the code preview also from the GTk-theme Screenshot_20210308_150215

codemanyak commented 3 years ago

Thanks for the hint. It is not really easy to have all the possible look and feel themes in mind all the time for all possible platforms, in particular, as some of them, especially Nimbus, work with unbelievable tweaks around the Swing standard mechanisms. We will have a look into it. As a temporary workaround, please just choose another look and feel in Structorizer.

codemanyak commented 3 years ago

Just an explanation: The decision not to use the standard background colour was made because with most of the light themes, the code preview would have been fully ablaze next to the diagram, competing with it for the user's attention, which was considered inconvenient, too. We will find a solution that ensures enough contrast between text and "paper".

codemanyak commented 3 years ago

The same problem applies to the Arranger index, and even the element editor is hard to use because the caret symbol is black on very dark gray: grafik For these effects Structorizer can hardly be blamed - we use standard behaviour of JTextArea and JTree here! This looks rather as if the coordination between GTK+ theme and Java Swing wouldn't work in an optimal way. As already mentioned: Many look and feels use bypasses. So is it actually the task of the application to compensate this? Our code already contains several workarounds for nasty look and feels. I hesitate to add even more of them.

codemanyak commented 3 years ago

It gets even more funny: Two instances of Structorizer in the same process behave differently (see red and green box): grafik

codemanyak commented 3 years ago

Just some remarks (to be continued):

codemanyak commented 3 years ago

After having installed a fresh Debian 10, it wasn't so mysterious anymore (and the toolbar layout looks normal again, the icon artefacts being still ugly, though) and the solution for the L&F change notification turned out easier than expected. The problem of the highlighting remains — see screenshot: grafik

I see three possible solutions:

  1. We dim down all highlight colours (selection, execution etc.). Disadvantage: the highlighting in the diagram and the code would no longer correspond.
  2. The text colour in the highlighted regions would have to be inverted — impossible with a JTextArea (text colour always affects the entire text); so we would have to replace it by e.g. a TextPane, which makes the handling more complex.
  3. We set the usual colours for text and background (i.e. black on light gray), no matter, what the theme defaults are.

I will try approach 2 and have workaround 3 as fallback in mind.

codemanyak commented 3 years ago

Well, approch 3 yields the best ratio between effect and effort for the code preview and will be implemented with version 3.31-03: grafik

In other related cases (like Find & Replace, see screenshot below) we may just dim the highlight colours instead. grafik

codemanyak commented 3 years ago

In case of a dark theme the inactive highlighting in Find&Replace will just be gray (instead of yellow), the emphasized highlighting remains orange: grafik

In Translator, the highlighting colours already provide enough contrast for readability with a dark theme, no adptations necessary. The Executor output window has always had a black background, so there all is fine as well.

codemanyak commented 3 years ago

Most of the untidy icons have now been revised such that they are functional in dark L&F theme. This included some slight colour modifications or sets of alternative icons for dark themes (like the snap mode icons in the Turtleizer status bar): grafik

On this occasion I became aware that there is no dark standard L&F for Swing that would step in on a Windows platform, which happens to be run in dark color mode. A possible solution might be to integrate a free product like FlatLaf by FormDev GmbH (which is known for its JFormDesigner). Then Structorizer could always offer two dark (and two additional light) Look and Feels. The price for this "fashion service" would be a size increase by about half a MiB: grafik