How to change the color of a variable name?

class Foo: def __init__(self): byte_string = 'newline:\n also newline:\x0a' 

In PyCharm, how do I change the color of variables like "byte_string" in the above example? I see no place to change this in the "Python" section of the color options.

+4
source share
3 answers

Incredibly, it’s true, Pycharm staff replied that it’s not possible to set a custom color for a variable. Please all vote: https://youtrack.jetbrains.com/issue/PY-8246

+6
source

PyCharm 2017.1 has "semantic highlighting." Give it a try.

It looks like this:

semantic emphasis

+2
source

To change the color of the default variables in PyCharm (more precisely, 4.5.3), follow these steps:

  • Open the Settings window.
  • In the left side pane, click node labeled Editor .
  • In the Editor, click node labeled Colors and Fonts , then under node, Default Language .
  • If you are using the default color scheme, click the button labeled Save As , since PyCharm will not allow you to overwrite the built-in color schemes.
  • In the center of the window you will see a list of language elements. Based on your example, it looks like you want to change the appearance of local variables, so select the item labeled Local variable and click on it.

If you also want to change the color of global variables or even all identifiers, simply select the item labeled Global Variables or Identifiers , as appropriate, and follow steps 5-7.

TL DR : Change local colors in Preferences> Editor> Colors and Fonts> Defaults> Local Variable.

+1
source

All Articles