如何使用Blockman扩展设置VS Code代码块的背景颜色?

huangapple go评论106阅读模式
英文:

How to set VS Code code block background coloring from the Blockman extension?

问题

我正在使用leodevbro.blockman扩展。我如何设置我在图片中标记的代码块的新颜色?

在"workbench.colorCustomizations"中,我应该设置哪个属性?

我能否在不添加新扩展的情况下实现这个目标?

我标记在图片中的颜色应该随我的设置而改变。

英文:

I'm using the leodevbro.blockman extension. How can I set a new color to code block that I have marked in the picture?

Which property I should set in "workbench.colorCustomizations"?

Can I achieve it without adding a new extension?

如何使用Blockman扩展设置VS Code代码块的背景颜色?

The color that I marked in picture should change with my settings.

答案1

得分: 0

如果您想要更改编辑器面板的背景,您需要查找的颜色自定义点是editor.background。例如:

"workbench.colorCustomizations": {
    "editor.background": "#ff0000", // TODO
    "editor.lineHighlightBackground": "#ff0000", // TODO

    // 要查看其他可用选项,请取消下面一行的注释,
    // 并将光标放在末尾并触发建议。
    // "editor.background
}

关于blockman,请参阅其文档:https://github.com/leodevbro/vscode-blockman#all-blockman-settings,其中在其自述文件中包含以下内容:

"blockman.n04ColorComboPreset": "Classic Dark 1 (Gradients)", // 这不会更改VS Code主题。选择颜色组合的预设。如果不为空字符串,则相应的颜色将被自定义颜色覆盖。此设置可以被下面的3个组合设置覆盖
"blockman.n04Sub01ColorComboPresetForDarkTheme": "none", // 当当前主题类型为Dark时应用的颜色组合。
"blockman.n04Sub02ColorComboPresetForLightTheme": "none", // 当当前主题类型为Light时应用的颜色组合。
"blockman.n04Sub03ColorComboPresetForHighContrastTheme": "none", // 当当前主题类型为High Contrast时应用的颜色组合。

"blockman.n05CustomColorOfDepth0": "", // 任何CSS颜色,例如rgb、rgba、hsl。如果要与编辑器背景颜色相同,请输入“none”。

"blockman.n06CustomColorOfDepth1": "", // 任何CSS颜色,例如rgb、rgba、hsl。如果要与编辑器背景颜色相同,请输入“none”。
"blockman.n07CustomColorOfDepth2": "", // 任何CSS颜色,例如rgb、rgba、hsl。如果要与编辑器背景颜色相同,请输入“none”。
"blockman.n08CustomColorOfDepth3": "", // 任何CSS颜色,例如rgb、rgba、hsl。如果要与编辑器背景颜色相同,请输入“none”。
"blockman.n09CustomColorOfDepth4": "", // 任何CSS颜色,例如rgb、rgba、hsl。如果要与编辑器背景颜色相同,请输入“none”。
"blockman.n10CustomColorOfDepth5": "", // 任何CSS颜色,例如rgb、rgba、hsl。如果要与编辑器背景颜色相同,请输入“none”。

"blockman.n11CustomColorOfDepth6": "", // 任何CSS颜色,例如rgb、rgba、hsl。如果要与编辑器背景颜色相同,请输入“none”。
"blockman.n12CustomColorOfDepth7": "", // 任何CSS颜色,例如rgb、rgba、hsl。如果要与编辑器背景颜色相同,请输入“none”。
"blockman.n13CustomColorOfDepth8": "", // 任何CSS颜色,例如rgb、rgba、hsl。如果要与编辑器背景颜色相同,请输入“none”。
"blockman.n14CustomColorOfDepth9": "", // 任何CSS颜色,例如rgb、rgba、hsl。如果要与编辑器背景颜色相同,请输入“none”。
"blockman.n15CustomColorOfDepth10": "", // 任何CSS颜色,例如rgb、rgba、hsl。如果要与编辑器背景颜色相同,请输入“none”。

"blockman.n17CustomColorOfFocusedBlock": "", // 需要将“Enable Focus”设置为true/启用。如果要与未聚焦时的颜色相同,请输入“same”。
"blockman.n18CustomColorOfFocusedBlockBorder": "", // 需要将“Enable Focus”设置为true/启用。如果要与未聚焦时的颜色相同,请输入“same”。
"blockman.n19CustomColorOfBlockBorder": "",
"blockman.n20CustomColorOfDepth0Border": "",

// 高级着色:
// 视频教程:https://youtu.be/UsET6-kPu90

// 文本说明:
// '!' 表示禁用。
// 如果启用了高级着色字符串,它将覆盖基本着色设置。

// 右侧:颜色/渐变的序列。

// 左侧:
// --- 第一个数字与优先级相关,
// --- 第二个数字与第一个循环的第一个项目的从零开始的索引相关,因此它将序列分成不应循环的部分和应循环的部分,
// --- 第三个数字与循环部分的反转相关(0:原始,1:反转),
// --- 第四个数字与循环策略相关(0:所有连续项都是“中性”的,“中性”表示它将被任何其他设置覆盖,1:只有最后一项将被循环。是的,它将忽略第二个选项数字(分割索引),2:正向循环,3:正向和反向的一对)。

// “中性”颜色表示它将被任何其他着色设置覆盖。
// “基本”颜色表示它将从基本颜色设置中设置颜色。

// “透明”和部分透明的颜色对于边框来说效果很好,但是背景在使用这些值时会有一些问题,
// 因此,如果在背景上输入“透明”,它将是VS Code编辑器背景的颜色。

"blockman.n33A01B1FromDepth0ToInwardForAllBorders": "!10,0,0,0; red > green > blue",
"blockman.n33A01B2FromDepth0ToInwardForAllBackgrounds": "!10,1,0,3; hsl(235, 30%, 7%) > hsl(0, 0%, 7.1%) > hsl(0, 0%, 9.5%) > hsl(0, 0%, 11.15%) > hsl(0, 0%, 12.8%)",

"blockman.n33A02B1FromFocusToOutwardForAllBorders": "!20,0,0,0; red > green > blue",
"blockman.n33A02B2FromFocusToOutwardForAllBackgrounds": "!20,0,0,0; red > green > blue",

"blockman.n33A03B1FromDepth0ToInwardForFocusTreeBorders": "!30,1,0,2; linear-gradient(to right, hsl(251, 22%, 25%), hsl(292, 20%, 18%)) > linear-gradient(to right, hsl(20, 50%, 30%), hsl(250, 30%, 30%))",
"blockman.n33A03B2FromDepth0ToInwardForFocusTreeBackgrounds": "!30,0,0,0; red > green > blue",

"blockman.n33A04B1FromFocusToOutwardForFocusTreeBorders": "40,0,0,0; basic",
"blockman.n33A04B2FromFocusToOutwardForFocusTreeBackgrounds": "40,0,0,0; basic",

"blockman.n33A05B1FromFocusToInwardForAllBorders": "!50,0,0,0; red > green > blue",
"blockman.n33A05B2FromFocusToInwardForAllBackgrounds": "!50,0,0,0; red > green > blue",

对于在Markdown预览和扩展页面中呈现的代码块,请使用textCodeBlock.background

英文:

If you want to change the background of the editor panels, the colour customization point you're looking for is editor.background. Ex.

"workbench.colorCustomizations": {
    "editor.background": "#ff0000", // TODO
    "editor.lineHighlightBackground": "#ff0000", // TODO

    // To find out what else is available, uncomment the following line,
    // and put your cursor at the end of it and trigger suggestions.
    // "editor.background
}

For blockman, see its docs: https://github.com/leodevbro/vscode-blockman#all-blockman-settings, which has the following in its readme:

> json
> "blockman.n04ColorComboPreset": "Classic Dark 1 (Gradients)", // This does not change VS Code theme. Choose preset combo of colors. Corresponding colors are overridden by custom colors (if not empty string). Also This setting can be overriden by the next 3 combo settings
> "blockman.n04Sub01ColorComboPresetForDarkTheme": "none", // Color combo to apply when current theme kind is Dark.
> "blockman.n04Sub02ColorComboPresetForLightTheme": "none", // Color combo to apply when current theme kind is Light.
> "blockman.n04Sub03ColorComboPresetForHighContrastTheme": "none", // Color combo to apply when current theme kind is High Contrast.
>
> "blockman.n05CustomColorOfDepth0": "", // Any CSS color, e.g. rgb, rgba, hsl. Type 'none' for same color as editor background.
>
> "blockman.n06CustomColorOfDepth1": "", // Any CSS color, e.g. rgb, rgba, hsl. Type 'none' for same color as editor background.
> "blockman.n07CustomColorOfDepth2": "", // Any CSS color, e.g. rgb, rgba, hsl. Type 'none' for same color as editor background.
> "blockman.n08CustomColorOfDepth3": "", // Any CSS color, e.g. rgb, rgba, hsl. Type 'none' for same color as editor background.
> "blockman.n09CustomColorOfDepth4": "", // Any CSS color, e.g. rgb, rgba, hsl. Type 'none' for same color as editor background.
> "blockman.n10CustomColorOfDepth5": "", // Any CSS color, e.g. rgb, rgba, hsl. Type 'none' for same color as editor background.
>
> "blockman.n11CustomColorOfDepth6": "", // Any CSS color, e.g. rgb, rgba, hsl. Type 'none' for same color as editor background.
> "blockman.n12CustomColorOfDepth7": "", // Any CSS color, e.g. rgb, rgba, hsl. Type 'none' for same color as editor background.
> "blockman.n13CustomColorOfDepth8": "", // Any CSS color, e.g. rgb, rgba, hsl. Type 'none' for same color as editor background.
> "blockman.n14CustomColorOfDepth9": "", // Any CSS color, e.g. rgb, rgba, hsl. Type 'none' for same color as editor background.
> "blockman.n15CustomColorOfDepth10": "", // Any CSS color, e.g. rgb, rgba, hsl. Type 'none' for same color as editor background.
>
> "blockman.n17CustomColorOfFocusedBlock": "", // Requires 'Enable Focus' to be true/enabled. Type 'same' if you want it to be same color as if not focused.
> "blockman.n18CustomColorOfFocusedBlockBorder": "", // Requires 'Enable Focus' to be true/enabled. Type 'same' if you want it to be same color as if not focused.
> "blockman.n19CustomColorOfBlockBorder": "",
> "blockman.n20CustomColorOfDepth0Border": "",
>
> // Advanced Coloring:
> // Video instruction: https://youtu.be/UsET6-kPu90
>
> // Textual instruction:
> // '!' means disabled.
> // Advanced coloring string, if enabled, will override basic coloring settings.
>
> // Right side: sequence of colors/gradients.
>
> // Left side:
> // --- FIRST number relates priority,
> // --- SECOND number relates zero-based index of first item of first loop, So it splits the sequence into what should not be looped and what should be looped,
> // --- THIRD number relates loop part reversion (0: original, 1: reversed),
> // --- FOURTH number relates looping strategy (0: all the continuation items to be 'neutral', 'neutral' means it will be overriden by any other setting, 1: Only the last item will be looped. Yes, it will ignore the SECOND option number (split index), 2: loop as forward, 3: loop as pair of forward and backward).
>
> // 'neutral' color means it will be overriden by any other coloring setting.
> // 'basic' color means it will set a color from basic color settings.
>
> // 'transparent' and partially transparent colors work fine for borders, but backgrounds have some problems with such values,
> // so, if you type 'transparent' on background, it will be the color of VS Code editor backgound.
>
> "blockman.n33A01B1FromDepth0ToInwardForAllBorders": "!10,0,0,0; red > green > blue",
> "blockman.n33A01B2FromDepth0ToInwardForAllBackgrounds": "!10,1,0,3; hsl(235, 30%, 7%) > hsl(0, 0%, 7.1%) > hsl(0, 0%, 9.5%) > hsl(0, 0%, 11.15%) > hsl(0, 0%, 12.8%)",
>
> "blockman.n33A02B1FromFocusToOutwardForAllBorders": "!20,0,0,0; red > green > blue",
> "blockman.n33A02B2FromFocusToOutwardForAllBackgrounds": "!20,0,0,0; red > green > blue",
>
> "blockman.n33A03B1FromDepth0ToInwardForFocusTreeBorders": "!30,1,0,2; linear-gradient(to right, hsl(251, 22%, 25%), hsl(292, 20%, 18%)) > linear-gradient(to right, hsl(20, 50%, 30%), hsl(250, 30%, 30%))",
> "blockman.n33A03B2FromDepth0ToInwardForFocusTreeBackgrounds": "!30,0,0,0; red > green > blue",
>
> "blockman.n33A04B1FromFocusToOutwardForFocusTreeBorders": "40,0,0,0; basic",
> "blockman.n33A04B2FromFocusToOutwardForFocusTreeBackgrounds": "40,0,0,0; basic",
>
> "blockman.n33A05B1FromFocusToInwardForAllBorders": "!50,0,0,0; red > green > blue",
> "blockman.n33A05B2FromFocusToInwardForAllBackgrounds": "!50,0,0,0; red > green > blue",
>

