Change cursor color in sublime text

sublime-text-2

Im trying to change the cursor color in sublime text. Im running windows in a VM on my mac.

In Preferences.sublime-settings ive added the following but it hasn't done anything:

// Change caret colour? 
"caret_color": "#FF0000",

"caret": "#FF0000",

This is similar to this question but the answer there doenst work for me: Change the color of the cursor in Sublime Text

Best Answer

The caret color is defined in the color scheme you are using. Since you have Sublime Text 2, changing the color scheme is quite straightforward. First, open your user preferences and check the value of "color_scheme" to get the path to the scheme you're using. If you haven't set it there, the default value is Packages/Color Scheme - Default/Monokai.tmTheme. Next, select Preferences -> Browse Packages... to open the Packages folder in your file system explorer. Browse to the location of the color scheme and open the corresponding .tmTheme file in Sublime, using XML as the syntax highlighting. Near the top of the file, you'll see something like the following (taken from the Neon Color Scheme):

<key>name</key>
<string>Neon</string>
<key>settings</key>
<array>
    <dict>
        <key>settings</key>
        <dict>
            <key>activeGuide</key>
            <string>#FF0080</string>
            <key>background</key>
            <string>#000000</string>
            <key>caret</key>
            <string>#FFFFFF</string>
            <key>findHighlight</key>
            <string>#F2FF06</string>
            <key>findHighlightForeground</key>
            <string>#1515FF</string>
            <key>foreground</key>
            <string>#FFFFFF</string>
            <key>guide</key>
            <string>#6F6F6F</string>
            <key>inactiveSelection</key>
            <string>#353576</string>
            <key>invisibles</key>
            <string>#06FF05</string>
            <key>lineHighlight</key>
            <string>#2D2D2D</string>
            <key>searchHighlight</key>
            <string>#0205FF</string>
            <key>selection</key>
            <string>#0205FF</string>
            <key>selectionBorder</key>
            <string>#06FF05</string>
            <key>stackGuide</key>
            <string>#06FF05</string>
        </dict>
    </dict>

Find the caret key:

<key>caret</key>
<string>#FFFFFF</string>

and change its value to whatever hex color code you want. If there is no caret key, you can add it.

Once you're done, save the file. Go back to your file explorer and delete the color scheme's .tmTheme.cache file if it exists. Restart Sublime, and your changes should take effect.

Related Question