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

…衆ロ難τιáo~ 提交于 2019-12-03 11:00:24
sergioFC

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:

  2. Default minimap with option draw_minimap_border set to true.

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


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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!