I've recently started using PyCharm and it's autosave system is very confusing to me. Colorful tabs are even more confusing: what do the different tab color mean? There're tabs with blue text, black and red. What's the difference?
Please refer to the File Status Highlights. Tab background color can be also different depending on the Scope.
Related
I have a text editor I'm working on. Using PyCharm. I have line number support (many thanks to Bryan Oakley!) and python syntax highlighting using IDLE Perculator. It works but some of the highlight code is hard to read. Oh yes, using tkinter for GUI support.
Can anyone point me at how to set the colors in IDLE? I use options-configure IDLE and some of the changes work in my project and some don't. For example, disabling the colors in my find funcion in the editor doesn't use the 'found' attribute when I alter the 'found' highlight colors. It only highlights what is found when I set the foreground and background colors.
I would prefer to edit a file so I know what it is highlighting, such as comments, strings, keywords, etc.
The IDLE Perculator works better than all of the highlight code I tested.
Just been trying to work out how to set the highlight colors to what I want. Either light or dark themes.
Found basic doc. for IDLE but nothing on how to figure out what is what. Only some settings take effect.
I found all of the idlelib source in the appdata folders and put it into my project folder. I know can set the backgrounds in the IDLE shell for the various keywords etc. Looks ok for a dark theme now. When I run or compile I get the colors I set in the IDE in my text (editor) widget. I still have to set the default text colors in my app. When I don't, I get black text on white background which looks terrible in the dark theme.
So a little more work...
Is there a way to remove the green highlighting in the doctest in PyCharm?
Or am I doing something wrong in the first place? And that is the reason why the code is highlighted?
am I doing something wrong and that is the reason why the code is highlighted?
The green background is the default syntax highlight PyCharm uses for doctests. So no, there's nothing wrong its purpose is to help differentiate from the surrounding code.
Is there a way to remove the green highlighting in the doctest in PyCharm?
Yes. You can remove the background color by going to File > Settings > Editor > Color Scheme > General > Code > Injected language fragment and changing the Background value as shown in the screenshot.
VSCode has syntax highlighting for the Python language. I can't find any explanation for how each token is classified and organized into colors.
Specifically, why are some keywords the same color, but some are different?
Looking at this code:
for...in shows the keywords as the same color, but if...in shows the keywords as different colors. Why does in change color? What determines if a keyword is purple or blue or something else?
Finally, is there an exhaustive list or chart for how keywords are organized?
The color of the code in VSCode is provided by the theme. (VSCode uses its own theme by default.) Reference: syntax-highlighting-optimizations and theme color.
Using different themes can make the code display different colors. You could also set the color of custom code. Reference: Customizing a Color Theme.
They are not the same in. The first is used to iterate while the second is an operator.
From the first link in #JillCheng's answer I found the Scope Inspector, which can be enabled by running Developer: Inspect Editor Tokens and Scopes in the command palette. This will then show how the currently selected text was tokenized.
for...in shows both keywords are tokenized as keyword.control.flow.python.
if...in shows if as keyword.control.flow.python and in as keyword.operator.logical.python.
Note: This answer was originally posted as part of the question.
Is there some way to make some words in a Python 3 input get a different color than the default one of the terminal? Like this one:
log 'Hello World'
The word "log" became blue and the string "'Hello World'" became green.
I am answering on the assumption that blue and green, for instance, are something that does not happen now but are something you would like to make happen.
If you are entering code in a system console, such as Command Prompt on Windows or Terminal on Mac and maybe some *nixes, you are unlikely to be able to get Python syntax coloring. The console would have to be able to partially parse Python syntax.
If you are entering code in a code editor that support syntax highlighting and that can parse Python code, then you can get some coloring. Some but not necessarily all will support user customization of colors.
IDLE divides Python code into multiple categories and offers both light and dark background schemes. Users can start with either and change the default colors. In your example, "log" and "'hello'" would be 'normal' and 'string' text. In the built-in themes, normal text is either black (on white) or white (on dark blue) while strings are green. The latter is likely why someone asked whether you are using IDLE. You could make a theme in which normal text is a blue that contrasts with the background.
Is it possible to change background color of the Python Shell from white to black for example. I did find how to change text color, but can't figure out how to change background color. I'm running it under the Windows. Any suggestions?
if you are refereeing to IDLE i did this simple steps from this link
(its for ubuntu but worked in windows as well)
http://ubuntuforums.org/showthread.php?t=657799
and if you are talking about the windows Prompt , you can use the color command or just right click & select properties & edit the color settings
Right-click the upper-left corner of the Python console window and select Properties.
In the dialog box that appears, pick the tab labeled Colors. On it you can set the screen background and text color.
If you are reffering to the window idle for example for version 2.6 there is now way to change the background color from withe to another one. But you can change the background color of your text if you go to options.
Another thing you can do is to use other gui for python which could be more elaborated such as eclipse pydev or to use a text editor you like and configure it the way you want to write your scripts and then run them into the idle.
just go through simple steps
- go to options
- configure IDLE
- highlighting
- then select background and click on choose color for:
- you can change the color to any color but becareful if u change only the background color the foreground color may not be visible because they both might be black
Enjoy
You can,,go to options then configure IDE, then on the settings window select highlights, on the rightside press the button below a builtin theme, then choose your choice theme