如何将整个 Xcode IDE 主题化为亮对暗?

在 OSX 上,MacVim 和 Terminal 都可以被主题化为亮对暗。 Xcode 3.2允许使用配色方案对其编辑器进行相同的定制。

然而 ,是否有一种方法可以对它的 UI 面板(“组和文件”)进行同样的操作 左窗格和列表视图顶窗格) ? 如果没有,是否有一个 如何快速打开/关闭两个面板?

86858 次浏览

One possibility for now: System Preferences => Accessibility => Display => Invert Colors.

Note that Apple recently announced at WWDC that Xcode 10 will support "dark mode" as of some time in late 2018.

There is an Xcode project that has a huge collection of themes, both light and dark. My favorite is Moodnight. https://github.com/hdoria/xcode-themes

While you can't adjust the IDE color scheme, you can quickly toggle the navigator, debug area, and utility views with the following commands:

Navigator : ⌘0

Debug Area : ⇧⌘Y

Utility : ⌥⌘0

So, if you set your theme to one with a dark background, you can quickly close/open the lighter portions of the IDE as needed.

You can also change the debug console to have a different background by going into preferences ⌘., then go to Fonts & Colors, then select the Console. Now you can edit its background: enter image description here

Just be sure to edit the font colors of the various input and outputs texts if you choose black. By default all of the input/output fonts are black, only the console prompt is not.

One cool workaround for this is to use a combination of

  1. "Invert Colors" (in System Preferences -> Accessibility -> Display -> Invert Colors OR setting up a "Ctrl-Opt-Cmd-8" shortcut in System Preferences -> Keyboard -> Shortcuts -> Accessibility -> Invert Colors) and
  2. Choosing your favourite dark theme in Xcode's "Fonts & Colors", but inverted (!).

For example, I like a Choco theme from Chocolat app, but I need the functionality of Xcode, so I imported the theme manually by adjusting and enhancing some of the fonts and colors in some Xcode's custom dark theme's duplicate. After I was happy with the final theme, I duplicated it and inverted the colors using one of the websites that can be found in Google (http://www.mattlag.com/scripting/hexcolorinverter.php). And voila! "Ctrl-Opt-Cmd-8" + "Inverted Dark Theme" makes the whole Xcode environment dark and looking great, without the need of hiding any other sections of Xcode like Navigator, Debug and Utilities.

Let me know if this solution helps. I find it a little time consuming, but worth the effort.

p.s.: I've posted the discussed themes on GitHub: https://github.com/Rep0se/xcode-themes

p.p.s: To theme FileMerge tool in Mojave (for now) use this solution in combination with Invert Colors outlined above.

Quick shortcut Tip: To launch preferences, hit "Command" + ","

enter image description here

WWDC 2018 announced that Xcode 10 on macOS 10.14 will finally include native dark mode support. This will be available around Q3 2018. It will be a full dark style from the side menus to storyboards.

I've been digging around lately and I found some kind of "Hack" of DVT Framework myself... Xcode 10 with dark theme is however around the corner, so there will be no need for this hacking anymore... Anyway you can do nice thingies with this such as changing Highlight colors for buttons and plist-file browsers... If you open Xcode with Show Package Contents and browse a bit, you can find this nice file:

/Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources/Default.dvttheme

You can open this either with Visual Studio Code or Atom or any code editor.

From now on, you can do some hacking and change some of the colors in the Xcode IDE:

For example editing the default white to transparent

But somehow, due to nature of Aqua theme/user interface, you cannot change the scrollViews, which is a bit disappointing... When you could, I would already create repo which would have all the craziness of colors for this. If you want, you can change at least plistViewer and the Attributes inspector windows (The properties are called and documented nice in Default.dvttheme

Hope this helps a bit.

edit:

What you could do is to edit the default Aqua theme with ThemeEngine https://github.com/DominikBucher12/ThemeEngine

(Change assets to black/dark) and the Xcode would inherit this Appearance..

You can turn to full dark mode with the new macOS Mojave. Simply go to System settings->General and switch to dark. Enjoy!!!