For code blocks rendered in things like Markdown Preview and extension pages, use textCodeBlock.background.

答案2

得分: -1

你可以使用"workbench.colorCustomization"来设置背景颜色,在其中可以给"editor.background"设置你想要的颜色值。这是我代码中的一个示例:

workbench.colorCustomizations": {
     "tab.activeBackground": "#23272e",
     "tab.inactiveBackground": "#2c2f38",
     "tab.hoverBackground": "#323842",
     "activityBar.background": "#2c2f38",
     "activityBar.foreground": "#d7dae0",
     "activityBarBadge.background": "#d7dae0",
     "activityBarBadge.foreground": "#23272e",
     "badge.background": "#404754",
     "sideBar.background": "#282c34",
     "sideBar.foreground": "#abb2bf",
     "tab.activeBorder": "#d19a66",
     "editor.background": "#23272e",
     "editor.foreground": "#abb2bf",
     "button.background": "#404754",
     "debugToolBar.background": "#21252b",
     "descriptionForeground": "#abb2bf",
     "dropdown.background": "#1e2227",
     "dropdown.border": "#404754",
     "statusBar.background": "#404754",
     "titleBar.activeBackground": "#404754",
     "focusBorder": "#404754",
     "editorSuggestWidget.selectedBackground": "#2c313a",
     "panel.border": "#404754",
     "scrollbarSlider.background": "#4e566660",
     "scrollbarSlider.activeBackground": "#747d9180",
     "scrollbarSlider.hoverBackground": "#5a637580"
   },
英文:

You can set the background color use "workbench.colorCustomization", inside that you can give "editor.background" color value what you want. This is the example from my code:

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

workbench.colorCustomizations&quot;: {
&quot;tab.activeBackground&quot;: &quot;#23272e&quot;,
&quot;tab.inactiveBackground&quot;: &quot;#2c2f38&quot;,
&quot;tab.hoverBackground&quot;: &quot;#323842&quot;,
&quot;activityBar.background&quot;: &quot;#2c2f38&quot;,
&quot;activityBar.foreground&quot;: &quot;#d7dae0&quot;,
&quot;activityBarBadge.background&quot;: &quot;#d7dae0&quot;,
&quot;activityBarBadge.foreground&quot;: &quot;#23272e&quot;,
&quot;badge.background&quot;: &quot;#404754&quot;,
&quot;sideBar.background&quot;: &quot;#282c34&quot;,
&quot;sideBar.foreground&quot;: &quot;#abb2bf&quot;,
&quot;tab.activeBorder&quot;: &quot;#d19a66&quot;,
&quot;editor.background&quot;: &quot;#23272e&quot;,
&quot;editor.foreground&quot;: &quot;#abb2bf&quot;,
&quot;button.background&quot;: &quot;#404754&quot;,
&quot;debugToolBar.background&quot;: &quot;#21252b&quot;,
&quot;descriptionForeground&quot;: &quot;#abb2bf&quot;,
&quot;dropdown.background&quot;: &quot;#1e2227&quot;,
&quot;dropdown.border&quot;: &quot;#404754&quot;,
&quot;statusBar.background&quot;: &quot;#404754&quot;,
&quot;titleBar.activeBackground&quot;: &quot;#404754&quot;,
&quot;focusBorder&quot;: &quot;#404754&quot;,
&quot;editorSuggestWidget.selectedBackground&quot;: &quot;#2c313a&quot;,
&quot;panel.border&quot;: &quot;#404754&quot;,
&quot;scrollbarSlider.background&quot;: &quot;#4e566660&quot;,
&quot;scrollbarSlider.activeBackground&quot;: &quot;#747d9180&quot;,
&quot;scrollbarSlider.hoverBackground&quot;: &quot;#5a637580&quot;
},

<!-- end snippet -->

huangapple
  • 本文由 发表于 2023年8月9日 13:59:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/76864945.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定