Sublime Forum

Manual color_scheme: auto

#1

Hey everyone!
Got an older macOS not supporting dark/light on OS level (High Sierra).
Is there a way to set the flag manually?
So that I can still toggle between light_color_scheme and dark_color_scheme?
(I’m using different themes for different languages.)
Best wishes,
Shu

EDIT:

Tried apple script:
tell application “System Events”
tell appearance preferences
set dark mode to true
end tell
end tell

That does set system’s menu bar to dark, but that doesn’t trigger “auto” to read dark mode.
“auto” always defaults to the light theme.
Tried passing “dark”, “Dark”, “dark_color_scheme”, “0”, “1”, “true”, “false” to “color_scheme”. None did the trick.

0 Likes

#2

Just select the dark theme & a dark color scheme under the Preferences menu.

0 Likes

#3

But that will set the theme for all languages, which, for example, doesn’t highlight .md headlines or it doesn’t have enough contrast between text and tags for .html or it is too colorful for .cs, etc. Right now, I manually toggle between two “color_scheme” per language, one including a light theme, one including a dark one. Theme: Adaptive isn’t an issue, though, since it seems to be based on the chosen theme rather than OS.

0 Likes

#4

You can set the "color_scheme" setting in the syntax specific settings (Preferences > Settings – Syntax Specific). I suggest getting the valid values from your global preferences. The "light_color_scheme"
and "dark_color_scheme" have the values you probably want.

0 Likes

#5

That’s exactly what I did. My setup now is similar to this:

Default (OSX).sublime-preferences
“color_scheme”: “Themes/Light1”
// “color_scheme”: “Themes/Dark1”

Html.sublime-preferences
“color_scheme”: “Themes/Light2”
// “color_scheme”: “Themes/Dark2”

CSS.sublime-preferences
“color_scheme”: “Themes/Light3”
// “color_scheme”: “Themes/Dark3”

JavaScript.sublime-preferences
“color_scheme”: “Themes/Light3”
// “color_scheme”: “Themes/Dark3”

Markdown.sublime-preferences
“color_scheme”: “Themes/Light4”
// “color_scheme”: “Themes/Dark4”

When I want dark mode, I now have to uncomment each second line and comment each first line of each file separately. But I’d like to be able to do that:

Default (OSX).sublime-preferences
“color_scheme”: “auto” // or set it to “light” or “dark”; just one place to toggle the mode for each language with no need to comment and uncomment
“light_color_scheme”: “Themes/Light1”
“dark_color_scheme”: “Themes/Dark1”

Html.sublime-preferences
“light_color_scheme”: “Themes/Light2”
“dark_color_scheme”: “Themes/Dark2”

CSS.sublime-preferences
“light_color_scheme”: “Themes/Light3”
“dark_color_scheme”: “Themes/Dark3”

JavaScript.sublime-preferences
“light_color_scheme”: “Themes/Light3”
“dark_color_scheme”: “Themes/Dark3”

Markdown.sublime-preferences
“light_color_scheme”: “Themes/Light4”
“dark_color_scheme”: “Themes/Dark4”

0 Likes

#6

You’d have to write a script to edit those files in the way that you want.

0 Likes

#7

Alright, thanks. I just thought there may be a more straight forward way, since color_scheme: auto and light_color_scheme as well as dark_color_scheme seem to exist for exactly that purpose.

0 Likes