Sublime Forum

How to customize table colors?

#1

In Lua, the inner elements of a table are yellow, like this:
hHqFiDP1Sy

I want ONLY the inner elements to appear in white, like this:
image

How can I do that?

0 Likes

#2

Colors can be adjusted by customizing color schemes:

  1. Identify the scope of a token by placing caret on it and hit ctrl+shift+alt+p
  2. Call UI: Customize Color Scheme from Command Palette
  3. Add a color scheme rule for a token’s scope to the left view and save it.
// Documentation at https://www.sublimetext.com/docs/color_schemes.html
{
	"variables":
	{
	},
	"globals":
	{
	},
	"rules":
	[
		{
			"name": "LUA Mapping Keys",
			"scope": "source.lua string.unquoted.key",
			"foreground": "var(white)"
		}
	]
}
0 Likes

#3

Thank you for your answer, but I apologize, because I do not have mastery over these steps.
As far as I got was here:

  1. When I click on the sub-item of the table and press Ctrl+Alt+Shift+P I get:
    image
  2. Calling UI: Customize Color Scheme I get:

But from there it was not clear to me what I should do.
Could you elaborate a little more?
Thanks in advance.

0 Likes

#4

Color Schemes work very much like settings/preferences.

The window, which opens by calling UI: Customize Color Scheme, shows the shows the original color scheme on the left, while customizations can be made by adding corresponding keys/rules to the right pane. Those are saved in _User/.sublime-color-scheme.

Next to "globals": {...} add an object "rules": [...] and paste the color rule from my snippet above.

Each rule can have an optional "name" to identify it more easily.

The "scope" key takes a selector (combination of scope names) to identify tokens to assign colors to.

The "foreground" takes a color value. Either hardcoded #fff or a variable, whatever CSS allows.

see also: https://www.sublimetext.com/docs/color_schemes.html

2 Likes