Search code examples
sublimetext3color-scheme

How do I change the class-methods color in Sublime Text 3 - Twilight theme?


I am using Sublime Text 3, build 3114. It's the latest version available today. Before installing this update, my methods were highlighted in a white color when using the pre-installed theme Twilight.

After installing this latest update, they took the same color as the object: $object->myMethod();. Basically, "myMethod" has the same color as "$object" while before this update, the method had the same color as the parentheses "()". I tried to copy the Default Color Scheme of a previous version of Sublime Text 3 using Twilight but nothing, the color of the method won't change. Here is a screen shot of how the line looks like:

methods color scheme

I'd like to restore the original color for myMethod which was the same as the parentheses and semi-colon. I've been trying for weeks to edit the Default Color Scheme by using the PackageResourceViewer but I had no luck at all.

My eyes are fine with the color #7587A6 for the objects/variables but not for the functions or the methods which have the same color right now. I'd like to have functions and methods with color #F8F8F8 which is the one used by the curly brackets, the parentheses and the punctuation symbols "(), [], {}, ., ;....".

Just to be precise, this is my current default color scheme for the theme I'm using which is Twilight.tmTheme:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>author</key>
    <string>Michael Sheets</string>
    <key>name</key>
    <string>Twilight</string>
    <key>settings</key>
    <array>
        <dict>
            <key>settings</key>
            <dict>
                <key>background</key>
                <string>#141414</string>
                <key>caret</key>
                <string>#A7A7A7</string>
                <key>foreground</key>
                <string>#F8F8F8</string>
                <key>invisibles</key>
                <string>#FFFFFF40</string>
                <key>lineHighlight</key>
                <string>#FFFFFF08</string>
                <key>selection</key>
                <string>#DDF0FF33</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>Comment</string>
            <key>scope</key>
            <string>comment</string>
            <key>settings</key>
            <dict>
                <key>fontStyle</key>
                <string>italic</string>
                <key>foreground</key>
                <string>#5F5A60</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>Constant</string>
            <key>scope</key>
            <string>constant</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#CF6A4C</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>Entity</string>
            <key>scope</key>
            <string>entity</string>
            <key>settings</key>
            <dict>
                <key>fontStyle</key>
                <string></string>
                <key>foreground</key>
                <string>#9B703F</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>Keyword</string>
            <key>scope</key>
            <string>keyword</string>
            <key>settings</key>
            <dict>
                <key>fontStyle</key>
                <string></string>
                <key>foreground</key>
                <string>#CDA869</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>Storage</string>
            <key>scope</key>
            <string>storage</string>
            <key>settings</key>
            <dict>
                <key>fontStyle</key>
                <string></string>
                <key>foreground</key>
                <string>#F9EE98</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>String</string>
            <key>scope</key>
            <string>string</string>
            <key>settings</key>
            <dict>
                <key>fontStyle</key>
                <string></string>
                <key>foreground</key>
                <string>#8F9D6A</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>Support</string>
            <key>scope</key>
            <string>support</string>
            <key>settings</key>
            <dict>
                <key>fontStyle</key>
                <string></string>
                <key>foreground</key>
                <string>#9B859D</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>Variable</string>
            <key>scope</key>
            <string>variable</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#7587A6</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>Invalid – Deprecated</string>
            <key>scope</key>
            <string>invalid.deprecated</string>
            <key>settings</key>
            <dict>
                <key>fontStyle</key>
                <string>italic underline</string>
                <key>foreground</key>
                <string>#D2A8A1</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>Invalid – Illegal</string>
            <key>scope</key>
            <string>invalid.illegal</string>
            <key>settings</key>
            <dict>
                <key>background</key>
                <string>#562D56BF</string>
                <key>foreground</key>
                <string>#F8F8F8</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>-----------------------------------</string>
            <key>settings</key>
            <dict/>
        </dict>
        <dict>
            <key>name</key>
            <string>♦ Embedded Source</string>
            <key>scope</key>
            <string>text source</string>
            <key>settings</key>
            <dict>
                <key>background</key>
                <string>#B0B3BA14</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>♦ Embedded Source (Bright)</string>
            <key>scope</key>
            <string>text.html.ruby source</string>
            <key>settings</key>
            <dict>
                <key>background</key>
                <string>#B1B3BA21</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>♦ Entity inherited-class</string>
            <key>scope</key>
            <string>entity.other.inherited-class</string>
            <key>settings</key>
            <dict>
                <key>fontStyle</key>
                <string>italic</string>
                <key>foreground</key>
                <string>#9B5C2E</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>♦ String embedded-source</string>
            <key>scope</key>
            <string>string source</string>
            <key>settings</key>
            <dict>
                <key>fontStyle</key>
                <string></string>
                <key>foreground</key>
                <string>#DAEFA3</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>♦ String constant</string>
            <key>scope</key>
            <string>string constant</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#DDF2A4</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>♦ String.regexp</string>
            <key>scope</key>
            <string>string.regexp</string>
            <key>settings</key>
            <dict>
                <key>fontStyle</key>
                <string></string>
                <key>foreground</key>
                <string>#E9C062</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>♦ String.regexp.«special»</string>
            <key>scope</key>
            <string>string.regexp constant.character.escape, string.regexp source.ruby.embedded, string.regexp string.regexp.arbitrary-repitition</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#CF7D34</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>♦ String variable</string>
            <key>scope</key>
            <string>string variable</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#8A9A95</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>♦ Support.function</string>
            <key>scope</key>
            <string>support.function</string>
            <key>settings</key>
            <dict>
                <key>fontStyle</key>
                <string></string>
                <key>foreground</key>
                <string>#DAD085</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>♦ Support.constant</string>
            <key>scope</key>
            <string>support.constant</string>
            <key>settings</key>
            <dict>
                <key>fontStyle</key>
                <string></string>
                <key>foreground</key>
                <string>#CF6A4C</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>c C/C++ Preprocessor Line</string>
            <key>scope</key>
            <string>meta.preprocessor.c</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#8996A8</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>c C/C++ Preprocessor Directive</string>
            <key>scope</key>
            <string>meta.preprocessor.c keyword</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#AFC4DB</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>✘ Doctype/XML Processing</string>
            <key>scope</key>
            <string>meta.tag.sgml.doctype, meta.tag.sgml.doctype entity, meta.tag.sgml.doctype string, meta.tag.preprocessor.xml, meta.tag.preprocessor.xml entity, meta.tag.preprocessor.xml string</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#494949</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>✘ Meta.tag.«all»</string>
            <key>scope</key>
            <string>declaration.tag, declaration.tag entity, meta.tag, meta.tag entity</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#AC885B</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>✘ Meta.tag.inline</string>
            <key>scope</key>
            <string>declaration.tag.inline, declaration.tag.inline entity, source entity.name.tag, source entity.other.attribute-name, meta.tag.inline, meta.tag.inline entity</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#E0C589</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>§ css tag-name</string>
            <key>scope</key>
            <string>meta.selector.css entity.name.tag</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#CDA869</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>§ css:pseudo-class</string>
            <key>scope</key>
            <string>meta.selector.css entity.other.attribute-name.tag.pseudo-class</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#8F9D6A</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>§ css#id</string>
            <key>scope</key>
            <string>meta.selector.css entity.other.attribute-name.id</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#8B98AB</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>§ css.class</string>
            <key>scope</key>
            <string>meta.selector.css entity.other.attribute-name.class</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#9B703F</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>§ css property-name:</string>
            <key>scope</key>
            <string>support.type.property-name.css</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#C5AF75</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>§ css property-value;</string>
            <key>scope</key>
            <string>meta.property-group support.constant.property-value.css, meta.property-value support.constant.property-value.css</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#F9EE98</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>§ css @at-rule</string>
            <key>scope</key>
            <string>meta.preprocessor.at-rule keyword.control.at-rule</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#8693A5</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>§ css additional-constants</string>
            <key>scope</key>
            <string>meta.property-value support.constant.named-color.css, meta.property-value constant</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#CA7840</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>§ css constructor.argument</string>
            <key>scope</key>
            <string>meta.constructor.argument.css</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#8F9D6A</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>⎇ diff.header</string>
            <key>scope</key>
            <string>meta.diff, meta.diff.header, meta.separator</string>
            <key>settings</key>
            <dict>
                <key>background</key>
                <string>#0E2231</string>
                <key>fontStyle</key>
                <string>italic</string>
                <key>foreground</key>
                <string>#F8F8F8</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>⎇ diff.deleted</string>
            <key>scope</key>
            <string>markup.deleted</string>
            <key>settings</key>
            <dict>
                <key>background</key>
                <string>#420E09</string>
                <key>foreground</key>
                <string>#F8F8F8</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>⎇ diff.changed</string>
            <key>scope</key>
            <string>markup.changed</string>
            <key>settings</key>
            <dict>
                <key>background</key>
                <string>#4A410D</string>
                <key>foreground</key>
                <string>#F8F8F8</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>⎇ diff.inserted</string>
            <key>scope</key>
            <string>markup.inserted</string>
            <key>settings</key>
            <dict>
                <key>background</key>
                <string>#253B22</string>
                <key>foreground</key>
                <string>#F8F8F8</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>Markup: List</string>
            <key>scope</key>
            <string>markup.list</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#F9EE98</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>Markup: Heading</string>
            <key>scope</key>
            <string>markup.heading</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#CF6A4C</string>
            </dict>
        </dict>
    </array>
    <key>uuid</key>
    <string>766026CB-703D-4610-B070-8DE07D967C5F</string>
</dict>
</plist>

Thanks a lot for giving me any hints!


Solution

  • All you need to do is insert the following beginning on line 128:

            <dict>
                <key>name</key>
                <string>Function call</string>
                <key>scope</key>
                <string>meta.function-call variable.function</string>
                <key>settings</key>
                <dict>
                    <key>foreground</key>
                    <string>#F8F8F8</string>
                </dict>
            </dict>
    

    Assuming you're using JavaScript, this will set function calls to the color you want:

    To edit the file, install PackageResourceViewer and select PackageResourceViewer: Open Resource from the Command Palette. Navigate to Color Scheme - Default -> Twilight.tmTheme and hit Enter, then hit Esc to dismiss the menu. Insert the text above as indicated, save the file, and you should be all set.