How to change the color of right sidebar (miniMap) in sublime?

后端 未结 1 1136
灰色年华
灰色年华 2021-02-12 16:02

There is a rectangle area in the right sidebar, showing the current code block you are in in the context of the whole file, however it is kind of difficult to see, anyone know h

相关标签:
1条回答
  • 2021-02-12 16:12

    Yes, it is possible to change the color of the minimap. In addition there are also a couple of settings that you can enable to make the minimap easier to see:

    • draw_minimap_border: enable it to see the minimap border.
    • always_show_minimap_viewport: makes the minimap always visible (even if the mouse is not near the minimap).

    Example user settings (use menu Preferences>Settings, see this answer for more info about sublime user-settings file format):

    {
        "always_show_minimap_viewport": true,
        "draw_minimap_border": true
    }
    

    How to change the color of the minimap?

    To change the color of the minimap you should do it in your theme file. The default theme file is called Default.sublime-theme but this file name could be different if you are using a different downloaded theme. You need to change the value of the property viewport_color inside the class minimap_control. In order to do it you have two main options:

    • Option 1: override the values in a new file. Create a file called Default.sublime-theme in your user folder (you can find your user folder using menu Preferences>Browse-packages and then open the folder called user). Set this content to the file, use another color values if you want, save it with fileName Default.sublime-theme (supposing you are using default theme), and then restart:

      [
          {
              "class": "minimap_control",
              "settings": ["always_show_minimap_viewport"],
              "viewport_color": [68, 200, 240, 96],
              "viewport_opacity": 1.0,
          },
      
          {
              "class": "minimap_control",
              "settings": ["!always_show_minimap_viewport"],
              "viewport_color": [68, 200, 240, 96],
              "viewport_opacity": { "target": 0.0, "speed": 4.0, "interpolation": "smoothstep" },
          },
      
          {
              "class": "minimap_control",
              "attributes": ["hover"],
              "settings": ["!always_show_minimap_viewport"],
              "viewport_opacity": { "target": 1.0, "speed": 20.0, "interpolation": "smoothstep" },
          },
      ]
      
    • Option 2: edit your theme file directly. If you are using Linux and the default theme you usually can found Default.sublime-theme inside /opt/sublime_text/Packages/Theme - Default.sublime-package. If you are using windows and the default theme you usually can find Default.sublime-theme inside C:/Program Files/Sublime Text 3/Packages/Theme - Default.sublime-package.


    Example results:

    1. Default Minimap:

      Default minimap

    2. Default minimap with option draw_minimap_border set to true.

      Default minimap with border

    3. Minimap with custom color ([68, 200, 240, 96]) and border

      Minimap with custom color


    Edit: extra explanation about the meaning of "settings": ["!always_show_minimap_viewport"] in the previous file. It means that the config group is only used if the sublime setting always_show_minimap_viewport value is set to false. On the other hand "settings": ["always_show_minimap_viewport"] means that the config group is only used if the sublime setting always_show_minimap_viewport is set to true.

    More in detail, the first config group just sets the minimap color and makes opacity=1, so, it makes the minimap always visible, and this is only used when always_show_minimap_viewport is set to `true.

    The last two config groups are only used when always_show_minimap_viewport is set to false. The second config-group sets the color and sets opacity value to 0.0, so it makes the minimap non visible. BUT, the third group causes the opacity value to be 1 when you hover the minimap (see the attribute in the config group), so it makes the minimap visible when you hover the mouse over it. And this happens if always_show_minimap_viewport is set to false.

    0 讨论(0)
提交回复
热议问题