Processing-4 IDE Source Code Colours

I’ve been trying the colour features in Processing-4 IDE. It’s better than Processing-3 but not as flexible as I’d like.

You can select a theme (Tools, Theme Selector), and save it. Then you can edit the theme.txt and reload immediately to see the effect. (That part is miles better than P3.)

I’ve tried all the obvious settings in theme.txt and commented them on what they do (or not (for me)).

There are still several parts of the language that won’t change colour. Just to confirm, I changed all the settings to green, then anything not covered by those settings shows in white. This e.g. is what it looks like.

image

There’s a few different items there: variables, operators, brackets. It would look much better if they could be separately coloured. Probably connected to the ‘nothing’ items below. (The Arduino IDE is better in this respect, but it seems the two IDEs have gone their separate ways.)

I’d appreciate it if someone would confirm this or tell me what I’m missing.

# Two sorts of comments
editor.token.comment1.style = #00FF00,plain
editor.token.comment2.style = #00FF00,plain
#
# Nothing/Don't know
editor.token.function1.style   = #B020E0,plain
#
# methods, e.g. format of String.format
editor.token.function2.style   = #0080F0,plain
#
# for and if (but not else)
editor.token.function3.style   = #F09000,plain
#
# Predifined func names e.g. setup, draw, mousePressed
editor.token.function4.style   = #FFFF00,bold
#
# Nothing/Don't know
editor.token.invalid.style     = #666666,bold
#
# void, new, public, import
editor.token.keyword1.style    = #B00080,plain
#
# Nothing/Don't know
editor.token.keyword2.style    = #FF8000,bold
#
# else
editor.token.keyword3.style    = #F09000,plain
#
# width, height
editor.token.keyword4.style    = #80B000,plain
#
# Data types: int, long, String, boolean, ArrayList
editor.token.keyword5.style    = #E06000,plain
#
# this
editor.token.keyword6.style    = #9080E0,plain
#
# Nothing/Don't know
editor.token.label.style       = #666666,bold
#
# Character and string literals e.g. 'A' "Hello"
editor.token.literal1.style    = #00B0B0,plain
#
# Constants: LEFT, RIGHT, CENTER,
editor.token.literal2.style    = #404080,plain
#
# Nothing/Don't know
editor.token.operator.style    = #FF8000,BOLD
#

Hi,

No time to comment now but you can look here the comments above the specific tags for their meaning…

Cheers
— mnse

1 Like

@mnse, Thanks. I’ve looked through those definitions. Some of them agree with what I’ve found, some are for things not in my example code. The most obvious inconsistency is:

  /**
   * Operator token id. This can be used to mark an
   * operator. (eg, SQL mode marks +, -, etc with this
   * token type)
   */
  public static final byte OPERATOR = 16;

And I’ve tried this and the operators are white as in the image above.

editor.token.operator.style = #FFFF00,bold

Another confusion in that source is:

  /** Loop/function-like blocks (for, while, etc.) */
  public static final byte KEYWORD3 = 8;
...
  /** Loop/function-like blocks (for, while, etc.) */
  public static final byte FUNCTION3 = 14;

why this is done that way is also not finally clear to me, but you can at least see it gets applied by some dummy code …

Cheers
— mnse

1 Like

This seems not to be used in java mode by checking the keywords.txt as mentioned …

Operators are without KEYWORDS

PS: Maybe you can open an issue on github to get some syntax highlight issues fixed
Also which came to my mind are

  • try-with-resources, where try not handled correct.
  • multiline text which should be handled as other strings, but isn’t.

fmt2

@mnse. Thanks. In my last I was showing those two items have the same comment, clearly they can’t both be right. ‘if’ and ‘else’ colours are on different items, pointless because you would always want them the same colour. I’ve been trying something similar in Arduino IDE. This is probably not my final colour scheme, but shows that operators, values, vars can be different colours. (Same code as above.)

image

Agreed, an issue on github.