ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Rainbow​Indent

by jfcherng ST4

Makes indentation easier to read.

Labels indent

Details

Installs

  • Total 837
  • Win 440
  • Mac 217
  • Linux 180
Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6 Mar 5 Mar 4 Mar 3 Mar 2 Mar 1 Feb 28 Feb 27 Feb 26 Feb 25 Feb 24 Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13 Feb 12 Feb 11 Feb 10 Feb 9
Windows 1 2 1 1 1 3 1 0 0 1 1 2 1 1 5 1 0 0 0 3 2 2 2 4 0 1 1 0 0 0 1 0 0 1 3 1 4 1 2 0 1 3 0 0 2 3
Mac 1 0 1 1 1 0 0 2 2 2 1 0 1 0 1 0 1 1 1 0 0 1 0 0 1 1 0 2 2 1 0 1 0 1 2 1 1 2 0 0 1 1 0 3 0 1
Linux 1 0 1 0 4 0 0 2 2 0 2 0 1 1 0 0 0 0 0 1 0 2 0 2 0 0 0 0 1 0 0 1 0 1 1 0 0 0 0 0 1 2 1 2 1 1

Readme

Source
raw.​githubusercontent.​com

ST-RainbowIndent

Required ST Build GitHub Actions Package Control GitHub tag (latest by date) Project license GitHub stars Donate to this project using Paypal

screenshot

Makes indentation easier to read.

This is a simple conceptual clone of the Indent Rainbow VSCode extension.

Installation

This package is available on Package Control by the name of RainbowIndent.

FAQ

How to Customize Indent Colors?

First, you have to decide how many colors you want to use for indents.

Say, if you want to use 6 colors, add the following into plugin's level_colors setting.

"level_colors": [
    "region.indent.0",
    "region.indent.1",
    "region.indent.2",
    "region.indent.3",
    "region.indent.4",
    "region.indent.5",
],

These region.indent.0region.indent.5 are called scopes in Sublime Text. Names of scope aren't important but I just feel these names are self-explanatory.

Next, you have to add coloring rules into your color scheme for those scopes. For example, adding the following rules into your color scheme.

  • foreground is the indent line color when level_style is set to line.
  • background is the indent background color when level_style is set to block.

Valid color formats are listed on Sublime Text's official document.

///////////////////
// RainbowIndent //
///////////////////
{
    // red
    "foreground": "rgba(229, 57, 53, 0.35)",
    "background": "rgba(229, 57, 53, 0.2)",
    "scope": "region.indent.0",
},
{
    // green
    "foreground": "rgba(67, 160, 71, 0.35)",
    "background": "rgba(67, 160, 71, 0.2)",
    "scope": "region.indent.1",
},
{
    // blue
    "foreground": "rgba(30, 136, 229, 0.35)",
    "background": "rgba(30, 136, 229, 0.2)",
    "scope": "region.indent.2",
},
{
    // orange
    "foreground": "rgba(251, 140, 0, 0.35)",
    "background": "rgba(251, 140, 0, 0.2)",
    "scope": "region.indent.3",
},
{
    // purple
    "foreground": "rgba(142, 36, 170, 0.35)",
    "background": "rgba(142, 36, 170, 0.2)",
    "scope": "region.indent.4",
},
{
    // cyan
    "foreground": "rgba(0, 172, 193, 0.35)",
    "background": "rgba(0, 172, 193, 0.2)",
    "scope": "region.indent.5",
},

How to Disable Rendering by Default and Enable Manually?

You can set the enabled_selector plugin setting to "nothing". Because no scope is named nothing, this plugin won't render indents.

Then, you can enable rendering manually by one of the following ways.

  • From the command palette: RainbowIndent: Disable for This View (Forced)
  • From the context menu: RainbowIndent » Disable for This View (Forced)
  • Create and trigger a keybinding for the rainbow_indent_view_toggle command for convenience.

Known Issues

  • There is no way to draw a region, where is no character, via ST's plugin APIs.