What is the light blue syntax highlighting?

On BSE in this answer, IntProperty, FloatProperty, EnumProperty, MyInt, MyFloat and MyEnum are syntax highlighting in light blue.

image of the syntax highlighted code on BSE

And as a supplementary, why isn't the same syntax highlighting used on meta?

  • $\begingroup$ looks like SE has no syntax highlighting on the meta. I guess its its that talking about the site we don't need syntax highlighting that often. $\endgroup$ – David Mar 24 '18 at 13:46

PEP8 style criteria.

Quoting from the Best Practice Style Conventions

For Blender/Python development we have chosen to follow python suggested style guide to avoid mixing styles amongst our own scripts and make it easier to use python scripts from other projects.

Using our style guide for your own scripts makes it easier if you eventually want to contribute them to blender.

This style guide is known as pep8 and can be found here

A brief listing of pep8 criteria.

  • camel caps for class names: MyClass
  • all lower case underscore separated module names: my_module
  • indentation of 4 spaces (no tabs)
  • spaces around operators. 1 + 1, not 1+1
  • only use explicit imports, (no importing *)
  • don’t use single line: if val: body, separate onto 2 lines instead.

The syntax highlighter is using the style, and expects a camel-case name (CamelCase), for instance, MyInt to be a class. Suggest naming it my_int or myint instead.


I'd like to build on @batFINGER's answer.

StackExchange syntax highlighting is handled by Google Code Prettify. Looking at the source code, it appears that Code Prettify has a general set of rules that it enables/disables for languages with C-like syntax, making slight tweaks for individual languages. Python's configuration function is as follows:

      'keywords': PYTHON_KEYWORDS,
      'hashComments': true,
      'multiLineStrings': true,
      'tripleQuotedStrings': true
    }), ['cv', 'py', 'python']);

This tells us that there is no special consideration given for CamelCase, or snake_case, etc. in prettifying Python. So, Code Prettify is not specifically following PEP8 criterion, but rather a more general naming convention. This convention of CamelCase for class names is found in many C style guides, which I would assume Code Prettify is based off of.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .