Русские Блоги
Научите настраивать самый красивый интерфейс PyCharm, который должен иметь программист Python!
С появлением искусственного интеллекта / машинного обучения Python как «симпатичный язык» вновь привлек внимание большинства программистов. PyCharm от JetBrains, несомненно, является одной из лучших IDE для Python.
Я собрал очень полный набор информации и учебных пособий для Python, которые вы можете скачать, просто добавьте 943752371
Как говорится в пословице: «Работники хотят сделать все возможное, они должны сначала оттачивать свои инструменты», настройте свою IDE, чтобы она была привлекательной и красивой, это необходимый навык для каждого программиста Python.Эта статья научит вас, как настроить ваш PyCharm более красиво! Определенно более практичный, чем большинство онлайн-уроков!
PyCharm, инструмент разработки Python!
Первый шаг — перейти на темный фон, чтобы защитить зрение.
По умолчанию фон PyCharm — белый, что ослепительно. Лучше поменять на темный, и он чувствует себя круче.
Метод модификации: введите PyCharm, Файл ==> Внешний вид и поведение ==> Внешний вид, найдите тему справа и замените ее на Darcula。
Второй шаг — изменить шрифт и изменить его на лучший.
Метод модификации: введите PyCharm, File ==> Editor ==> Colors & Fonts ===> Шрифт, схема справа может выбрать конфигурацию шрифта, Monokai рекомендуется здесь.НижеPrimary fontЭто определенный используемый шрифт, но он не может быть изменен напрямую. Нужно нажать в правом верхнем углуSava As. , Эквивалентно копированию копии текущей конфигурации шрифта, а затем изменению копии.
щелчокSava As. После этого появится всплывающее окно для подтверждения имени новой конфигурации шрифта, по умолчанию используется копия Monokai, мы просто в порядке.
Скопируйте текущую конфигурацию шрифта
Шаг 3: Изменить размер шрифта и интервал
На основе второго шага мы выбираем шрифт и настраиваем размер шрифта и интервал. Это может быть установлено в соответствии с личными привычками. Мне нравятся большие точки, поэтому размер шрифта составляет 20, а расстояние составляет 1,1
Выберите размер шрифта и интервал
Шаг 4: отрегулируйте цвет
нота! Этот шаг очень важен! Другие онлайн-уроки, только первые три шага! Я думаю, что первые три шага не идеальны, почему?
Посмотрите на картинку ниже, это пример конкретного кода.
При такой конфигурации отдельный текст не может быть ясно виден!
Вы нашли проблему? Комментарии в коде Python серого цвета в этой теме, а ключевые параметры метода — фиолетового цвета. Эти два цвета не ясны на темном фоне! Хотя это не очень серьезно, поскольку его нужно изменить, постарайтесь сделать его как можно более совершенным!
Решение: Файл ==> Редактор ==> Цвета и Шрифты ===> PythonНайдите «Line Comment» на правой панели, вы можете изменить цвет переднего плана в крайнем правом столбце.
Во всплывающем окне выбора цвета вы можете выбрать цвет или напрямую ввести значение цвета. Здесь я выбрал ярко-зеленый.
Измените цвет аннотации, чтобы сделать его более очевидным
Аналогично, цвет параметров ключевых слов можно изменить, изменив цвет «аргумента ключевого слова».
Если у вас есть другие неудовлетворительные цветовые схемы, вы можете использовать этот метод для изменения.
Следующая картинка — финальный эффект, как насчет этого, это красиво? Поторопись!
Colors and fonts
As a developer, you work with a lot of text resources: the source code in the editor, search results, debugger information, console input and output, and so on. Colors and font styles are used to format this text and help you better understand it at a glance.
PyCharm lets you choose between configurable color schemes that define colors and fonts used in IDE text.
You can use a predefined color scheme or customize it to your liking. It is also possible to share schemes.
Select a color scheme
Press Ctrl+Alt+S to open the IDE settings and select Editor | Color Scheme .
Use the Scheme list to select a color scheme.
By default, there are the following predefined color schemes:
Classic Light : designed for the macOS Light and Windows 10 Light interface themes
Darcula : designed for the Darcula interface theme
High contrast : designed for the High contrast interface theme (recommended for users with sight deficiency)
IntelliJ Light : designed for the IntelliJ Light interface theme
If you install a plugin with a color scheme, that scheme will be added to the list of predefined schemes. For more information, see Share color schemes.
Customize a color scheme
You can customize a predefined color scheme, but it is recommended to create a duplicate for your custom color and font settings:
Duplicate a color scheme
Press Ctrl+Alt+S to open the IDE settings and select Editor | Color Scheme .
Select a color scheme, click , and then click Duplicate .
(Optional) To rename your custom scheme, click and select Rename .
Predefined color schemes are listed in bold font. If you customize a predefined color scheme, it will be displayed in blue. To restore a predefined color scheme to default settings, click and select Restore Defaults . You cannot remove predefined color schemes.
To define color and font settings, open the Editor | Color Scheme page of the IDE settings Ctrl+Alt+S . The settings under Editor | Color Scheme are separated into sections. For example, the General section defines basic editor colors, such as the gutter, line numbers, errors, warnings, popups, hints, and so on. The Language Defaults section contains common syntax highlighting settings, which are applied to all supported programming languages by default. In most cases, it is sufficient to configure Language Defaults and make adjustments for specific languages if necessary. To change inherited color settings for an element, clear the Inherit values from checkbox.
Define custom font and color settings for Python
Press Ctrl+Alt+S to open the IDE settings and select Editor | Color Scheme | Python .
Select any code element you want to customize and clear the corresponding Inherit values from checkbox to change inherited color settings for this element; then specify your color and font settings.
For example, you can set a color highlighting for nested functions. From the list of the code elements, select Nested function definitions , clear the Inherit values from checkbox and specify the element foreground and background colors. Click OK to save the changes.
Semantic highlighting
By default, the color scheme defines syntax highlighting for reserved words and other symbols in your source code: operators, keywords, suggestions, string literals, and so on. If you have a function or method with many parameters and local variables, it may be hard to distinguish them from one another at a glance. You can use semantic highlighting to assign a different color to each parameter and local variable.
Enable semantic highlighting
Press Ctrl+Alt+S to open the IDE settings and select Editor | Color Scheme | Language Defaults | Semantic highlighting .
Select the Semantic highlighting checkbox and customize the color ranges if necessary.
This will enable semantic highlighting for all languages that inherit this setting from Language Defaults . To enable it for a specific language instead (for example, Python) go to the Editor | Color Scheme | Python | Semantic highlighting page of the IDE settings Ctrl+Alt+S , clear the Inherit values from checkbox, and select the Semantic highlighting checkbox.
Share color schemes
If you are used to a specific color scheme, you can export it from one installation and import it to another one. You can also share color schemes with other developers.
Export a color scheme as XML
PyCharm can save your color scheme settings as an XML file with the .icls extension. You can then import the file to another installation.
Press Ctrl+Alt+S to open the IDE settings and select Editor | Color Scheme .
From the Scheme list, select a color scheme, click , then click Export and select IntelliJ IDEA color scheme (.icls) .
Specify the name and location of the file and save it.
Export a color scheme as a plugin
The plugin can be uploaded to the plugin repository for others to install. This format has several benefits over an XML file, including metadata, feedback, download statistics, and versioning (when you upload a new version of the plugin, users will be notified about it).
Press Ctrl+Alt+S to open the IDE settings and select Editor | Color Scheme .
From the Scheme list, select a color scheme, click , then click Export and select Color scheme plugin .jar .
In the Create Color Scheme Plugin dialog, specify the version details and vendor information. Then click OK .
When you install a plugin with a color scheme, that scheme will be added to the list of predefined schemes.
Import a color scheme
Press Ctrl+Alt+S to open the IDE settings and select Editor | Color Scheme .
From the Scheme list, select a color scheme, click , then click Import Scheme .
Fonts
To customize the default font used in the editor, open the Editor | Font page of the IDE settings Ctrl+Alt+S . This font is used and inherited in all color schemes by default. For more information, see Font.
PyCharm can use any font that’s available in your operating system. To add another font to the list, either install it in the operating system or into the Java runtime that is used to run PyCharm.
To configure the font used in the PyCharm interface (tool windows, toolbars, menus, and so on), open the IDE settings Ctrl+Alt+S , and go to Appearance & Behavior | Appearance . From the Font list, select a font and specify the font size in the Size field.
Customize the color scheme font
You can set a different font for your current scheme.
This is not recommended if you are planning to share your scheme or use it on other platforms that may not support the selected font. In such cases, use the default global font settings.
Press Ctrl+Alt+S to open the IDE settings and select Editor | Color Scheme | Color Scheme Font .
Select the Use color scheme font instead of the default checkbox.
Customize the console font
By default, text in the console uses the same font as the color scheme. To use a different font in the console:
Press Ctrl+Alt+S to open the IDE settings and select Editor | Color Scheme | Console Font .
Select the Use console font instead of the default checkbox.
Productivity tips
See the color scheme settings for the current symbol
Put the caret at the necessary symbol, press Ctrl+Shift+A , find the Jump to Colors and Fonts action, and execute it.
This will open the relevant color scheme settings for the symbol under the caret.
See which fonts are currently used in the editor
Press Ctrl+Shift+A , find the Show Fonts Used by Editor action, and execute it.
This will open the Fonts Used in Editor dialog with a list of fonts.
Use the quick switcher
Press Ctrl+` or select View | Quick Switch Scheme form the menu.
In the Switch popup, select Editor Color Scheme , and then select the desired color scheme.
Both the Jump to Colors and Fonts and the Show Fonts Used by Editor actions do not have a default shortcut. To assign a shortcut for an action, select it in the Find Action popup and press Alt+Enter .
Как изменить цвет в пайчарме
The interface theme defines the appearance of windows, dialogs, buttons, and all visual elements of the user interface. By default, PyCharm uses the Darcula theme, unless you changed it during the first run.
The interface theme is not the same as the color scheme, which defines the colors, fonts, and syntax-highlight for various text resources: the source code, search results, and so on.
Change the UI theme
In the Settings/Preferences dialog ( Ctrl+Alt+S ), select Appearance & Behavior | Appearance .
Select the UI theme from the Theme list:
IntelliJ Light : Traditional light theme for IntelliJ-based IDEs
macOS Light or Windows 10 Light : OS-specific light theme available as a bundled plugin
Darcula : Default dark theme
High contrast : Theme designed for users with color vision deficiency
Select Sync with OS to let PyCharm detect the current system settings and use the default dark or light theme accordingly.
It is also possible to create your own UI themes for PyCharm and customize the built-in themes. For more information, see IntelliJ Platform SDK Documentation.
You can assign a shortcut to the Theme action, so that you can quickly switch between themes.
Как изменить тему Pycharm
File -> Settings -> Editor -> Color & Fonts general
How to change PyCharm code editor background color?
I would like to change the background color for the PyCharm source code editor. How can I do that?
I am running it under Ubuntu.
4 Answers 4
Providing @Guoliang’s helpful comment as a formal answer, as the accepted answer does not answer the question:
Go to Settings > Editor > Colors & Fonts > General
On the right side, expand Text and select Default text
Modify Background as desired.
In PyCharm 2017/2018/2019+ it is:
Settings > Editor > Color Scheme > General
And then simply expand Text, choose Default text and set the background color on the right.
Another tip on the topic: if you want the selected background color to also be used in all tree views(Project, Structure, etc.) you can use the Color IDE plugin.