VsCode 自定义个性样式

2,704 阅读1分钟

一、安装 Custom CSS and JS Loader 插件

image.png

二、创建本地(放在自己的服务器上也可以)修改后的样式文件

创建文件custom.css(放在一般不会移动文件位置的地方),将以下内容复制进去(仅供参考,可自定义)

/* 光标指针 */
.cursor.monaco-mouse-cursor-text {
	transition: all 0.1s ease-out !important;
	border-radius: 2px !important;
	background: radial-gradient(
		circle at right bottom,
		hsl(230, 65%, 50%),
		hsl(290, 77%, 52%)
	) !important;
}

/* 文件tab划过显示过渡条 */
.monaco-workbench .part.editor > .content
.editor-group-container.active > .title
.tabs-container > .tab {
	position: relative;
}
.monaco-workbench .part.editor > .content
.editor-group-container.active > .title
.tabs-container > .tab::after {
	content: '';
	display: block;
	width: 0%;
	height: 2px;
	position: absolute;
	transition: all .4s;
	bottom: 0px;
}
.monaco-workbench .part.editor > .content
.editor-group-container.active > .title
.tabs-container > .tab:hover::after{
	width: 100%;
	background: radial-gradient( circle at right bottom, hsl(230, 65%, 50%), hsl(290, 77%, 52%) ) !important;
}

.monaco-workbench .part.editor > .content
.editor-group-container.active > .title
.tabs-container > .tab[aria-selected="true"]::after{
	width: 100%;
	background: radial-gradient( circle at right bottom, hsl(230, 65%, 50%), hsl(290, 77%, 52%) ) !important;
}

/* 侧边栏选中样式 */
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked .active-item-indicator:before{
	border-left: none !important;
	position: absolute;
	left: 0px;
	width: 2px;
	height: 100%;
	background: radial-gradient( circle at right bottom, hsl(230, 65%, 50%), hsl(290, 77%, 52%) ) !important;
}

打开VsCodesettings.json文件添加以下代码(注意自己的文件路径)

  "vscode_custom_css.imports": [
    "xxxxx"
  ],

image.png

三、执行命令生效配置

按键command + shift + p后输入Reload Custom CSS and JS回车,之后VsCode会重启;看下以下情况说明配置生效了。

image.png

四、自定义配置

想要什么效果自己写Css就好了,需要注意的是每次修改后都需要执行命令让配置生效(执行命令会重启VsCode,如果提示配置错误可以忽略,没有影响); VsCode可自定义样式有很多,打开审查VsCode元素查看dom结构重写样式即可(如图);

image.png

image.png