Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Sublime Text color schemes #198

Open
ezjong opened this issue Oct 29, 2018 · 18 comments
Open

Add Sublime Text color schemes #198

ezjong opened this issue Oct 29, 2018 · 18 comments
Labels
enhancement New feature or request

Comments

@ezjong
Copy link

ezjong commented Oct 29, 2018

Version

  • MacOS Mojave
  • Build: 1084

Description
The typical Sublime Text color scheme options are currently missing, e.g. Monokai, Twilight etc.

Preferred solution
Availability as menu option (similar to Sublime Text) -> Preferences -> Color Scheme...

@wbond
Copy link
Member

wbond commented Jan 2, 2019

For color schemes to work, they need to have specific scopes added to highlight the diffs, so at the moment this feature would not be useful.

@wbond wbond added the enhancement New feature or request label Jan 2, 2019
@wbond
Copy link
Member

wbond commented Mar 8, 2019

Here is some info on how to customize the color scheme used in Sublime Merge. This is going to work best for builds 1105 and newer. This is because new builds will automatically generate some necessary scope rules for the inserted and deleted regions of the diff view. Before then, each color scheme would need to be customized. However, I don't believe every scope will be auto-generated, so the example at the end of this comment may be of use.

Since Sublime Merge is more complex than Sublime Text in its interface, there are actually a few different places that color schemes are used:

  • Commit message
  • Diff
  • File mode display

Each of these has a settings file that controls the editor control used. Beyond that, each theme has it's own version of the settings file for each editor control. The format for the settings files is:

  • Commit Message - {Theme Name}.sublime-settings
  • Diff - {Theme Name}.sublime-settings
  • File Mode - {Theme Name}.sublime-settings

So, if you are using the theme "Merge", the files will be named:

  • Commit Message - Merge.sublime-settings
  • Diff - Merge.sublime-settings
  • File Mode - Merge.sublime-settings

If you are using the theme "Merge Dark", the files will be:

  • Commit Message - Merge Dark.sublime-settings
  • Diff - Merge Dark.sublime-settings
  • File Mode - Merge Dark.sublime-settings

In each of those files is a setting named "color_scheme". You can customize all three to use the same color scheme, or use different color schemes for each. Based on how Sublime products load settings, you'll want to create User versions of each of those three files. This way your customizations will be retained upon program updates.

Thus if you are using the theme "Merge", you should create files:

  • Packages/User/Commit Message - Merge.sublime-settings
  • Packages/User/Diff - Merge.sublime-settings
  • Packages/User/File Mode - Merge.sublime-settings

In each of those, put the following content:

{
    "color_scheme": "My.sublime-color-scheme"
}

Sublime Merge will load .sublime-color-scheme, .tmTheme and .sublime-syntax files from your Sublime Text install. Additionally, it will load syntax-specific .sublime-settings files. Other settings files and themes will not be loaded, since they will be incompatible.

If you want to customize the diff regions in your color scheme, you can create a customization (https://www.sublimetext.com/docs/3/dev/color_schemes.html#customization). You'll want to support the following selectors for compatibility. The following example is what was added to Mariana to support Sublime Merge (in addition to its baseline support of Sublime Text):

{
   "rules":
    [
        {
            "scope": "diff.deleted",
            "background": "hsla(357, 45%, 60%, 0.15)",
            "foreground_adjust": "l(+ 5%)"
        },
        {
            "scope": "diff.deleted.char",
            "background": "hsla(357, 60%, 60%, 0.30)",
            "foreground_adjust": "l(+ 10%)"
        },
        {
            "scope": "diff.inserted",
            "background": "hsla(180, 45%, 60%, 0.15)",
            "foreground_adjust": "l(+ 5%)"
        },
        {
            "scope": "diff.inserted.char",
            "background": "hsla(180, 60%, 60%, 0.30)",
            "foreground_adjust": "l(+ 10%)"
        },
        {
            "scope": "diff.deleted.side-by-side",
            "background": "hsl(210, 15%, 27%)",
            "foreground_adjust": "l(+ 5%)"
        },
        {
            "scope": "diff.inserted.side-by-side",
            "background": "hsl(210, 15%, 27%)",
            "foreground_adjust": "l(+ 5%)"
        },
        {
            "scope": "diff.fill",
            "background": "hsl(210, 15%, 27%)",
        },
        {
            "scope": "diff.inserted.merge-left",
            "background": "hsla(180, 25%, 60%, 0.15)",
            "foreground_adjust": "l(+ 5%)"
        },
        {
            "scope": "diff.inserted.char.merge-left",
            "background": "hsla(180, 40%, 60%, 0.30)",
            "foreground_adjust": "l(+ 10%)"
        },
        {
            "scope": "diff.border.merge-left",
            "background": "hsla(180, 40%, 60%, 0.50)",
        },
        {
            "scope": "diff.inserted.merge-right",
            "background": "hsla(60, 25%, 40%, 0.15)",
            "foreground_adjust": "l(+ 5%)"
        },
        {
            "scope": "diff.inserted.char.merge-right",
            "background": "hsla(60, 40%, 60%, 0.30)",
            "foreground_adjust": "l(+ 10%)"
        },
        {
            "scope": "diff.border.merge-right",
            "background": "hsla(60, 60%, 60%, 0.50)",
        },
        {
            "scope": "diff.border.merge-conflict",
            "background": "hsla(357, 75%, 65%, 0.50)",
        },
        {
            "scope": "diff.border.merge-merged",
            "background": "hsla(180, 10%, 70%, 0.30)",
        },
        {
            "scope": "blame.border",
            "background": "hsl(210, 13%, 30%)",
        },
        {
            "scope": "blame.age-icon",
            "foreground": "white",
        },
        {
            "scope": "source.sublime-merge.preferences.git_binary",
            "foreground": "white",
        },
    ]
}

@facelessuser
Copy link

facelessuser commented Mar 4, 2020

Is there a reason this doesn't work on Windows? Does windows not source Sublime Text packages? I've tested this out on Linux, but can't get it to work on Windows.

EDIT: I think when I copied and pasted the file names to override, I picked up some invisible characters from GitHub. It caused my names to not be correct. Once I fixed that, all was once again working.

@facelessuser
Copy link

The only way I could pull this off in Windows was to override Mariana.sublime-color-scheme.

@aahnik
Copy link

aahnik commented Nov 10, 2020

how can I set the theme of the sublime merge to dark?

I am not talking about any customization. I just want to have a dark mode.

is there not a simple way? or do I need to make tons of new files?


UPDATE

I just discovered this

Screencast from 10-11-20 12:42:39 PM IST webm_gif

Should a simple feature like a dark theme be reserved for registered users?


UPDATE

Sorry to say but I am extremely disappointed with Sublime merge. Some blog articles motivated me to try out sublime.
But just setting a dark theme is so complicated in the sublime merge.

Sublime text is cool for a text editor, but not possible to use it as a full-time code editor.

What I love about the sublime is that it loads damn fast.

I hope that someday I will get the speed of sublime and the comfort of VS code

@dpjohnst
Copy link
Member

Hi @aahnik,

Sorry to hear you're disappointed with Sublime Merge. If you could, I'd appreciate if you could share any feedback so that we can improve your experience.

With regard to the dark theme:
The Dark theme is only available for registered users of Sublime Merge.

Once you've added a valid license, you can switch between light and dark theme using the toggle in the preferences. If you have any suggestions on how to simplify this process I'd love to hear them.

Kind regards,
- Dylan

@aahnik
Copy link

aahnik commented Nov 10, 2020

Hi @dpjohnst,

Thanks for listening.

I have already given my feedback, expressing my disappointment with the dark theme being a premium feature.

  • I hope that switching to a dark theme was free because it is such a basic feature. This reason prevented me from using the sublime merge.

By the way, from today I am going to use sublime text instead of gedit when I need to do small text edits. But VS Code remains my choice when I sit for long coding hours. I got this idea from this video https://www.youtube.com/watch?v=L8QzFU0k5OA by @KalleHallden

In short, sublime is fast responsive, and snappy but lacks the ease of use and advanced features of VS Code.

My dream editor is that which is

  • free and open-source
  • fast and responsive as sublime
  • easy to use and feature-rich as VS Code.

I may sound childish, by dreaming of such things. But I believe this is what the market needs right now.

If such an editor comes to the market, I am sure that 99 % of people will switch to that.

Thanks a lot for actively listening to your customers.

@jfcherng
Copy link

jfcherng commented Nov 10, 2020

If such an editor comes to the market, I am sure that 99 % of people will switch to that.

I don't know. I don't mind to say that I didn't switch to VSCode just because I've heavily customized my ST and I am lazy to re-customize and re-learn an editor.

https://onivim.io/ is probably your dream if you are familiar with VIM.

@aahnik
Copy link

aahnik commented Nov 10, 2020

@jfcherng I agree with you that switching is hard. VS Code is my life's first editor and I have been spoilt by it. Not seeing enough reasons to learn vim.

And about https://onivim.io/, the first page asks you to pay. I am not interested in any paid product currently as I am a student, and products in dollars are much expensive, from an Indian perspective. ( just compare the cost of living and dollar conversion rates )

@stinos
Copy link

stinos commented Nov 10, 2020

by dreaming of such things. But I believe this is what the market needs right now

The market has always needed this, imo, the reason it's still just a dream is that it's extremely hard to make, especially free and open source. You'd need a complete team of full time devs, for years, to pull something like that off. You see the thing is ST is a 'plain' text editor with plugins. VSCode on the other hand is an editor which can also be a complete IDE. To make that happen though, you need a much more extensive plugin system, allowing more elaborate language services to make debugging work properly, etc. Which has an effect on performance (though arguably VSCode being Electron-based also doesn't help). All due respect, but imo it's a bit unfair to come here complaining you have to pay for certain features: it was the authors decision to use this type of licensing because they also need to make a living.

