Sublime Forum

Gutter highlights how-to

#1

It is wonderful that we can all play with Sublime colors. It teaches one much about the structure of this application. So we are constantly wondering why theme implementations burned out in the gutter, so-to-speak. But just look at this clip!

The first thing we notice, is that the wacky gutter-number highlight and cursor have runaway together, way South of our selection. Not understanding the fine nuances of operating systems, that looks WRONG! Every line selected should correspond with a highlight of every selected line’s gutter line number. Further, when the carat rests in any line, then the line number for that that active line should be differentiatiated in some way. Except of course, that the carat and gutter highlight should not be running away south of where they belong! Our selection processes should result in the following Gutter Appearance.

In the above (imaged) string arrays, we have attempted to activate the ENTITY.Highlight.Foreground feature, unsuccessfully. If you have very sharp eyes, you will notice that the cursor has been appropriately re-positioned where it might sensibly fit, in the bottom (corrected) image… Following the provided help files for Color Schemes and for Scope Naming, we are not having much luck there, at all. Does anyone know how to style the color for active gutter numbers: ergo, carat present OR line (s) selected?

0 Likes

#2

It should be noted that “gutter” implementation is limited: that is, the documentation describes only 2 editable key-string options. Aditionally, there are only 3 editable Preferences Settings options. Available options will not help here. We are all looking for an easy out-of-the-box answer.

It would be nice if the gutter for the active line used a highlighted number. But it would appear that global system constraints get in the way of that! You see, when you highlight a line in Windows or OS X, then the gutter highlight drops to the following line. Yet for Linux, highlight remains on the active line. Conversly, in the settings file itself there is more than one setting that hangs in the balance due to constraints applied to this or that operating system. So lamenting the issue in 2017 now, there is not much that anyone can do with the Sublime gutter.

Thankfully, the clever individuals who program Sublime are able to play around with line highlights. Quite handily, on-the-fly… I might add. However, they cannot rewrite operating systems just for their own application. Resolution here could be a wait-and-see situation. Indeed, the upcoming Sublime version 4 may finally plug this theme-related ‘black hole’. Tame the Beast!

In a manner of speaking…

1 Like

#3

#Simple solution
Gutter colors are managed in three tmTheme (Global, Gutter) settings and also in Sublime Text Settings (highlight_line).

In Sublime Text Unofficial Documentation pay attention to sections General (lineHighlight) and Gutter (gutter, gutterForeground). In Sublime Text Settings lineHighlight can be set to true, as Gutter highlight shares Line highlight. Ignoring lineHighlight you can color just the Gutter. In the following example, our highlight is too delicate to isolate from a visual line selection against our global #151A1C Deep Cadet Blue background.

#Example
Sublime Text Settings
“highlight_line”: true,
Nice Blue Soda.tmTheme (Color Scheme - Nice Blue Soda)
<!-- GLOBAL -->
(optional…
<key>foreground</key><string>#5072A7</string>
<!-- Blue Yonder --> )
<key>lineHighlight</key><string>#28395355</string>
<!-- Dark Blue Yonder 25% Opaque -->
<!-- GUTTER -->
<key>gutter</key><string>#141C2A</string>
<!-- Deep Blue Yonder -->
<key>gutterForeground</key><string>#0072BB</string>
<!-- French Blue -->

_fyi: dark = rgb/2 and deep = rgb/4, simple math always beautiful :wink:
(my Nice Blue Soda foreground is actually Fresh Air, just saying)

#Question
Since we know that lineHighlight coloring relates typically to just one selected (carat) line, an obvious query arises…
How do we cause the Content line (s) highlight and associated Gutter line number (s) highlight to span multiple selected lines?
Answer
Hold down Alt-key while selecting more than one line. Sublimely beautiful! :joy:
(consider keeping your distribution up-to-date)

0 Likes