The right dose of color

Published on

in

Reading time:

2–3 minutes

A typical method to understand source codes faster is syntax highlighting in the editor. A gray uniformity of letters turns into sections that are clearly distinguishable to the human eye, allowing the brain to quickly categorize them into instructions, variables, constants and so on. However, not all highlighting is created equal.

Old code vs. new code

With new code created according to CleanABAP recommendations, highlighting hasn’t actually brought me that much benefit so far. This is because I work there with classes of manageable size which in turn contain methods with a manageable number of lines. Highlighting is an advantage here, but not strictly necessary.

It looks different to me in code that do not follow CleanABAP recommendations. Here, you often find too many lines within a block like a method or a subroutine. Reading that, especially when not all lines can be displayed on one screen, is a challenge.

Out with the standard, in with individuality

The highlighting in the standard delivery of the “ABAP Development Tools for Eclipse” (ADT) did not convince me. I like it subtle to be easy on the eyes.

Fortunately, you can adjust the color settings. How this is done is described in the SAP standard documentation.

For me, the following color settings have currently proven effective in the Dark theme. My goal with this settings is to understand the program flow as well as possible.

  • Control statements that direct the program flow (IF, ELSE, ENDIF, RETURN and more):
    • DarkGoldenrod (184, 134, 11)
  • Instructions that interrupt the program flow (RAISE, RAISE EXCEPTION and more):
    • Salmon (250, 128, 114)
  • Instructions for starting and ending code blocks (METHOD, ENDMETHOD and more):
    • MediumPurple (147, 112, 219), sometimes also MediumAquamarine (102, 205, 170)

The colors are chosen from the Extended Web Colors.

I do not work with highlights such as underlining, italics or bolding.

Nothing is forever

As written above, this is my current setting and it is constantly under review. If there is a better color combination or if further syntax needs to be specifically highlighted, I simply change the settings.

However, in my opinion, one has to be careful not to use too many colors, otherwise the cognitive effort to assign the colors to the respective category increases again.