4、css定制
css定制
目录
[toc]
个人定制css原则
- 橙 黄色主色调,简约美观
自定义typora主题
参考链接
https://developer.mozilla.org/en-US/
主题配置原则
- 尽量以护眼绿为主,要注意色调搭配。
- 要简洁,不要太花,要以文字为重点。
主题名称命名原则
typora主题命名规则
typora-theme-主题名称_版本号
例子:
typora-theme-xx_v1.0
个人喜欢命名如下:
后来-2022.9.2【荐】.css
添加自定义 CSS
参考链接
https://support.typoraio.cn/Add-Custom-CSS/
提示:此功能需要 Windows 上的 Typora 高于 0.9.12 或 macOS 上的 0.9.9.5.1。
打开主题文件夹
要在 Finder/Explorer 中打开 Typora 的主题文件夹,请在外观部分打开首选项面板,单击“打开主题文件夹”按钮。在“外观”部分下。
您可以在此处添加自定义主题。如果您想查找、安装或编写主题,请参阅关于主题页面。
但是您可能只想修改 CSS,例如更改字体或增加书写区域,并将其应用于所有主题或仅当前主题,而无需编写全新的主题文件。本节向您展示如何执行此操作。
定制typora主题css文件
使用typora的时候,想要自定义一些颜色、字体,或者修改一些设置,这个时候需要修改或者自己编写css文件。
打开文件 - 偏好设置 - 外观 - 打开主题文件夹,选择你自己的主题名.css(默认是 Github.css),在最后插入 CSS 代码,保存退出,再次打开typora文件即可;
将自定义 CSS 附加到所有主题或其他主题
Typora 将按以下顺序加载 CSS 文件:
- Typora 的基本风格
- 当前主题的 CSS
- base.user.css在主题文件夹下
{current-theme}.user.css
在主题文件夹下。
如果它们不存在,您可以在主题文件夹下创建base.user.css和。{current-theme}.user.css
(1)如果要更改 CSS 样式并将其应用于所有主题,则应修改base.user.css并附加自己的 CSS,因此无论选择什么主题,您的 CSS 样式仍将被加载和应用。
(2)如果您想为特定主题修改一些 CSS ,例如“Newsprint”,您可以创建newsprint.user.css并附加您想要的 CSS。
我们不建议您直接修改主题文件的原因是:
- 安装 Typora 后可用的默认主题也可能会更新。如果发生这种情况,那么新版本只会替换主题文件夹下的现有版本,您的修改将丢失。
- 其他人开发的主题将来也可能会更改。如果他们改变了他们的 CSS 文件,你可以用你的旧文件替换他们的新文件,而不用担心你的修改会消失。
(如果你自己写 CSS 主题,那么直接修改就可以了。)
注意:文件名区分大小写。{current-theme}in{current-theme}.user.css
必须与当前主题的文件名部分相同。例如,“GitHub”主题的 CSS 文件是github.css,所以文件名部分是“github”而不是“Github”。
😂 哈哈:自己的话,直接修改.css主题就完事儿了。
如下:
后来-2022.9.5【荐】.css
调试CSS
您可以打开 Chrome/Safari DevTools 来调试元素样式。
- 在 macOS 上,您可以检查Help->Enable Debug菜单项,然后右键单击 Typora 的混合编辑视图中的任意位置,然后从上下文菜单中单击“检查元素”。
- View在 Windows/Linux 上,您可以从->Toggle DevTools菜单项打开 DevTools 。
常用样式定制
代码块
范例:仿mac图标(暗黑)
- 效果
- 代码
/* ----------------------------------------- 代码块 --------------------------------------- */
/* 代码块顶栏 */
.md-fences {
padding-top: 30px;
background-color: var(--code-top-background-color);
border: var(--code-border);
border-radius: var(--code-border-radius);
}
.md-fences::before {
position: absolute;
left: 10px;
top: 8px;
content: '';
width: 15px;
height: 15px;
border-radius: 50%;
background: rgb(252, 98, 93);
box-shadow: 25px 0px rgb(253, 188, 64),
50px 0px rgb(53, 205, 75);
}
/* 代码块主体 */
.cm-s-inner.CodeMirror {
margin: 0px;
padding: 6px;
font-family: var(--code-font-family);
font-size: var(--code-font-size);
font-weight: var(--code-font-weight);
color: var(--code-color);
background-color: var(--code-body-background-color);
border-top: 1px solid var(--code-body-border-top-color);
border-bottom-left-radius: var(--code-border-radius);
border-bottom-right-radius: var(--code-border-radius);
}
/* 代码块行号 */
.cm-s-inner .CodeMirror-linenumber {
color: var(--code-linenum-color);
font-weight: var(--code-linenum-font-weight);
}
/* 代码块光标 */
#write .CodeMirror-cursors .CodeMirror-cursor {
border-left: var(--code-cursor-border);
}
/* 行号与代码分割线 */
.CodeMirror-wrap .CodeMirror-code pre {
border-left: var(--code-divided-line-border);
}
/* 代码语言输入框 */
.md-fences .code-tooltip{
padding: 0px;
background-color: var(--code-inputbox-color);
}
.code-tooltip .ty-input{
border: var(--code-inputbox-border);
}
.code-tooltip .ty-input:focus{
border: var(--code-inputbox-focus-border);
}
/* 选中的行 */
.md-fences.md-focus .CodeMirror-code>div.CodeMirror-activeline {
background-color: var(--code-selected-line-color);
}
/* 选中的代码 */
.cm-s-inner .CodeMirror-selected {
background-color: var(--code-selected-code-color) !important;
}
.cm-s-inner .CodeMirror-selectedtext {
background-color: transparent !important;
}
/* 代码块变量颜色 */
.cm-s-inner .cm-keyword {
color: #c792ea !important;
}
.cm-s-inner .cm-operator {
color: #89ddff !important;
}
.cm-s-inner .cm-variable-2 {
color: #eeffff !important;
}
.cm-s-inner .cm-variable-3 {
color: #f07178 !important;
}
.cm-s-inner .cm-type {
color: #f07178 !important;
}
.cm-s-inner .cm-builtin {
color: #ffcb6b !important;
}
.cm-s-inner .cm-atom {
color: #f78c6c !important;
}
.cm-s-inner .cm-number {
color: #ff5370 !important;
}
.cm-s-inner .cm-def {
color: rgb(130, 170, 255) !important;
}
.cm-s-inner .cm-string {
color: #a2c077 !important;
}
.cm-s-inner .cm-string-2 {
color: #f07178 !important;
}
.cm-s-inner .cm-comment {
color: #fff !important;
}
.cm-s-inner .cm-variable {
color: #f07178 !important;
}
.cm-s-inner .cm-tag {
color: #ff5370 !important;
}
.cm-s-inner .cm-meta {
color: #ffcb6b !important;
}
.cm-s-inner .cm-attribute {
color: #c792ea !important;
}
.cm-s-inner .cm-property {
color: #c792ea !important;
}
.cm-s-inner .cm-qualifier {
color: #decb6b !important;
}
.cm-s-inner .cm-variable-3,
.cm-s-inner .cm-type {
color: #decb6b !important;
}
.cm-s-inner .cm-error {
color: #fff !important;
background-color: #ff5370 !important;
}
/* --------------------------------------------------------------------------------------- */
/* 代码块颜色 */
--code-font-family: 'Consolas';
--code-font-size: 0.9rem;
--code-font-weight: 400;
--code-color: #a6accd;
--code-border: 1px solid #000;
--code-border-radius: 10px;
--code-top-background-color:rgb(33, 37, 43); /* 代码块头部背景颜色 */
--code-body-background-color:rgb(41, 45, 62); /* 代码块主体背景颜色 */
--code-body-border-top-color: rgba(167, 178, 189, 0.2); /* 代码块主体上边框颜色 */
--code-linenum-color: #f0ad4e; /* 行号颜色 */
--code-linenum-font-weight: 500; /* 行号字粗 */
--code-cursor-border: 2px solid #fff; /* 光标配置 */
--code-divided-line-border: 1px solid white; /* 分割线配置 */
--code-inputbox-color: rgba(167, 178, 189, 0.2); /* 输入框的颜色 */
--code-inputbox-border: 2px solid #000; /* 输入框的边框配置 */
--code-inputbox-focus-border: 2px solid #61abff; /* 聚焦后输入框的边框配置 */
--code-selected-line-color: rgba(167, 178, 189, 0.2); /* 光标所在代码行的颜色 */
--code-selected-code-color: rgba(167, 178, 189, 0.2); /* 选择代码后,代码的背景色 */
范例:仿mac图标(白色)
- 效果
- 配置方法
/* 代码块 */
.md-fences::before {
content: "";
display: block;
background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgIHg9IjBweCIgeT0iMHB4IiB3aWR0aD0iNDUwcHgiIGhlaWdodD0iMTMwcHgiPgogIDxlbGxpcHNlIGN4PSI2NSIgY3k9IjY1IiByeD0iNTAiIHJ5PSI1MiIgc3Ryb2tlPSJyZ2IoMjIwLDYwLDU0KSIgc3Ryb2tlLXdpZHRoPSIyIiBmaWxsPSJyZ2IoMjM3LDEwOCw5NikiLz4KICA8ZWxsaXBzZSBjeD0iMjI1IiBjeT0iNjUiIHJ4PSI1MCIgcnk9IjUyIiAgc3Ryb2tlPSJyZ2IoMjE4LDE1MSwzMykiIHN0cm9rZS13aWR0aD0iMiIgZmlsbD0icmdiKDI0NywxOTMsODEpIi8+CiAgPGVsbGlwc2UgY3g9IjM4NSIgY3k9IjY1IiByeD0iNTAiIHJ5PSI1MiIgIHN0cm9rZT0icmdiKDI3LDE2MSwzNykiIHN0cm9rZS13aWR0aD0iMiIgZmlsbD0icmdiKDEwMCwyMDAsODYpIi8+Cjwvc3ZnPg==);
height: 30px;
width: 100%;
background-size: 40px;
background-repeat: no-repeat;
background-color: #f8f8f8;
border-radius: 5px 5px 0 0;
background-position: 6px 10px;
}
.cm-s-inner.CodeMirror {
background: #f8f8f8;
border-radius: 0 0 5px 5px;
padding: 20px 10px 20px 20px;
page-break-before: auto;
line-height: 1.65rem;
}
示例:github主题代码风格
- 配置方法
/*=======================================================代码块设置===================================================================*/
.CodeMirror-lines {
padding-left: 4px;
}
.code-tooltip {
box-shadow: 0 1px 1px 0 rgba(0,28,36,.3);
border-top: 1px solid #eef2f2;
}
.md-fences,
code,
tt {
border: 1px solid #e7eaed;
background-color: #f8f8f8;
border-radius: 3px;
padding: 0;
padding: 2px 4px 0px 4px;
font-size: 0.9em;
/* font-family: DejaVu Sans Mono, Monaco, 'Courier New', monospace; */
/* font-family: DejaVu Sans Mono, Monaco, 'Courier New', monospace; */
}
- 效果展示
示例:material主题代码风格
- 配置方法
/*=======================================================代码块设置===================================================================*/
/** ported from https://codemirror.net/theme/material.css **/
/*
Name: material
Author: Michael Kaminsky (http://github.com/mkaminsky11)
Original material color scheme by Mattia Astorino (https://github.com/equinusocio/material-theme)
*/
.cm-s-inner {
background-color: #382f26;
color: rgba(233, 237, 237, 1);
}
.cm-s-inner .CodeMirror-gutters {
background: #263238;
color: rgb(83,127,126);
border: none;
}
.cm-s-inner .CodeMirror-guttermarker, .cm-s-inner .CodeMirror-guttermarker-subtle, .cm-s-inner .CodeMirror-linenumber { color: rgb(83,127,126); }
.cm-s-inner .CodeMirror-cursor { border-left: 1px solid #f8f8f0; }
.cm-s-inner div.CodeMirror-selected { background: rgba(255, 255, 255, 0.15); }
.cm-s-inner.CodeMirror-focused div.CodeMirror-selected { background: rgba(255, 255, 255, 0.10); }
.cm-s-inner .CodeMirror-line::selection, .cm-s-inner .CodeMirror-line > span::selection, .cm-s-inner .CodeMirror-line > span > span::selection { background: rgba(255, 255, 255, 0.10); }
.cm-s-inner .CodeMirror-line::-moz-selection, .cm-s-inner .CodeMirror-line > span::-moz-selection, .cm-s-inner .CodeMirror-line > span > span::-moz-selection { background: rgba(255, 255, 255, 0.10); }
.cm-s-inner .CodeMirror-activeline-background { background: rgba(0, 0, 0, 0); }
.cm-s-inner .cm-keyword { color: rgba(199, 146, 234, 1); }
.cm-s-inner .cm-operator { color: rgba(233, 237, 237, 1); }
.cm-s-inner .cm-variable-2 { color: #80CBC4; }
.cm-s-inner .cm-variable-3 { color: #82B1FF; }
.cm-s-inner .cm-builtin { color: #DECB6B; }
.cm-s-inner .cm-atom { color: #F77669; }
.cm-s-inner .cm-number { color: #F77669; }
.cm-s-inner .cm-def { color: rgba(233, 237, 237, 1); }
.cm-s-inner .cm-string { color: #C3E88D; }
.cm-s-inner .cm-string-2 { color: #80CBC4; }
.cm-s-inner .cm-comment { color: #546E7A; }
.cm-s-inner .cm-variable { color: #82B1FF; }
.cm-s-inner .cm-tag { color: #80CBC4; }
.cm-s-inner .cm-meta { color: #80CBC4; }
.cm-s-inner .cm-attribute { color: #FFCB6B; }
.cm-s-inner .cm-property { color: #80CBAE; }
.cm-s-inner .cm-qualifier { color: #DECB6B; }
.cm-s-inner .cm-variable-3 { color: #DECB6B; }
.cm-s-inner .cm-tag { color: rgba(255, 83, 112, 1); }
.cm-s-inner .cm-error {
color: rgba(255, 255, 255, 1.0);
background-color: #EC5F67;
}
.cm-s-inner .CodeMirror-matchingbracket {
text-decoration: underline;
color: white !important;
}
/**apply to code fences with plan text**/
.md-fences {
background-color: #263238;
color: rgb(237, 234, 233);
border: none;
}
.md-fences .code-tooltip {
background-color: #263238;
}
/* 在源代码基础上,增加了这段代码,次代码控制代码块的字体和背景色 */
.CodeMirror-lines {
cursor: text;
background-color: #232323;
font-family: DejaVu Sans Mono, Monaco, 'Courier New', monospace;
}
- 效果展示
示例:模拟mac的3个图标(白色)
- 配置方法
/* code block */
\#write pre.md-fences {
padding: 1rem 0.5rem 1rem;
display: block;
-webkit-overflow-scrolling: touch;
/* box-shadow: 0 0 6px 2px rgba(151, 151, 151, 0.9); */
/* border-top: rgb(51, 51, 51) solid 35px; */
border-top: rgb(244, 244, 244) solid 35px;
background-color: rgb(244, 244, 244);
}
pre.md-fences::before {
content: ' ';
background: #fa3534;
box-shadow: 23px 0 #ff9900, 45px 0 #19be6b;
border-radius: 50%;
margin-top: -2.3rem;
position: absolute;
left: 15px;
height: 12px;
width: 12px;
}
\#write pre.md-fences {
line-height: 1.5rem;
font-size: 0.9rem;
font-weight: 300;
border-radius: .7em;
/* font-family: var(--monospace) !important; */
/* background-color: #232323; */
font-family: DejaVu Sans Mono, Monaco, 'Courier New', monospace;
}
- 效果展示
示例:模拟mac的3个图标(暗黑)
- 配置方法
/*
模拟MAC的三个图标
*/
.CodeMirror-wrap .CodeMirror-scroll {
padding-top: 20px;
}
\#write .md-fences:before {
content: "";
z-index: 4;
display: block;
position: absolute;
top: 7px;
left: 15px;
height: 12px;
width: 12px;
border-radius: 50%;
float: left;
background-color: #fa3534;
}
\#write .CodeMirror-scroll:before {
content: "";
display: block;
position: absolute;
top: 0px;
left: 25px;
height: 12px;
width: 12px;
border-radius: 50%;
float: left;
z-index: 999;
background-color: #ff9900;
}
\#write .md-fences::after {
content: "";
z-index: 4;
display: block;
position: absolute;
top: 7px;
left: 55px;
height: 12px;
width: 12px;
border-radius: 50%;
float: left;
background-color: #19be6b;
}
- 效果展示
示例:修改代码背景颜色为sublime text3的背景色
- 注意
注意:sublimet text3背景颜色的颜色代码为
background: #232323; 这个颜色为sublime text3的颜色;
- 配置方法
/*
代码块设置:
*/
\#write .md-fences:not([mermaid-type]) {
font-family: var(--monospace-font);
font-size: 1rem;
font-weight: bold;
padding: 0.6rem;
padding-top: 7px;
border-radius: 10px;
background-color: #232323; /*这个背景色为sublime text背景色*/
color: #eeeeee;
border-radius: 0.4rem;
box-shadow: var(--block-shadow);
}
- 效果展示
示例:修改代码块字体
- 配置方法
/*修改代码块代码字体*/
.md-fences,
code,
tt {
background-color: #f8f8f8;
border-radius: 3px;
padding: 0;
padding-left: 4px !important;
padding-right: 4px !important;
font-size: 0.9em;
font-family: consolas, 'Courier New', monospace; /* 修改代码字体 */
}
\#write .md-fences:not([mermaid-type]) {
padding: 0.6rem;
padding-top: 7px;
border-radius: 10px;
background-color: #232323;
color: #eeeeee;
border-radius: 0.4rem;
box-shadow: var(--block-shadow);
}
示例:typora的代码块的光标颜色配置(已配置)
- 配置方法
/*typora的代码块的光标颜色配置:2021.12.15update*/
.cm-s-inner .CodeMirror-cursor {
border-left: solid rgb(96, 255, 96) !important;
}
- 效果展示
示例:设置代码块下边距
配置时间:2023年2月14日
这个 功能并不是很友好,这里弃用;
- 配置方法
/* code fences(围栏) */
.md-fences {
font-family: "Fira Code", Consolas, "Lucida Console", "Courier", monospace, "Helvetica Neue", Helvetica, Arial, sans-serif;
background-color: #282c34;
padding: 6px 10px;
-webkit-box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
/* margin-bottom: 2.5rem; */
margin-bottom: 0.5rem;
border: none;
border-radius: 6px;
}
- 效果展示
默认效果还是好一点:
行内代码块
案例
- 配置方法
/*
行内代码块
*/
code {
background-color: var(--code-background-color);
border-radius: 5px;
padding: 4px;
color: var(--code-color);
}
- 效果展示
侧边栏
案例:配置侧边栏鼠标悬浮后颜色
- 效果
- 配置方法
/*================================================================================侧边栏 大纲 设置==============================================================*/
/* 侧边栏当前小姐所在颜色 */
.outline-item-active{background:#6fd18d;color:#fff;}
.outline-content li, .outline-content ul{margin:5px 0!important; }
/* 侧边栏鼠标悬浮后颜色 */
.outline-item:hover {
background-color: #bac6e9 !important;
}
示例:设置左侧目录字体
- 配置方法
/*设置左侧目录字体(亲测成功)-2021.12.13*/
header, .context-menu, .megamenu-content, footer{
font-family: "霞鹜文楷","SimSun", "Arial", sans-serif;
}
- 效果展示
示例:typora左侧文档树搜索框颜色修改
- 配置方法
input[type="search" i] {
appearance: auto;
box-sizing: border-box;
padding: 1px 2px;
background-color: #cc99cd;
color: black;
}
案例
- 配置方法
/*
侧边栏设置:sidebar
*/
.megamenu-menu-header {
width: 60%;
text-align:center;
border-bottom: solid 3px var(--main-color);
}
\#megamenu-menu-sidebar {
background-color: rgba(255, 255, 255, 0.1);
color: var(--sidebar-font-color);
box-shadow: 0 0 8px 4px rgb(100 100 100 / 80%);
margin-top: 3%;
height: 92%;
border-radius: 0 4em 4em 0;
}
\#megamenu-back-btn {
border-radius: 1.2em;
color: var(--main-color);
transition: all linear .3s;
padding: 0 0 10px;
}
\#megamenu-back-btn:hover {
background-color: var(--main-color);
color: white;
border: 2px solid white;
transition: all linear .3s;
}
\#megamenu-menu-list > li {
transition: all linear .3s;
}
\#megamenu-menu-list > li:hover {
transition: all linear .3s;
border-top-left-radius: 1.2em;
border-bottom-left-radius: 1.2em;
}
\#megamenu-menu-list > li:focus {
transition: all linear .3s;
color : white;
background-color: var(--shadow-color);
width: fit-content;
border-top-right-radius: 1.2em;
border-bottom-right-radius: 1.2em;
}
.dropdown-menu .divider {
width: 30%;
color: var(--main-color);
background-color: var(--main-color);
}
.megamenu-menu-list li a {
transition: all linear .3s;
width: fit-content;
padding-right: 60px;
}
.megamenu-menu-list li a:hover {
transition: all linear .3s;
color: white !important;
background-color: var(--main-color) !important;
border-bottom-right-radius: 2em;
border-top-right-radius: 2em;
}
.megamenu-menu-list li a.active, .megamenu-menu-list:not(.saved) li a:hover {
color: white !important;
background-color: var(--main-color) !important;
border-bottom-right-radius: 2em;
border-top-right-radius: 2em;
}
/* open */
\#m-open-local,
\#m-import-local {
border-radius: 1.2em;
}
\#m-open-local:hover,
\#m-import-local:hover {
border: 1px solid var(--shadow-color);
}
\#recent-file-panel-search-input {
border-radius: 1.2em;
transition: all linear .3s;
font-family: var(--title-font);
}
\#recent-file-panel-action-btn {
border-radius: 1.2em;
}
\#recent-file-panel-search-input:hover {
transition: all linear .3s;
box-shadow: 0 0 10px 3px var(--shadow-color);
}
\#recent-file-panel-search-input:focus {
transition: all linear .3s;
color: white;
border: none;
background-color: var(--shadow-color);
}
/* side bar Ctrl Shift 2 */
/* .typora-node.pin-outline:not(.megamenu-opened):not(.typora-sourceview-on) #typora-sidebar {
display: block;
left: 0;
transition: left .3s;
border-radius: 0em 3em 3em 0em;
box-shadow: 0 0 8px 3px rgb(100 100 100 / 80%);
margin-top: 20px;
margin-bottom: 5%;
height: 95%;
padding-right: 10px;
} */
.info-panel-tab-border {
color: var(--main-color) !important;
background-color: var(--main-color) !important;
}
.outline-content {
padding: 3px 18px 3px 0;
}
.outline-item {
margin-left: -20px;
margin-right: -20px;
border-left: 20px solid transparent;
border-right: 16px solid transparent;
}
.outline-item:hover {
background-color: var(--shadow-color);
color: white;
}
.active-tab-files #info-panel-tab-file .info-panel-tab-title {
background-color: var(--main-color);
color: white;
padding: 5px 5px;
border-radius: 1.2em;
transition: all linear .3s;
}
.active-tab-outline #info-panel-tab-outline .info-panel-tab-title {
background-color: var(--main-color);
color: white;
padding: 5px 5px;
border-radius: 1.2em;
transition: all linear .3s;
}
.ty-show-search #info-panel-tab-search .info-panel-tab-title {
background-color: var(--main-color);
color: white;
padding: 5px 5px;
border-radius: 1.2em;
transition: all linear .3s;
}
\#file-library-search-input {
border-radius: .5em;
}
\#file-library-search-input:focus {
border: 2px solid var(--main-color);
}
.info-panel-tab-border {
display: none;
}
div#file-library-list-children {
transition: all linear .3s;
}
.file-list-item.active {
border-top-right-radius: 2.2em;
border-bottom-right-radius: 2.2em;
width: fit-content;
background-color: var(--main-color) !important;
color: white;
transition: all linear .3s;
}
.outline-item-active {
border-top-right-radius: 2.2em;
border-bottom-right-radius: 2.2em;
width: fit-content;
background-color: var(--main-color) !important;
color: white;
transition: all linear .3s;
}
示例:设置右侧滚动滑块的颜色
案例1:默认不添加代码
默认这个灰色效果会好一点,可以让人更关注文章内容本身。
案例2:有颜色的
- 配置方法
/* 设置右侧滚动滑块的颜色 */
/* 设置滚动条的样式 */
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
/* 滚动槽 */
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.2);
border-radius: 8px;
}
/* 滚动条滑块 */
::-webkit-scrollbar-thumb {
border-radius: 8px;
background: pink;
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.25);
}
- 效果展示
示例:大纲小三角图标设置
- 配置方法
\#typora-sidebar #sidebar-loading-template.file-list-item {
border-bottom: transparent !important;
background-color: rgba(171, 192, 208, 0.1);
}
\#typora-sidebar .info-panel-tab-wrapper .info-panel-tab:hover {
color: inherit;
}
\#typora-sidebar .info-panel-tab-wrapper .info-panel-tab .info-panel-tab-border {
background-color: #2f845e;
border-radius: 4px;
}
\#typora-sidebar .sidebar-osx-tab .sidebar-tabs {
border-bottom-color: transparent;
}
\#typora-sidebar #sidebar-content .file-list-item {
border-bottom: 1px solid #eee;
}
\#typora-sidebar #sidebar-content .file-list-item.active {
background-color: rgba(66, 185, 131, 0.1);
border-left: 4px solid #2f845e;
}
\#typora-sidebar #sidebar-content .ty-sidebar-search-panel {
border-bottom: 1px solid #eee;
}
\#typora-sidebar #sidebar-content .ty-sidebar-search-panel .searchpanel-search-option-btn {
background-color: #fff;
}
/* 文件数 文件名字体大小 */
/* #typora-sidebar #sidebar-content .sidebar-content-content .file-node-content {
line-height: 1.375rem;
font-size: 0.9rem;
color: #282c34 !important;
} */
\#typora-sidebar #sidebar-content .sidebar-content-content .file-tree-node:not(.file-node-root):hover > .file-node-background {
border-left: 4px solid #2f845e;
background-color: rgba(66, 185, 131, 0.1);
}
\#typora-sidebar #sidebar-content .sidebar-content-content .file-tree-node.active > .file-node-background {
border-color: #2f845e;
background-color: rgba(66, 185, 131, 0.1);
}
\#typora-sidebar #sidebar-content .sidebar-content-content #file-library-list-children .file-library-file-node:hover {
border-left: 4px solid #2f845e;
background-color: rgba(66, 185, 131, 0.1);
}
\#typora-sidebar #sidebar-content #outline-content .no-collapse-outline .outline-item {
line-height: 1.375rem;
font-size: 1rem;
}
\#typora-sidebar #sidebar-content #outline-content .outline-expander:before {
color: inherit;
font-size: 14px;
top: auto;
content: "\f0da";
font-family: FontAwesome;
}
\#typora-sidebar #sidebar-content #outline-content .outline-expander:hover:before,
\#typora-sidebar #sidebar-content #outline-content .outline-item-open > .outline-item > .outline-expander:before {
content: "\f0d7";
}
\#typora-sidebar #sidebar-content #outline-content .outline-item:hover {
background-color: #bac6e9 !important;
}
\#typora-sidebar #ty-sidebar-footer {
border-top: 1px solid #eee;
}
\#typora-sidebar #ty-sidebar-footer .sidebar-footer-item:hover {
background-color: #bac6e9 !important;
}
\#typora-sidebar #ty-sidebar-footer #sidebar-files-menu {
-webkit-box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
}
- 效果展示
示例:控制 TOC 水平
在 Typora 中[TOC]会生成“目录”。默认情况下,它将显示从h1到 的标题h6。例如,要隐藏较低级别的标题,h6您可以附加以下 CSS:
.md-toc-h6 {
display: none;
}
示例:Typora侧边栏同时查看大纲和文件|添加TabBar
- typora默认的布局
文件和文章目录只能显示一个,不能同时显示:
- 希望实现的需求如下:
希望能后实现,typora显示的布局左边是文件列表,右边是文章目录:
- 参考别人文章
https://zhuanlan.zhihu.com/p/503555038?utm_source=qq&utm_medium=social&utm_oi=1138758273699348480
这部分内容,我不懂哈哈:
- 测试过程
https://github.com/XiLaiTL/typora-theme-bothview-tabbar/
bothview是有效果的:(很nice😘)
但是tabbar我这边是没效果的:(问题不大哈哈)
- 自己最终主题文件如下:
022.9.26-typora-theme-后来(bothview).zip
侧边栏选择点
配置时间:2023年1月14日
- 配置方法
/* Selection Dot ,侧边栏选择点*/
.outline-item-active::after,
.active .file-list-item-file-name::after,
.active .file-node-content::after {
content: "";
position: absolute;
top: calc(50% - 4px);
right: 0;
width: 8px;
height: 8px;
border-radius: 50%;
background: #0284c7;
}
- 效果展示