Intellij Ultimate的Java语法突出显示问题

发布于 2025-01-20 12:32:49 字数 458 浏览 3 评论 0原文

当我在Intellij Idea Ultimate中运行文件时,我可以获得仅橙色,绿色和灰色的语法突出显示。是否有任何方法可以获得更多的颜色,用于像VSCODE这样的方法和变量的语法突出显示?

这是我的主题,其中一个黑暗主题:

”在此处输入图像说明“

我希望主题就像:

“在此处输入图像说明”

When I run the files in IntelliJ IDEA Ultimate, I can getting improper syntax highlighting of only orange, green, and gray. Is there any way to get more colors for syntax highlighting for methods and variables like VSCode does?

This is my theme with One Dark Theme:

enter image description here

I want the theme to be like:

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

天荒地未老 2025-01-27 12:32:49

主题

我建议使用 Atom One Dark 作为主题。它真的很丰富多彩,所以更容易集中注意力(至少对我来说)。你应该尝试一下。

重新格式化

有一个关于重新格式化的设置。你应该尝试一下。您可以使用 CTRL+SHIFT+ALT+L 访问它。

Theme

I would suggest using Atom One Dark as a theme. It's really colorful, so it makes easier to focus on (at least for me). You should give it a try.

Reformatting

There is a setting about reformatting. You should try it. You can access it with CTRL+SHIFT+ALT+L.

伴我心暖 2025-01-27 12:32:49

您可以在 Intellij IDEA 中自定义现有方案的语法着色:

  • ctrl-alt-S 打开设置 屏幕,然后从方案下拉列表中选择要修改的方案。我选择了经典光
  • 导航至编辑器>配色方案>语言默认值,或编辑器>配色方案> Java 如果您想将自定义限制为仅 Java 源。
  • 选择您要在主要类别(即注释标识符等)下修改颜色的语言功能。 )。例如,要修改花括号的颜色,请选择“大括号和运算符”,然后选择“括号”。
  • 如果显示并选中继承值复选框,请取消选中它以启用自定义。然后选中前景复选框,单击右侧的颜色字段并选择您选择的颜色,然后单击应用确定以实施您的更改。

请参阅下面的一些 Java 源代码的语法着色,在颜色自定义之前和之后,显示了诸如深粉色斜体字符串文字、浅蓝色花括号、紫色圆括号、橙色类名称、金色 Java 关键字和浅绿色注释等变化。

默认颜色:

默认着色

修改后语法着色:

修改后着色

注意:

  • 我所做的丑陋的更改只是为了演示方法,但所需的更改问题屏幕截图中显示的内容应该很容易实现。

  • 为字符串文字选择斜体会产生意想不到的副作用。字符“ᚙ”的显示已更改,因为没有相当于渲染的斜体。

  • 如果你把事情搞砸了,你可以轻松地恢复到默认值。单击方案名称旁边的设置齿轮,然后从弹出菜单中选择恢复默认值

    “恢复菜单项”"

  • 此方法的一个令人失望的限制是所有 Java 关键字都必须是相同的颜色。这就是为什么导入public抛出char new 在上面的 Java 源屏幕截图中都具有相同的颜色。

  • 如果您想保留或共享自定义内容,可以将其导出。单击设置齿轮时显示的上下文菜单中选择导出。还有一个导入方案选项。

  • 请参阅 Intellij 中的颜色和字体 IDEA 文档以获取更多信息。

You can customize the syntax coloring of an existing Scheme within Intellij IDEA:

  • Press ctrl-alt-S to open the Settings screen, then select the scheme you want to modify from the Scheme drop list. I chose Classic Light.
  • Navigate to Editor > Color Scheme > Language Defaults, or Editor > Color Scheme > Java if you want to restrict your customization to Java source only.
  • Select the language feature for which you want to modify the color(s) under the main categories (i.e. Classes, Comments, Identifiers, etc.). For example, to modify the color for curly braces select Braces and Operators, then Parentheses.
  • If the Inherit values from checkbox is displayed and checked, uncheck it to enable customization. Then check the foreground checkbox, click the color field to its right and select a color of your choice, then click Apply, OK to implement your change.

See below for the syntax coloring of some Java source, before and after color customization, showing changes such as dark pink italicized string literals, light blue curly braces, purple round brackets, orange class names, gold Java keywords and light green comments.

Default coloring:

Default coloring

Syntax coloring after modification:

coloring after modification

Notes:

  • The ugly changes I made were just for demonstrating the approach, but the required changes shown in the question's screen shot should be straightforward to achieve.

  • Selecting italicization for string literals had an unintended side effect. The display of the character 'ᚙ' was changed because there was no italic equivalent to render.

  • If you mess things up completely, you can easily revert to the defaults. Click the settings cog wheel next to your Scheme name and select Restore Defaults from the popup menu:

    Restore menu entry

  • A disappointing limitation with this approach is that all Java keywords must be the same color. That's why import and package and public and throws and char and new all have the same color in the Java source screen shot above.

  • You can export your customization if you want to preserve or share it. Select Export from the context menu shown when you click the settings cog wheel. There is also an Import Scheme option.

  • See Colors and Fonts in the Intellij IDEA documentation for more information.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文