如何在 sublime 中更改右侧边栏(miniMap)的颜色? [英] How to change the color of right sidebar (miniMap) in sublime?

查看:89
本文介绍了如何在 sublime 中更改右侧边栏(miniMap)的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

右侧边栏中有一个矩形区域,在整个文件的上下文中显示您所在的当前代码块,但是有点难以看清,有谁知道如何使颜色更明显?

>

解决方案

是的,可以改变小地图的颜色.此外还有一些设置可以让您更容易看到小地图:

  • draw_minimap_border:启用它以查看小地图边框.
  • always_show_minimap_viewport:使小地图始终可见(即使鼠标不在小地图附近).

示例用户设置(使用菜单首选项>设置,有关详细信息,请参阅此答案关于崇高的用户设置文件格式):

<代码>{always_show_minimap_viewport":真,draw_minimap_border":真}

如何改变小地图的颜色?

要更改小地图的颜色,您应该在主题文件中进行.默认主题文件名为 Default.sublime-theme 但如果您使用不同的下载主题,则此文件名可能会有所不同.您需要更改minimap_control 类中viewport_color 属性的值.为此,您有两个主要选择:

  • 选项 1:覆盖新文件中的值.在您的用户文件夹中创建一个名为 Default.sublime-theme 的文件(您可以使用菜单 Preferences>Browse-packages 找到您的用户文件夹,然后打开名为 user 的文件夹).将此内容设置到文件中,如果需要,使用其他颜色值,将其保存为 fileName Default.sublime-theme(假设您使用的是默认主题),然后重新启动:

    <预><代码>[{"class": "minimap_control",设置":[always_show_minimap_viewport"],"viewport_color": [68, 200, 240, 96],viewport_opacity":1.0,},{"class": "minimap_control",设置":[!always_show_minimap_viewport"],"viewport_color": [68, 200, 240, 96],"viewport_opacity": { "target": 0.0, "speed": 4.0, "interpolation": "smoothstep" },},{"class": "minimap_control",属性":[悬停"],设置":[!always_show_minimap_viewport"],"viewport_opacity": { "target": 1.0, "speed": 20.0, "interpolation": "smoothstep" },},]

  • 选项 2:直接编辑您的主题文件.如果您使用的是 Linux 和默认主题,您通常可以在 /opt/sublime_text/Packages/Theme - Default.sublime-package 中找到 Default.sublime-theme.如果您使用的是 Windows 和默认主题,您通常可以在 C:/Program Files/Sublime Text 3/Packages/Theme - Default.sublime-package 中找到 Default.sublime-themeem>.

<小时>

示例结果:

  1. 默认小地图:

  2. 默认小地图,选项 draw_minimap_border 设置为 true.

  3. 带有自定义颜色 ([68, 200, 240, 96]) 和边框的小地图

<小时>

额外解释关于"settings": ["!always_show_minimap_viewport"] 在上一个文件中的含义.这意味着配置组仅在 sublime 设置 always_show_minimap_viewport 值设置为 false 时使用.另一方面 "settings": ["always_show_minimap_viewport"] 表示只有在 sublime 设置 always_show_minimap_viewport 设置为 true 时才使用配置组>.

更详细地说,第一个配置组只是设置小地图颜色并使不透明度=1,因此,它使小地图始终可见,并且仅在always_show_minimap_viewport设置为`true时使用.

最后两个配置组仅在 always_show_minimap_viewport 设置为 false 时使用.第二个配置组设置颜色并将不透明度值设置为 0.0,因此它使小地图不可见.但是,当您将鼠标悬停在小地图上时,第三组会导致不透明度值为 1(请参阅配置组中的属性),因此当您将鼠标悬停在小地图上时,它会使小地图可见.如果 always_show_minimap_viewport 设置为 false,就会发生这种情况.

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 how to make the color more obvious?

解决方案

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.

这篇关于如何在 sublime 中更改右侧边栏(miniMap)的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