Sublime Forum

inverse_caret_state foreground colour

#1

I’ve been trying to get a block cursor to display in Sublime, and have found that if I set inverse_caret_state to true in my settings file, I get the block cursor that is available in the Vintage plugin.

In my thTheme file I have set my caret and selection keys to the same colour as each other, which takes care of the actual block colour for me.

However I was wondering if there is a way to set the colour of the text that the block cursor is currently on.
For example I want my block to be a bright colour, but want to set the text inside the block to be black.

Is there a key I can use to style this?

0 Likes

Dev Build 3118
#2

I just want to bump this once to add a screenshot and ask more simply, is this even possible in ST3 at the moment?

What I have so far is this:

As you can see the block cursor appears behind the characters just fine, but ideally I would like to style the text on top of the cursor to be black.

Is there a syntax theme key or something that would allow me to do this?
(To get the current results I have set the selection and caret keys in my syntax theme with the inverse_caret_state setting enabled to use the Vintage plugin’s block cursor)

0 Likes

#3

Use the selectionForeground key in your tmTheme file.

Check out this post for a few other selection related keys.

 

2 Likes

#4

Thank you @fico for the suggestion.

Unfortunately it doesn’t seem to affect my theme in the way that I had hoped.

I have the following keys set with relation to selections and carets:

<dict>
	<key>background</key>
	<string>#1d1f21</string>
	<key>caret</key>
	<string>#2497e3</string>
	<key>foreground</key>
	<string>#c5c8c6</string>
	<key>selection</key>
	<string>#2497e3</string>
	<key>selectionForeground</key>
	<string>#000000</string>
</dict>

The selectionForeground key does work when I click and drag to select some text:

But if I do not select some text the block cursor still only shows the original foreground colour:

I’m starting to think that it is impossible to set the foreground colour of the block cursor in ST3 at this time.

0 Likes

#5

Here is a gif to show a bit better what I mean is happening now:

As you can see the black foreground only comes into effect when I actually select some text.

So the block cursor uses the selection and caret keys for it’s own colour, but ignores the selectionForeground key when the block cursor blinks on.

0 Likes

Interface Suggestions
#6

There’s no way that I know of to get what you want and it’s been asked for before many times over the years. In my case I’d prefer the underlying character being coloured in XOR to the block cursor, which would work nicely with a phasing block. In addition to a ‘proper’ block caret type, I’d very much like to see either ‘character colour when covered by caret’ or ‘xor block caret’ options.

:slightly_smiling:

1 Like

#7

Thanks, @Fico. I have been wondering for some time how to make the selection area in my editor contrast better with the background. The selection area was charcoal over black in my dark EightLime theme. Now it is mustard, thanks to your advice,

1 Like

#8

It’s too bad that the request has gone ignored for so many years.

A ‘proper’ block caret would be nice, instead of having to use the strange inverse_caret_state option, but I suppose at least we can get something that isn’t just a line cursor.
I like the XOR idea too now that you mention it too.

I hope some day it will be implemented.

0 Likes