-3

What is being customized

When creating a color scheme for Sublime Text, to find the scope that defines the color for a portion of code, we can press Cmd Opt P (Mac) or Shift Ctrl Alt P (Win), to bring up the Scope overlay. (Source)

Screenshot of Sublime Text 3 showing the Scope pop-up overlay

By clicking the Copy link, the scope is sent to the clipboard. It is in a syntax like this:

value: flex

text.html.basic source.css.embedded.html meta.property-list.css meta.block.css meta.property-value.css support.constant.property-value.css

Different types of values have slightly different scopes, allowing their text color to be targeted specifically.

value: none

text.html.basic source.css.embedded.html meta.property-list.css meta.block.css meta.property-value.css constant.language.null.css

The problem

Note how the none value being recognized as null causes the syntax highlight color to change to purple:

Above: "One Dark Gravity" Color Scheme with a null value highlighted in purple

Now, I personally don't see a value of none as being any more important than the other values. The declaration removes a border where there otherwise would be one, but it's just one of many CSS declarations here, and I don't need that being treated as something more significant.

To make it clear, I am working from an existing color scheme as a starting point and making specific overrides. That's why I can't simply be less specific with the styling from the beginning. The color scheme is already quite specific.

How color scheme customization works

How it works (for anyone not familiar) is that a custom color scheme file that modifies the existing color scheme is placed in ~/Library/Application Support/Sublime Text 3/Packages/User/ and assigned a file name matching the existing color scheme's name - in this case One Dark Gravity.sublime-color-scheme This allows the overriding of specific parts of the existing scheme.

Here is a well-explained video tutorial on the basics for anyone interested.

The question

So my question is: Is there something like CSS 'unset' that will cause all values to ignore type-specific styling? Then I could unset each specific declaration, reverting all values back to the same color.

I would like all CSS values (regardless of their type) get highlighted in the same color. So for example: flex, none, and 64px would all be colored the same.

What I've tried

Yes, I did try "foreground": "unset", but to no avail.

I also know that I can reassign colors with the opposite approach - being more specific, and defining a color for each value type, setting each to "foreground": "var(myvaluecolor)", for example. But this approach is more verbose, more time-consuming, and leaves more possibilities for overlooking edge case color rules. So unsetting would be the preferred approach.

Thanks for any info on this.

1 Answer 1

0

Basically there is no equivalent to CSS unset for Sublime Text color schemes.

Overriding is the only way. The approach to take will depend on the property type.

  • For some properties, such as font_style, setting a value of none will work.

font_style values can be: bold, italic, underline, none

These types of properties expect a keyword value.

  • For foreground and background, a new color value must be set to override the old one.

  • For boolean properties also, a new boolean value must be set to override the old one.

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

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.