我尝试在范围内的文本下添加一条蓝线,但文本周围始终出现蓝框或整个文本为蓝色
const blueMarkToggleType = vscode.window.createTextEditorDecorationType({
isWholeLine: false, // apply the text decoration only to the marked characters
textDecoration: "underline", // solid, dark blue line under the text
color: "#0000FF", // solid, dark blue color for the text decoration
overviewRulerLane: vscode.OverviewRulerLane.Center
});
1条答案
按热度按时间nhaq1z211#
textDecoration
可以有比underline
更多的选项,它可以直接包含下划线的颜色-所以下面的代码将创建一个蓝色下划线,而不需要对所有文本进行着色(color
选项适用于所有文本):要尝试处理您选择的
textDecoration
颜色(我不认为这是可主题化的)在黑暗和光明主题中的显示方式,您可以通过添加dark
和light
选项来覆盖默认的textDecoration
: