24

I really liked the Monokai color theme, except for one thing - I can barely see the comments which are more than half the actual code text. Is there a way to change the color of the comments specifically but keep the rest according to monokai?

3
  • 1
    what do you mean by notes? Commented Sep 19, 2015 at 12:21
  • in python the char '#' starts a note. In monokai they are gray and the background color is dark gray is they are almost invisible. Commented Sep 20, 2015 at 20:56
  • 2
    Ah I see, you mean comments! Commented Sep 21, 2015 at 2:32

5 Answers 5

24

Those are the steps:

  1. open the command palette in sublime text by typing: Ctrl+Shift+P

  2. type: control install package

  3. restart sublime text

  4. Reenter again into the command palette by typing the same thing again

  5. type prv and search for: PackageResourceViewer- Open resource

  6. Click on: Color Scheme - Default and choose Monokai.tmTheme

  7. When you enter the .xml file. go to line 54 I think (under the comment line) and change that value to whaterver you want

For me i use: #26E372 // is a green color For yellow color you can use: #FFFF00

If you want to know wich number to choose: you can go to this site to know: http://tmtheme-editor.herokuapp.com/#!/editor/theme/Monokai

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks!! Worked perfectly. :) Changed from #75715E to #FFCD42
This is a huge help. Thank you for mapping out the steps!
20

I was unable to change comments color by editing Monokai.tmTheme.

For Sublime 3.1.1 Build 3176 editing Monokai.sublime-color-scheme works.


1. Open Package Resource Viewer

Open Package Resource viewer

2. Open Color Scheme

Open Color Scheme - Default

3. Open Monokai color scheme

Open Monokai color scheme

4. Add your desired color in variables (pick here)

Add you desired color

5. Change comment color

Change comment color

6. Enjoy your new comments color!

enter image description here

3 Comments

Thank you for this, saved me quite a bit of time :)
What about multi-line comments? How do you change that color? ie: """ my comment here """. I'm not sure what that style of comment is called.
Nevermind. It's the same thing. The "name" "Comment" color field affects both # regular comments and """ multiline comments""" it seems.
14

Changing specific components of a color scheme in Sublime Text 3 is easily done via the PackageResourceViewer plugin.


In simple steps:

  • Install PackageResourceViewer as you would any plugin via Sublimes Package Manager.
  • Open the command pallette and search for ''Open Resource''.
  • From the list select Color Scheme - Default and then select the monokai theme Monokai.tmTheme.

From the .xml file scroll down until you see the comment entry holding the color value for the comments and change it to #FFFFFF as it can be seen in the picture:

monokai.tmTheme

Now comments will actually be more visible :-)

enter image description here

Of course you can change this value to whatever you wish.

Comments

7

Adding on to Dschang123's great answer: to distinguish between single- and multi-line comments and their respective colors (which is what I personally came to this question searching for) one can change:

    {
        "name": "Comment",
        "scope": "comment",
        "foreground": "var(yellow5)"
    },

to instead read:

        {
            "name": "Comment_multi",
            "scope": "comment.block, punctuation.definition.comment.block",
            "foreground": "var(blue5)"
        },
        {
            "name": "Comment_single",
            "scope": "comment.line, punctuation.definition.comment.line",
            "foreground": "var(blue6)"
        },

(I like these colors for the Mariana theme but am not advertising my choice as optimal by any metrics).

Information on "scope" from: https://www.sublimetext.com/docs/3/scope_naming.html

(I'd comment this under Petr Javorik's answer in response to Gabriel Staples's comment, but my rep doesn't yet qualify to comment.)

Comments

1

Based on the answer by @jbplasma, for Monokai theme in Sublime Text Build 4126 I went to the menu option Preferences -> Customise colour scheme and filled out the right-hand pane of custom settings to contain this:

// Documentation at https://www.sublimetext.com/docs/color_schemes.html
{
    "variables":
    {
        "dimcomment": "hsl(60, 12%, 55%)",
        "brightcomment": "hsl(60, 12%, 75%)",
    },
    "globals":
    {
    },
    "rules":
    [
        {
            "name": "Comment_multi",
            "scope": "comment.block, punctuation.definition.comment.block",
            "foreground": "var(brightcomment)"
        },
        {
            "name": "Comment_single",
            "scope": "comment.line, punctuation.definition.comment.line",
            "foreground": "var(dimcomment)"
        },
    ]
}

This brightens up both block and line comments, making block comments a little lighter. You can change the brightness by adjusting the last percentage value, luminance, in the hsl() tuples.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.