1. 总体风格
2. 文件位置
打开偏好设置
打开主题文件夹,可以看到所有本地主题的css文件,你想修改哪个主题,直接修改相应的css文件就可以了
从官网下载pie的主题
会得到一个压缩包,将 里面的3个文件复制到上面的主题文件夹中
重启Typora,就可以在上方的菜单栏中的主题里看到 pie 和 pie-dark
3. 自定义部分样式
打开pie.css
引用块
参照了这篇博客的方式:Typora打造最适合编程笔记的精美主题(浅色版和修改后的深色版),可自行修改喜欢的样式。_typora主题_airyv的博客-CSDN博客
注意把下面的装饰部分删掉
/* --- 引用块 --- */
blockquote {
position: relative;
padding: 24px 16px 12px;
margin: 24px 0 36px;
font-size: 1em;
font-style: normal;
line-height: 1.6;
color: var(--mid-7);
text-indent: 0;
border: none;
border-left: 2px solid var(--main-6);
}
blockquote blockquote {
padding-right: 0;
}
blockquote a {
color: var(--main-4);
}
代码块主题
比较喜欢浅色,用来 idea 的样式,然后稍微修改了一下
/* ----------------- 代码块主题 ----------------- */
/**
Name: IDEA default theme
From IntelliJ IDEA by JetBrains
*/
.cm-s-inner.CodeMirror {
padding: 0.8rem 0 1rem;
background-color: #f8f8f8;
border-radius: 4px;
}
.cm-s-inner span.cm-meta { color: #808000; }
.cm-s-inner span.cm-number { color: #0000FF; }
.cm-s-inner span.cm-keyword { line-height: 1em; font-weight: bold; color: #000080; }
.cm-s-inner span.cm-atom { font-weight: bold; color: #000080; }
.cm-s-inner span.cm-def { color: #000000; }
.cm-s-inner span.cm-variable { color: black; }
.cm-s-inner span.cm-variable-2 { color: black; }
.cm-s-inner span.cm-variable-3, .cm-s-inner span.cm-type { color: black; }
.cm-s-inner span.cm-property { color: black; }
.cm-s-inner span.cm-operator { color: black; }
.cm-s-inner span.cm-comment { color: #808080; }
.cm-s-inner span.cm-string { color: #008000; }
.cm-s-inner span.cm-string-2 { color: #008000; }
.cm-s-inner span.cm-qualifier { color: #555; }
.cm-s-inner span.cm-error { color: #FF0000; }
.cm-s-inner span.cm-attribute { color: #0000FF; }
.cm-s-inner span.cm-tag { color: #000080; }
.cm-s-inner span.cm-link { color: #0000FF; }
.cm-s-inner .CodeMirror-gutters {
padding: 0.5rem;
background: #f8f8f8;
color: #777777;
border: 0;
}
.cm-s-inner span.cm-builtin { color: #30a; }
.cm-s-inner span.cm-bracket { color: #cc7; }
.cm-s-inner { font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;}
.cm-s-inner .CodeMirror-matchingbracket { outline:1px solid grey; color:black !important; }
4. 完整代码
@include-when-export url('https://fonts.googleapis.com/css2?family=Fira+Code&family=Source+Sans+Pro&display=swap');
@font-face {
font-family: 'Source Sans Pro';
src: url('pie/source-sans-pro-v21.woff2') format('woff2'), url('pie/source-sans-pro-v21.woff') format('woff');
}
@font-face {
font-family: 'Fira Code';
src: url('pie/FiraCode-Light.woff2') format('woff2'), url('pie/FiraCode-Light.woff') format('woff');
font-weight: 300;
}
@font-face {
font-family: 'Fira Code';
src: url('pie/FiraCode-Regular.woff2') format('woff2'), url('pie/FiraCode-Regular.woff') format('woff');
font-weight: 400;
}
@font-face {
font-family: 'Fira Code';
src: url('pie/FiraCode-Medium.woff2') format('woff2'), url('pie/FiraCode-Medium.woff') format('woff');
font-weight: 500;
}
@font-face {
font-family: 'Fira Code';
src: url('pie/FiraCode-Bold.woff2') format('woff2'), url('pie/FiraCode-Bold.woff') format('woff');
font-weight: 700;
}
:root {
--primary-color: #f22f27;
--side-bar-bg-color: #ffffff;
--control-text-color: #777777;
--select-text-bg-color: #faa295;
--active-file-text-color: #262626;
--active-file-border-color: #f22f27;
--search-select-bg-color: #ff5d52;
--search-select-text-color: #ffffff;
--search-hit-bg-color: #ffafa3;
--search-hit-text-color: #262626;
/* 中性色 */
--mid-1: #ffffff;
--mid-2: #fafafa;
--mid-3: #f5f5f5;
--mid-4: #f0f0f0;
--mid-5: #d9d9d9;
--mid-6: #bfbfbf;
--mid-7: #8c8c8c;
--mid-8: #595959;
--mid-9: #434343;
--mid-10: #262626;
--mid-11: #1f1f1f;
--mid-12: #141414;
--mid-13: #000000;
/* 主题色 */
--main-1: #fff3f0;
--main-2: #ffd4cc;
--main-3: #ffafa3;
--main-4: #ff887a;
--main-5: #ff5d52;
--main-6: #f22f27;
--main-7: #cc1616;
--main-8: #a60a0f;
--main-9: #80010a;
--main-10: #590009;
/* 字体 */
--font-normal: 'Source Sans Pro', 'MiSans', '等距更纱黑体 SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
--font-code: 'Fira Code', Monaco, Consolas, 'MiSans', '等距更纱黑体 SC', 'Microsoft YaHei', sans-serif;
}
html {
font-size: 14px;
}
body {
margin: 0;
overflow-x: hidden;
font-family: var(--font-normal) !important;
line-height: 20px;
color: var(--mid-10);
letter-spacing: 0;
-webkit-font-smoothing: antialiased;
}
#write {
max-width: 860px;
padding: 20px 30px 160px;
margin: 0 auto;
}
#write p {
word-spacing: 0.05rem;
text-align: justify;
}
#write ol li {
margin-left: -4px;
}
#write ol li p {
margin-left: 4px;
}
#write ul {
line-height: 2rem;
}
#write > ul:first-child,
#write > ol:first-child {
margin-top: 30px;
}
body > *:first-child {
margin-top: 0 !important;
}
body > *:last-child {
margin-bottom: 0 !important;
}
a {
padding: 0 2px;
font-weight: 500;
color: var(--main-6);
text-decoration: none;
}
/* 链接 */
#write a {
color: var(--main-6);
text-decoration: none;
border-bottom: 1px solid var(--main-6);
}
/* 链接内容为空时直接啥也不显示,比如锚点的地方 */
#write a:empty {
font-size: 0;
border: none;
}
/* 目录 */
#write a.md-toc-inner {
line-height: 1.6;
white-space: pre-line;
border-bottom: none;
}
#write a:hover {
color: var(--main-7);
border-bottom: 2px solid var(--main-6);
}
h1,
h2,
h3,
h4,
h5,
h6 {
position: relative;
margin-top: 1rem;
margin-bottom: 1rem;
font-weight: bold;
line-height: 1.4;
cursor: text;
}
h1:hover a.anchor,
h2:hover a.anchor,
h3:hover a.anchor,
h4:hover a.anchor,
h5:hover a.anchor,
h6:hover a.anchor {
text-decoration: none;
}
h1 tt,
h1 code,
h2 tt,
h2 code,
h3 tt,
h3 code,
h4 tt,
h4 code,
h5 tt,
h5 code,
h6 tt,
h6 code {
font-size: inherit !important;
}
h2 a,
h3 a {
color: var(--mid-9);
}
h1 {
padding-bottom: 0.3em;
margin: 2.4em auto 1.2em;
font-size: 2em;
line-height: 1.2;
text-align: center;
}
h1::after {
display: block;
width: 100px;
height: 2px;
margin: 0.2em auto 0;
content: '';
border-bottom: 2px dashed var(--main-6);
}
h2 {
padding-left: 6px;
margin: 2em auto 1.4em;
font-size: 1.6em;
line-height: 1.4;
border-left: 6px solid var(--main-6);
}
h3 {
margin: 1.6em auto 1.2em;
font-size: 1.35em;
line-height: 1.43;
}
/* --- 三级标题左边的小圆点 --- */
h3::before {
display: inline-block;
width: 6px;
height: 6px;
margin-right: 6px;
margin-bottom: 0.18em;
line-height: 1.43;
vertical-align: middle;
content: '';
background-color: var(--main-5);
border-radius: 50%;
}
/* 三级四级标题点击后左边的提示图标 */
#write > h3.md-focus::before,
#write > h4.md-focus::before {
width: auto;
height: auto;
color: var(--mid-1);
background-color: var(--main-5);
}
h4 {
margin-top: 1.4em;
font-size: 1.2em;
}
/* --- 四级标题左边的小短线 --- */
h4::before {
display: inline-block;
width: 6px;
height: 2px;
margin-right: 8px;
margin-bottom: 0.18em;
vertical-align: middle;
content: '';
background-color: var(--main-4);
}
h5 {
font-size: 1em;
}
h6 {
font-size: 1em;
color: var(--mid-7);
}
p,
blockquote,
ul,
ol,
dl,
table {
margin: 0.8em 0;
}
li > ol,
li > ul {
margin: 0;
}
hr {
box-sizing: content-box;
width: 100%;
height: 1px;
padding: 0;
margin: 46px auto 64px;
overflow: hidden;
background-color: var(--main-4);
border: 0;
}
body > h2:first-child {
padding-top: 0;
margin-top: 0;
}
body > h1:first-child {
padding-top: 0;
margin-top: 0;
}
body > h1:first-child + h2 {
padding-top: 0;
margin-top: 0;
}
body > h3:first-child,
body > h4:first-child,
body > h5:first-child,
body > h6:first-child {
padding-top: 0;
margin-top: 0;
}
a:first-child h1,
a:first-child h2,
a:first-child h3,
a:first-child h4,
a:first-child h5,
a:first-child h6 {
padding-top: 0;
margin-top: 0;
}
h1 p,
h2 p,
h3 p,
h4 p,
h5 p,
h6 p {
margin-top: 0;
}
li p.first {
display: inline-block;
}
ul,
ol {
padding-left: 30px;
}
ul:first-child,
ol:first-child {
margin-top: 0;
}
ul:last-child,
ol:last-child {
margin-bottom: 0;
}
/* --- 引用块 --- */
blockquote {
border-left: 4px solid rgb(239, 112, 96);
padding: 10px 15px;
color: #000000;
background-color: rgba(250, 136, 94, 0.18);
}
blockquote blockquote {
padding-right: 0;
}
blockquote a {
color: var(--main-4);
}
table {
padding: 0;
margin: 36px auto;
word-break: initial;
}
table tr {
padding: 0;
margin: 0;
border-top: 1px solid #dfe2e5;
}
table tr:nth-child(2n),
thead {
background-color: var(--mid-3);
}
table tr th {
padding: 6px 13px;
margin: 0;
font-weight: bold;
text-align: left;
border: 1px solid #dfe2e5;
border-bottom: 0;
}
table tr td {
padding: 6px 13px;
margin: 0;
text-align: left;
border: 1px solid #dfe2e5;
}
table tr th:first-child,
table tr td:first-child {
margin-top: 0;
}
table tr th:last-child,
table tr td:last-child {
margin-bottom: 0;
}
#write table thead th {
text-align: center;
background-color: #f2f2f2;
}
#write strong {
padding: 0 1px;
}
#write em {
padding: 0 5px 0 2px;
}
#write .CodeMirror-gutters {
border-right: none;
}
/* 代码块 */
#write .md-fences {
margin: 8px 0 8px !important;
font-family: var(--font-code) !important;
font-size: 0.9rem;
line-height: 1.55rem;
color: var(--mid-10);
word-wrap: normal;
-webkit-font-smoothing: initial;
}
#write .CodeMirror-wrap .CodeMirror-code pre {
padding-left: 12px;
line-height: 1.55rem;
}
#write .CodeMirror-cursors .CodeMirror-cursor {
border-left: 2px solid var(--mid-4);
}
#write code,
tt {
padding: 2px 4px 1px;
margin: 0 2px;
font-family: var(--font-code) !important;
font-size: 12px;
color: var(--main-5);
background-color: var(--main-1);
border-radius: 3px;
}
#write code {
vertical-align: 0.5px;
}
#write .md-footnote {
color: var(--main-5);
background-color: var(--main-1);
}
/* 流程图块 */
#write .md-diagram-panel {
position: relative;
margin: 24px auto;
}
#write .md-focus .md-diagram-panel {
border: 1px solid var(--main-4);
border-radius: 4px;
}
/* heighlight. */
#write mark {
padding: 2px 4px;
margin: 0 2px;
font-weight: 500;
color: #222222;
background-color: var(--main-4);
border-radius: 2px;
border-radius: 4px;
}
#write del {
padding: 1px 2px;
}
/* 任务列表小方框 */
.md-task-list-item > input {
margin-top: 0.3rem;
margin-left: -1.3em;
-webkit-appearance: none;
}
.md-task-list-item > input::before {
display: inline-block;
width: 0.875rem;
height: 0.875rem;
margin-top: -0.4rem;
font-size: 0.8rem;
color: var(--mid-1);
text-align: center;
vertical-align: middle;
content: '';
border: 1px solid var(--main-4);
border-radius: 2px;
transition: all 0.2s linear;
}
.md-task-list-item > input:checked::before,
.md-task-list-item > input[checked]::before {
font-size: 0.625rem;
color: var(--mid-1);
content: '\2714';
background-color: var(--main-6);
border: 1px solid var(--main-6);
}
@media print {
html {
font-size: 13px;
}
table,
pre {
page-break-inside: avoid;
}
pre {
word-wrap: break-word;
}
}
/* .md-fences {
background-color: #f8f8f8;
} */
#write pre.md-meta-block {
margin-top: 0 !important;
/* padding: 1rem; */
font-size: 85%;
line-height: 1.45;
color: #777777;
background-color: #f7f7f7;
border: 0;
border-radius: 3px;
}
.mathjax-block > .code-tooltip {
bottom: 0.375rem;
}
#write > h3.md-focus::before {
top: 0.375rem;
left: -1.5625rem;
}
#write > h4.md-focus::before {
top: 0.285714286rem;
left: -1.5625rem;
}
#write > h5.md-focus::before {
top: 0.285714286rem;
left: -1.5625rem;
}
#write > h6.md-focus::before {
top: 0.285714286rem;
left: -1.5625rem;
}
/* --- 图片 --- */
.md-image {
margin: 5px auto;
border-radius: 4px;
}
.md-image img {
border: none;
border-radius: 4px;
}
/* 当 “![shadow-随便写]()”写时,会有阴影 */
.md-image img[alt|='shadow'] {
box-shadow: 0 4px 24px -6px #dddddd;
}
.md-image > .md-meta {
padding: 2px 0 0 4px;
font-family: var(--font-normal);
font-size: 0.9em;
color: inherit;
border-radius: 3px;
}
/* emoji */
.md-emoji-span::before {
font-weight: 400;
vertical-align: inherit;
content: attr(data-emoji);
}
.md-tag {
color: inherit;
}
.md-toc {
padding-bottom: 20px;
margin-top: 20px;
}
#md-notification::before {
top: 10px;
}
.md-lang {
color: #b4654d;
}
.md-search-hit {
color: var(--search-hit-text-color);
background-color: var(--search-hit-bg-color);
}
/** focus mode */
.on-focus-mode blockquote {
border-left-color: rgba(85, 85, 85, 0.12);
}
.sidebar-tabs {
border-bottom: none;
}
.form-control:focus {
border-color: var(--active-file-border-color);
box-shadow: 0 0 8px #f22f2744;
}
#typora-quick-open {
background-color: #f8f8f8;
border: 1px solid #dddddd;
}
#typora-quick-open-item {
background-color: #fafafa;
border-color: #fefefe #e5e5e5 #e5e5e5 #eeeeee;
border-style: solid;
border-width: 1px;
}
header,
.context-menu,
.megamenu-content,
footer {
font-family: var(--font-normal);
}
.file-node-content:hover .file-node-icon,
.file-node-content:hover .file-node-open-state {
visibility: visible;
}
.mac-seamless-mode #typora-sidebar {
background-color: var(--side-bar-bg-color);
}
.html-for-mac .context-menu {
--item-hover-bg-color: #e6f0fe;
}
/* 侧边栏 */
.file-list-item.active {
color: var(--active-file-text-color);
background: var(--active-file-bg-color);
border-left: 4px solid var(--main-6);
}
.file-tree-node.active > .file-node-background {
background-color: var(--active-file-bg-color);
border-color: var(--active-file-border-color);
border-left: 4px solid var(--main-6);
}
/* ----------------- 代码块主题 ----------------- */
/**
Name: IDEA default theme
From IntelliJ IDEA by JetBrains
*/
.cm-s-inner.CodeMirror {
padding: 0.8rem 0 1rem;
background-color: #f8f8f8;
border-radius: 4px;
}
.cm-s-inner span.cm-meta { color: #808000; }
.cm-s-inner span.cm-number { color: #0000FF; }
.cm-s-inner span.cm-keyword { line-height: 1em; font-weight: bold; color: #000080; }
.cm-s-inner span.cm-atom { font-weight: bold; color: #000080; }
.cm-s-inner span.cm-def { color: #000000; }
.cm-s-inner span.cm-variable { color: black; }
.cm-s-inner span.cm-variable-2 { color: black; }
.cm-s-inner span.cm-variable-3, .cm-s-inner span.cm-type { color: black; }
.cm-s-inner span.cm-property { color: black; }
.cm-s-inner span.cm-operator { color: black; }
.cm-s-inner span.cm-comment { color: #808080; }
.cm-s-inner span.cm-string { color: #008000; }
.cm-s-inner span.cm-string-2 { color: #008000; }
.cm-s-inner span.cm-qualifier { color: #555; }
.cm-s-inner span.cm-error { color: #FF0000; }
.cm-s-inner span.cm-attribute { color: #0000FF; }
.cm-s-inner span.cm-tag { color: #000080; }
.cm-s-inner span.cm-link { color: #0000FF; }
.cm-s-inner .CodeMirror-gutters {
padding: 0.5rem;
background: #f8f8f8;
color: #777777;
border: 0;
}
.cm-s-inner span.cm-builtin { color: #30a; }
.cm-s-inner span.cm-bracket { color: #cc7; }
.cm-s-inner { font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;}
.cm-s-inner .CodeMirror-matchingbracket { outline:1px solid grey; color:black !important; }