Effective PyCharm (2021 edition) Transcripts
Chapter: The Editor
Lecture: Syntax highlighting
0:00 One of the very first things you're sure to notice when you're working with PyCharm
0:03 is it has great syntax highlighting.
0:06 Here's an example from one of the jumpstart examples that we were playing with earlier,
0:11 here's the game loop for that wizard app and notice we've got coloration for strings,
0:16 for numbers, for key words like death and wild and true,
0:22 all sorts of stuff jump out with color to help us understand our code really,
0:27 really well. Of course it would be no surprise that this is highly customizable.
0:32 First of off, there's a bunch of themes you can pick by default,
0:37 maybe you have the Mac Os light theme or you've got a Windows theme.
0:41 Notice it can sync with the OS,
0:43 so like Mac OS will be light themed in the day and dark theme at night
0:47 it can do that kind of stuff if you check that box,
0:50 but if you choose another theme,
0:53 the one that I'm using this course is called darcula.
0:56 The darker one on the left,
0:57 I just love the way that the lower contrast color is kind of let me sink
1:02 into the code, It doesn't feel so bright and overwhelming.
1:04 But if you want a bright white,
1:06 you can choose the Mac Os light or your Os light as well and get these
1:11 colors. So here's a coarse grained way to control what the syntax highlighting it looks
1:16 like and the general colours overall.
1:19 But if you go into your settings,
1:21 you can create your own themes.
1:23 Notice this one is called my darcula rather than dracula because I've changed how some
1:28 of the things look now, notice on the left there's color scheme and you can
1:33 change all the different languages. So here we've got version control colours,
1:37 python colours, angular template colors,
1:40 all kinds of things. And then once you go into a particular area like python
1:45 you can go and select different areas.
1:48 For example, class definition method calls keywords and so on and it shows you an
1:53 example of the bottom and what's not obvious but it's really awesome is you can click
1:57 those for example, if you click class it will automatically select keyword.
2:02 If you click fu it'll reflect something like class definition,
2:06 click on the string, it'll go and highlight that and then let you control it
2:10 And then on the right,
2:11 see where it says foreground. It has F1EC33,
2:15 that yellow color. If you click the yellow color,
2:17 a color wheel will come up and you can select it and customize it and see
2:21 it change live below. So really,
2:23 really nice to be able to fine tune this.
2:26 One of the areas I find is if I'm doing like a conference presentation or something
2:30 and one of the colors, especially sometimes the purples and reds don't show up well
2:35 on the projector are over a cut down quality screen share and like on zoom or
2:40 something. So you can change just those things so they come through a little bit
2:45 better and then once you get these all configured,
2:47 there's that gear in the top,
2:48 right by where it says my darcula.
2:51 If you click on that, you can export it and share it and save it
2:54 and so on. You can go from just taking the default to choosing a theme
2:58 to go in deep within and creating your own theme by tweaking an existing one like this.