@theol0403
Copy link

And about onivim.io, the first page asks you to pay.

Onivim is free for students and hobbyists, you just need to build it from source yourself.

@aahnik
Copy link

aahnik commented Nov 11, 2020

@theol0403 thanks a lot for pointing. I will definitely try it out. I just read the README of onivim. It sounds promising.


it's a bit unfair to come here complaining you have to pay for certain features: it was the author's decision to use this type of licensing because they also need to make a living.

Hi @stinos , Initially, I came here in search of "how to set dark mode".
I had earlier expressed my hopes and sorrows.

But at the same time, let me make it clear that I respect the author's decision of licensing.

And I feel deeply grateful to all those people who made these awesome tools to make the world a better place.

@jwortmann
Copy link

I spent a few hours yesterday to find out where exactly the mentioned Sublime Merge specific scopes are used, and to add some nice looking colors for them into my color scheme. Here is where I found the scopes, so that other users or color scheme authors can benefit from it and don't have to use lots of trial and error to find which parts of the UI are affected:

diff

merge

blame

@theol0403
Copy link

theol0403 commented Mar 3, 2021

My custom Monokai Pro setup, if anyone is interested:

image

In Merge Dark.sublime-theme:

{
	"extends": "Merge.sublime-theme",
	"variables":
	{
		"dark_gray-lightest": "rgb(45, 42, 46)", // commits
		"dark_gray-light": "rgb(34, 31, 34)", // locations
		"dark_gray-medium": "rgb(34, 31, 34)", // header
		"repository_tab_bar_bg": "rgb(45, 42, 46)", // tabs
	},
}

With theme set as Monokai Pro as per above posts.

I extracted the original theme from /opt/sublime_merge/Packages/Theme - Merge.sublime-package/Merge Dark.sublime-theme (Linux) and then found what needed to be changed. There is a good reference of scopes for the default theme in there 👍

@dwhenson
Copy link

dwhenson commented Jun 3, 2021

This is just what I would like my Sublime Merge set up to look like! Can you share any more information how you got it set up? I am also using Monokai Pro (filter machine version).

@bitsper2nd
Copy link

bitsper2nd commented Nov 19, 2021

@dwhenson @aahnik I was inspired by facelessuser Dracula Theme. So I did the same thing using the Monokai color palette. Here is the result. I updated the theme and added method to quickly switch between the themes with the command palette.

spectrum

@gnat
Copy link

gnat commented Feb 26, 2022

Sadly a case of poor documentation on Sublime's part. Sure we have a reference manual, but there's no minimum example of how to extend a theme or extend a color scheme, particularly in Sublime Merge. @dpjohnst re: Feedback on this rabbit hole.

ANYWAYS

@bitsper2nd did some wonderful work on this. For anyone following, give these a second look.

These are simple, beautiful and they work. Anyone listening at Sublime HQ, PLEASE fix your docs to show some basic theming examples of extending themes and extending color schemes.

@bitsper2nd
Copy link

bitsper2nd commented Feb 28, 2022

Thanks for the kind words! Here is my new WIP. Mariana for Sublime Merge.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests