Sublime Forum

Change background colour of all of current line

#1

Hi,

I have overriden the theme settings to have a yellow colour for the current line, using:

{
	"variables":
	{
	},
	"globals":
	{
		"line_highlight": "yellow",
		"selection": "beige"
	},
	"rules":
	[
		
	]
}

Only this much of the line is changed to yellow though:

image

I have read there might a way to change the setting / styling by editing a .tmTheme file using something called PackageResourceViewer and have installed that, but it doesn’t show up under Preferences > Package Settings.

Sorry for the basic question - is it possible to change the colour theme so the whole of the current line is a set colour, rather than just the line number area on the far left?

Thanks

0 Likes

#2

Perhaps you need to set the relevant preference in your User preferences file? It might be called highlight_current_line or something, I’m not at a computer to check right now

0 Likes

#3

The settings in question are as follows (shown with their defaults):

	// If enabled, will highlight any line with a caret
	"highlight_line": false,

	// If enabled, will highlight the gutter for any line with a caret
	"highlight_gutter": true,

	// If enabled, will highlight the line number in the gutter for any line
	// with a caret depending on the color scheme
	"highlight_line_number": true,

You probably want to make sure that highlight_line is enabled; otherwise you’ll only get highlight in the gutter.

Also, for what it’s worth, you should not use PackageResourceViewer ; it works but it has features in it that are objectively dangerous and can cause you long term issues with your Sublime installation.

Rather, go for OverrideAudit instead (I am the author of that, just for clarity). It gives you the same power to modify files as PackageResourceViewer does, adds the ability to allow you to keep track of what you changed, and doesn’t allow you to catastrophically damage your Sublime installation accidentally.

1 Like

#4

Thanks for your reply!

I have changed the settings to this;

// Documentation at https://www.sublimetext.com/docs/color_schemes.html
{
	"variables":
	{
	},
	"globals":
	{
		"line_highlight": "yellow",
		"selection": "beige",
		"highlight_line": "false",
		"highlight_gutter": "true",
		"highlight_line_number": "true"
	},
	"rules":
	[
		
	]
}

But - still no luck unfortunately - the result is the same as in the screenshot from my initial message.

When I didn’t wrap true and false in speech marks, this error was returned:

Thanks

0 Likes

#5

Those settings aren’t a part of the color scheme; they go in your Preferences.sublime-settings file (Preferences > Settings in the menu).

One way to think of it is that the color scheme provides the rules for what colors to apply, and those particular settings allow anyone who uses the color scheme to decide which parts of the line (if any) to use the colors on.

The default settings highlight the gutter area (where the line numbers are) but you need to turn on the one that defaults to false in order to make it apply to the whole line.

0 Likes

#6

Sorted:

image

Thank you very much for your help :slight_smile:

1 Like