It may not be very popular within the development communities, but yes, like many (if not all) IDEs, Xcode also allows you to customize the theme.

What is a Theme

Speaking specifically for Xcode, a theme is a .xccolortheme file that is internally XML-formatted and uses plist to define the values for each key.

I show you an example below.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
 <key>DVTConsoleDebuggerInputTextColor</key>
 <string>0.65098 0.698039 0.752941 1</string>
 <key>DVTConsoleDebuggerInputTextFont</key>
 <string>FiraCode-Medium - 11.0</string>
 <key>DVTConsoleDebuggerOutputTextColor</key>
 <string>0.65098 0.698039 0.752941 1</string>
 <key>DVTConsoleDebuggerOutputTextFont</key>
 <string>FiraCode-Medium - 11.0</string>

 <!--Many many more key-values...-->

</dict>
</plist>

We could manually create this file and assign each value, of course, it is possible, tedious and fortunately, Xcode makes it just a little easier for us.

honest_work.jpeg

Themes Screen

In Xcode we can select one from a small list of its built-in themes, then I will show you how to access this screen

xcode_preferences.png

  1. We open Xcode
  2. In the menu bar we click on Xcode
  3. We click on Preferences

    💡 We can replace step 2 and 3 using the shortcut ⌘ + ,

    themes_screen

  4. (1) From the options at the top we select Themes.
  5. (2) On your left side you can see the built-in themes of Xcode

    💡 If you create a new theme, it will also appear in this list.

  6. (3) To the right of the themes you can see each type of text that is displayed in the source editor

    💡 You can even modify the built-in themes if you wish..

  7. (4) Since Xcode also has a console view, it includes its texts and you can see them by selecting this option.
  8. (5) Here you can change the font style, size, and color, as well as the space and general colors of both the text and the background, selection, cursor, etc.

Creating a new theme

new_theme_dropdown

  1. We click on the + button.
    1. A dropdown will open that will allow us to create a theme based on a template, the template is based on the built-in themes that Xcode has, so if you already like one, let’s start with that one.

    reusable_code.jpeg

    edit_new_theme

  2. We assign a new name to our theme
  3. We edit each different type of text from our source editor and console to our liking

Using an existing theme

As you could see in the previous point, we can create our themes, and just as we can create them, there are people in the community who help us by sharing theirs.

  1. To add a new theme first of all we need the theme file.

    👀 do you remember the file type? - that’s right!, this must be a .xccolortheme

  2. Open Finder

    go_to_folder

  3. In the Finder menu bar click on Go
  4. Click on Go to folder

    💡 You can replace step 3 and 4 using the shortcut ⌘ + ⇧ + G

    themes_path

  5. We headed to the next path

     ~/Library/Developer/Xcode/UserData/FontAndColorThemes/
    

    ⚠️ If the UserData and/or FontAndColorThemes folders do not exist, you can create them manually without any problem

    drag_drop_theme.gif

  6. Drag and drop the theme to this folder.
  7. Open Xcode and select your new theme.

    ⚠️ If you had Xcode open, you may need to restart it to see the theme changes

And that’s all you need to do 👍

Bonus (One Dark Theme)

we_re_not_done_yet.jpeg

If you made it this far, let me share a theme that I like, to begin with, I am from that group that prefers dark themes.

dark_mode_user

Atom has a very popular theme within the community, this theme is not from my source but it is practically the one shared by Bojan Dimovski.

One Dark demo
One Dark (preview)

This is how our theme will look and you can download it from here

⚫️ One Dark Theme (for Xcode)

Inside you will find its series of installation steps, this theme uses Fira Code as its main font so you will have to download it too.

How to install (easily)

  1. Open your terminal.
  2. Go to the path where you want to download the repo (ex. Desktop).

     cd Desktop
    
  3. Clone the repository.

     git clone https://github.com/SwiftyJourney/OneDarkTheme.git
    
  4. Go into the downloaded repo folder.

     cd OneDarkTheme
    
  5. Run the package.

     swift run
    

    🥳 You will not need to manually download the font

  6. (Optional) Delete the repository folder (it is not needed anymore).

     cd ..
     rm -rf OneDarkTheme
    
  7. Don’t forget to apply the theme in Xcode.
  8. Enjoy it (or customize it too).

Conclusion

Xcode topics may not be a very broad topic of conversation, but there are quite a few good ones in the community, normally Xcode would be your day-to-day IDE whether this is your hobby or part of the work day, then what better power than improve its visualization for you.

I hope this article helps you, I’ll appreciate it if you can share it and #HappyCoding👨‍💻.