TerminalView icon indicating copy to clipboard operation
TerminalView copied to clipboard

Colors

Open rwols opened this issue 7 years ago • 16 comments

This isn't done yet as it has some bugs. Pretty pictures:

Derived from "Mariana" scheme

schermafbeelding 2017-08-10 om 14 26 44

Derived from "Blue Thunder" scheme

schermafbeelding 2017-08-10 om 14 38 13

Derived from "Breakers" scheme

schermafbeelding 2017-08-10 om 14 39 31

I've been fudging with getting the foreground and background colors switched because as you can see, for some reason it selects the background while it should select the foreground.

rwols avatar Aug 10 '17 12:08 rwols

There is a bug/feature of add_regions: if the background of a scope is exactly the same as the background of the theme. The foregound and background colors would be inverted. I can still remember how long it took me to identify this issue. Also check https://github.com/SublimeTextIssues/Core/issues/817

That's why the theme background is #000000 while the scope backgrounds are #000001

randy3k avatar Aug 13 '17 07:08 randy3k

Thanks, I never would have guessed the problem was there. add_regions foils my plans yet again ;)

schermafbeelding 2017-08-13 om 12 02 21

Things are starting to look okay now. I'll have to think of another way to represent terminalview.black_black though.

rwols avatar Aug 13 '17 10:08 rwols

Starts to work pretty good now:

schermafbeelding 2017-08-13 om 14 18 45 schermafbeelding 2017-08-13 om 14 19 29 schermafbeelding 2017-08-13 om 14 19 58

rwols avatar Aug 13 '17 12:08 rwols

One problem I have is that there's supposed to be a ninth color called "default", but pyte doesn't seem to care about that:

schermafbeelding 2017-08-13 om 14 53 12 schermafbeelding 2017-08-13 om 14 54 31

rwols avatar Aug 13 '17 12:08 rwols

What is the expected result for the default color? Isn't it showing white color now?

randy3k avatar Aug 13 '17 14:08 randy3k

How do think the idea of generating settings like

'terminal_color_0'  : '#000000',
'terminal_color_1'  : '#ff8787',
'terminal_color_2'  : '#87d75f',
'terminal_color_3'  : '#ffd75f',
'terminal_color_4'  : '#87afff',
'terminal_color_5'  : '#af87ff',
'terminal_color_6'  : '#d7ff87',
'terminal_color_7'  : '#bfbfbf',
'terminal_color_8'  : '#000000',
'terminal_color_9'  : '#ff8787',
'terminal_color_10' : '#87d75f',
'terminal_color_11' : '#ffd75f',
'terminal_color_12' : '#87afff',
'terminal_color_13' : '#af87ff',
'terminal_color_14' : '#d7ff87',
'terminal_color_15' : '#bfbfbf',

and applying them to TerminalView in run_time? It will give much more controls to users.

randy3k avatar Aug 14 '17 16:08 randy3k

I think that's okay, but I worry for the startup time. Would that be noticeable?

rwols avatar Aug 14 '17 16:08 rwols

If we only do it once until Sublime Text restarts, it should okay.

randy3k avatar Aug 14 '17 16:08 randy3k

Very interesting - while personally I like the black/white scheme it is definitely nice that it can adapt to user color scheme. I'll just wait a bit with pulling this until we have 0.5 out then we can look into including this for 0.6 :+1:

Wramberg avatar Aug 15 '17 12:08 Wramberg

Yeah, I'm aiming for 0.6 for this PR.

rwols avatar Aug 15 '17 13:08 rwols

A few notes after testing this:

I ran into a bit of trouble since I don't have any dark blue color in my color scheme (I think). My light blue was used for cyan and magenta was used for blue (thus magenta was not visible):

colortest

I still like this approach but I'm worried about it giving users an inconsistent experience. Maybe TerminalView should ship with a default color scheme similar to what we have now + a few alternatives that can be selected through settings (like maybe a light version with white background). Among the alternatives this could be one of them - a sort of auto color scheme.

Another concern I have if we were to use this as default color scheme is that it doesn't set TerminalView apart from the rest of ST3. I think it's a good thing to have a somewhat different color scheme (atleast as default) since it signals to the user that they are not in a regular ST3 view (different keybindings etc.).

What do you think ?

Wramberg avatar Aug 19 '17 08:08 Wramberg

I'm okay with this being an optional setting in the settings. Preferences differ from person to person and I like my terminal to look like any other view.

For the magenta being black, I think the function extracted only 5 colors and added a black color to get six (see here). Furthermore it then assigned "magenta-ish" to the blue reference color because blue just so happens to come before magenta. The magenta-ish color should have been assigned to the magenta reference. I think that's a bad idea now and I'd like to change the algorithm so that it can better handle schemes with few colors.

Can you put your color scheme in a gist so I can experiment with it?

rwols avatar Aug 19 '17 12:08 rwols

Color scheme: https://gist.github.com/Wramberg/4c3701579a5c18b581f3f1df4fb521b1 Keep up the nice work - this is quite a cool feature :-)

Wramberg avatar Aug 19 '17 21:08 Wramberg

Just to give an update: cie2000 works now, but it gives basically the same results as cie1994.

Also, your color scheme has 11 colors, so the problem is not that it has too few colors. The problem is actually that while it looks like the magenta color is black, it's actually fairly close (a distance of about 30 units, 15 units is "very close"). The problem is that it is also happens to be very close to the background color. My idea is to check the distance to the background color, and if it's "too close" to the background, change the lightness somehow to account for that. For this, I need to be able to convert from L*a*b* back to RGB, so I'll have to implement those conversion functions.

rwols avatar Aug 27 '17 10:08 rwols

Thank you for the feature. It wouldn't hurt to write in readme that you need to restart sublime in order for the changes to take place. I finally read it from this pull request after almost giving up :P

johanson avatar Mar 16 '18 18:03 johanson

Hi @johanson, glad you like it. I never got around to finishing this, because it needs a few things still:

  1. It should be optional.
  2. Probably should use the newly introduced .sublime-color-sheme format instead of the old .tmTheme format.
  3. Explain in the README how to get this working!

Like @Wramberg I'm occupied with work these days, I'll see if I can find the time to pick this up some day again.

rwols avatar Mar 16 '18 19:03 rwols