如何更改Sublime Text 3的背景颜色? [英] How to change background color of Sublime Text 3?

查看:164
本文介绍了如何更改Sublime Text 3的背景颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Sublime Text 3 Build3154.我当前正在使用Material Theme UI Darker.问题是我不知道使背景颜色(我们编码的区域)更暗.请帮我怎么做?我为侧边栏,状态栏和标题栏启用了对比模式.我想使我们编码的地方的背景颜色与对比模式相同.请帮忙.

I am using Sublime Text 3 Build 3154. I am currently using Material Theme UI Darker. The problem is I don't know to make the background color (the area where we code) a bit darker. Please help me how can I do this? I enabled contrast mode for sidebar, status bar and title bar. I want to make the background color of where we code the same as contrast mode. Please help.

我的崇高文字3的设置:

Settings of my Sublime Text 3:

{
    "always_show_minimap_viewport": true,
    "background": "red",
    "bold_folder_labels": true,
    "color_scheme": "Packages/Material Theme/schemes/Material-Theme-Darker.tmTheme",
    "font_size": 16,
    "highlight_line": true,
    "ignored_packages":
    [
        "Material Theme - Appbar",
        "Theme - Dark Material",
        "Vintage"
    ],
    "indent_guide_options":
    [
        "draw_normal",
        "draw_active"
    ],
    "line_padding_bottom": 7,
    "line_padding_top": 7,
    "material_theme_accent_scrollbars": true,
    "material_theme_accent_yellow": true,
    "material_theme_big_fileicons": true,
    "material_theme_bold_tab": true,
    "material_theme_bullet_tree_indicator": true,
    "material_theme_contrast_mode": true,
    "material_theme_small_statusbar": true,
    "overlay_scroll_bars": "enabled",
    "theme": "Material-Theme-Darker.sublime-theme"
}

请帮助我.我正在使用最新版本的Material Theme

Please Help me. I am using latest version of Material Theme

推荐答案

您正在使用的Theme修改UI的整体外观,其中包括诸如边栏,状态栏,标签形状等内容. .在任何时候,只有Theme处于活动状态,因为它是应用程序范围内的.

The Theme that you're using modifies the overall look of the UI, which includes things like the sidebar, status bar, tab shape, and so on. At any one time there can only ever be one Theme active, since it is application wide.

相反,用于编辑文件的视图内部使用的颜色由Color Scheme控制.与Themes不同,可以在逐个标签或逐个文件的基础上修改配色方案.

In contrast, colors used in inside of the views used to edit files are controlled by a Color Scheme. Unlike Themes, the color scheme can be modified in a tab-by-tab or file-by-file basis.

因此,要更改文件编辑视图的背景色,您需要更改所使用的配色方案.

So in order to change the background color of a file editing view, you need to make changes to the color scheme that you're using.

正在使用的配色方案是通过color_scheme设置来设置的,您可以通过从菜单中选择Preferences > Settings来看到(在MacOS的菜单中,PreferencesSublime Text下).

The color scheme that is in use is set by the color_scheme setting, which you can see by selecting Preferences > Settings from the menu (Preferences is under Sublime Text in the menu on MacOS).

如果设置了自定义的配色方案,则将在此窗口的右窗格中看到它;否则,您的配色方案是默认方案,您将在左侧窗格中找到它.

If you have a custom color scheme set, you will see it in the right hand pane of this window; otherwise your color scheme is the default, which you will find in the left hand pane.

根据您的帖子,当前正在使用的配色方案为"Packages/Material Theme/schemes/Material-Theme-Darker.tmTheme".

According to your post, the color scheme that is currently in use is "Packages/Material Theme/schemes/Material-Theme-Darker.tmTheme".

这告诉您需要更改的文件是Material-Theme-Darker.tmTheme,它包含在Material Theme包中的一个名为schemes的文件夹中.

This is telling you that the file that needs to be altered is Material-Theme-Darker.tmTheme, and it is contained inside the Material Theme package in a folder named schemes.

如何进行所需的更改取决于color_scheme设置中提到的文件的扩展名,该文件的扩展名还取决于您当前正在使用的Sublime Text 3的构建以及主题本身的作者.

How you make the change you desire depends on the extension of the file mentioned in the color_scheme setting, which itself also depends on the build of Sublime Text 3 that you're currently using and the author of the theme itself.

tmTheme类型的文件是XML格式的文件,基于MacOS中的Plist文件格式.这是Sublime Text中使用的经典"或旧式"配色方案格式;它是从TextMate继承的.为了修改这些文件中的颜色,您需要修改文件本身,这需要您首先打开文件.

Files of type tmTheme are XML formatted files based on the Plist file format from MacOS. This is the "classic" or "legacy" color scheme format used in Sublime Text; it's inherited from TextMate. In order to modify colors in these files, you need to modify the file itself, which requires you to first open the file.

Sublime软件包中的文件通常被压缩为sublime-package文件,这要求您为文件创建替代,以使Sublime忽略软件包中的版本并改为使用您的文件.

Files in Sublime packages are generally compressed into sublime-package files, which requires you to create an override for the file to get Sublime to ignore the version in the package and use yours instead.

有时,软件包可能作为Packages文件夹内的一组文件解压缩"安装.不管您使用的主题如何安装,以下说明都将起作用.

Occasionally a package may be installed "Unpacked" as a set of files inside of the Packages folder. The following instructions will work regardless of how the theme that you're using is installed.

第一步是打开要修改的文件.最简单的方法是使用 PackageResourceViewer (如果尚未使用,请先安装) :

The first step is to open the file that you want to modify. The easiest way to do that is to use PackageResourceViewer (install it first if you're not already using it):

  1. 打开命令选项板,然后输入prvor来选择PackageResourceViewer: Open Resource命令以过滤列表
  2. 选择包含主题的包(此处为Material Theme)
  3. 选择要打开的文件(在这里选择schemes,然后选择Material-Theme-Darker.tmTheme
  1. Open the command palette and select the PackageResourceViewer: Open Resource command by entering prvor to filter the list
  2. Select the package that contains the theme (here Material Theme)
  3. Select the file that you want to open (here select schemes, then Material-Theme-Darker.tmTheme

这将打开文件,您看到的是Sublime当前用作配色方案的文件.您对此文件所做的任何修改都会立即对您所演唱的配色方案生效.

This opens the file, and what you're seeing is the file that Sublime is currently using as your color scheme. Any modifications you make to this file will immediately take effect on the color scheme that you're sing.

通常来说,您将适当地编辑此文件的内容,以应用所需的任何颜色.在您的情况下,您想修改文本区域的背景颜色,因此在文件顶部附近,您会看到一个部分看起来像这样的部分(这是来自默认的Monokai配色方案):

Generally speaking you would edit the contents of this file as appropriate to apply any color(s) that you want. In your case you want to modify the background color of the text area, so near the top of the file you're going to see a section that looks somewhat like this (this is from the default Monokai color scheme):

<key>settings</key>
<dict>
    <key>background</key>
    <string>#272822</string>
    <key>caret</key>
    <string>#F8F8F0</string>
    <key>foreground</key>
    <string>#F8F8F2</string>
    <key>invisibles</key>
    <string>#3B3A32</string>
    <key>lineHighlight</key>
    <string>#3E3D32</string>
    <key>selection</key>
    <string>#49483E</string>
    <key>findHighlight</key>
    <string>#FFE792</string>
    <key>findHighlightForeground</key>
    <string>#000000</string>
    <key>selectionBorder</key>
    <string>#222218</string>
    <key>activeGuide</key>
    <string>#9D550FB0</string>
    <key>misspelling</key>
    <string>#F92672</string>
    <key>bracketsForeground</key>
    <string>#F8F8F2A5</string>
    <key>bracketsOptions</key>
    <string>underline</string>
    <key>bracketContentsForeground</key>
    <string>#F8F8F2A5</string>
    <key>bracketContentsOptions</key>
    <string>underline</string>
    <key>tagsOptions</key>
    <string>stippled_underline</string>
</dict>

这将为配色方案设置各种全局颜色.文件的其余部分用于根据您正在查看的语言的语法将特定的颜色应用于文件的内容.

This sets various global colors for the color scheme. The rest of the file is for applying specific colors to the contents of files based on the syntax of the language that you're viewing.

根据您的情况,您想要修改背景色,因此将background属性的值修改为所需的颜色.对于您来说,看起来像这样:

In your case you want to modify the background color, so modify the value of the background property to the color that you want. For you, that would look like this:

<key>background</key>
<string>#1a1a1a</string>

保存文件后,您应该立即看到所做的更改立即在所有打开的文件中生效.

As soon as you save the file, you should see the change immediately take effect in all of your open files.

保存时,如果文件是sublime-package文件的一部分,则将为此文件创建override,该文件将代替sublime-package文件中的版本使用.

When you save, if the file was a part of a sublime-package file, an override wil be created for this file, which will be used instead of the version in the sublime-package file.

发生这种情况时,即使包作者更新了配色方案,您的覆盖也将始终有效. Sublime不会告诉您这正在发生.

When that happens, your override will always be in effect even if the package author updates the color scheme. Sublime won't tell you that this is happening.

OverrideAudit 软件包会在发生这种情况时向您发出警告,因此您可以通过以下方式处理这种情况如果您对此有所担心,请更改文件以使其与新文件匹配或将其完全删除.

The OverrideAudit package will give you warnings when this happens to you, so you can handle the situation by changing your file to match the new one or removing it altogether, if you're concerned about this.

这种类型的文件是一种新型的配色方案格式,它是基于JSON而不是基于XML的.

Files of this type are a new type of color scheme format that is JSON based instead of XML based.

目前(2018年1月8日),这种格式的配色方案仅在开发版本中可用,但是在将来的某个时候,它们将成为今后配色方案的新文件格式.

At the present time (January 8, 2018) color schemes of this format are only available in development builds, but at some point in the future they will become the new file format for color schemes going forward.

与大多数Sublime资源一样,此类型的文件为additive;所有包中具有相同名称的所有资源都将在运行时加载并组合在一起.

Like most Sublime resources, files of this type are additive; all resources with the same name from all packages are loaded and combined together at run time.

为了在此处查看需要修改的内容,请打开命令面板"并通过输入vpf来选择View Package File命令以过滤命令列表,然后从显示的列表中选择适当的软件包文件,该列表所有软件包文件的格式都与color_scheme设置相同.

In order to see what you need to modify here, open the Command Palette and select the View Package File command by by entering vpf to filter the command list, then select the appropriate package file from the list presented, which lists all package files in the same format as the color_scheme setting.

注意::此命令仅在Sublime的最新开发版本中提供,因此,如果您使用的是较早的版本,则看不到此命令;在那种情况下,我假设您也不会看到这种格式的配色方案,但以防万一,您还可以使用上方的PackageResourceViewer步骤来查看文件.

Note: This command is only present in recent development versions of Sublime, so you won't see it if you're using an older build; I would assume in that case you also won't see color schemes in this format, but just in case you can also use the PackageResourceViewer steps from above to look at the file.

这次,您看到的文件是相同数据的JSON解释.同样,这是文件顶部附近的相关部分,此示例是默认的Monokai配色方案.确保您请勿保存此文件,只需对其进行查看即可.

This time the file that you see is a JSON interpretation of the same data. Again, here is a relevant section near the top of the file, where this example is the default Monokai color scheme. Make sure that you DO NOT save this file, just take a look at it.

"globals":
{
    "foreground": "var(white3)",
    "background": "var(black3)",
    "caret": "var(white2)",
    "invisibles": "color(var(white3) alpha(0.35))",
    "line_highlight": "var(yellow4)",
    "selection": "var(grey)",
    "selection_border": "var(black2)",
    "misspelling": "var(red2)",
    "active_guide": "color(var(orange2) alpha(0.69))",
    "find_highlight_foreground": "var(black)",
    "find_highlight": "var(orange3)",
    "brackets_options": "underline",
    "brackets_foreground": "color(var(white3) alpha(0.65))",
    "bracket_contents_options": "underline",
    "bracket_contents_foreground": "color(var(white3) alpha(0.65))",
    "tags_options": "stippled_underline"
},

在此示例中,大多数颜色来自上方的变量部分,它使您可以轻松更改颜色,并在引用该变量的任何地方使其表示形式更改.

In this example, most of the colors are coming from a variables section just above, which allows you to easily change a color and have its representation change everywhere that the variable is referenced.

为了更改类型为sublime-color-scheme的文件中的项目,而不是保存此文件,而是在User程序包中创建了一个具有相同名称的新文件,并仅在其中包含颜色的那些部分.您要更改的方案.

In order to alter items in a file of type sublime-color-scheme, instead of saving this file, you create a new file in your User package that has the same name, and include in it only those parts of the color scheme that you want to change.

在这里的示例中,您将创建一个包含以下内容的文件,并将其保存为Material-Theme-Darker.sublime-color-scheme包在您的User包中.

In our example here, you would do that be creating a file with the following contents and saving it in your User package as Material-Theme-Darker.sublime-color-scheme.

{
    "globals":
    {
        "background": "rgb(26,26,26)"
    }
}

如上所述,保存此文件后,您应该会看到颜色的变化.

As above, as soon as you save this file, you should see the color change.

此文件与我们正在查看的默认文件结合在一起,但是这里我们仅提供背景色,其余内容取自原始文件.

This file is combined with the default file that we were looking at, but here we just provide a background color and the rest of the content is taken from the original.

此颜色方案处于活动状态时,此版本的文件(以及您的背景颜色更改)将始终生效,无论基础颜色方案认为背景颜色应该是什么.

This version of the file (and thus your background color change) will always take effect when this color scheme is active, regardless of what the underlying color scheme thinks the background color should be.

这篇关于如何更改Sublime Text 3的背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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