1 分享主题
工欲善其事必先利其器。分享一个文档编辑器主题。
1.1 特点
(1)大纲放在右侧、目录放在左侧,互不干扰
(2)标题颜色特殊处理
1.2 使用方式
打开Typora --> 文件 --> 偏好设置 --> 外观 --> 打开主题文件夹
新建文本文件: xxxx.css
复制一下内容 --> 保存 --> 然后在外观设置中选择 xxxx主题,重启Typora
/*BothView by XiLaiTL|MIT License|English-Chinese*/
/*You can copy the code below and paste it in the top of theme css file which you want*/
/*
当点击显示侧边栏时,类.pin-outline被激活(添加到body),类.open(添加到sidebar)
当点击文件时,类.active-tab-files被激活(添加到sidebar)
当点击大纲时,类.active-tab-outline被激活(添加到sidebar)
*//*When you toggle sidebar, the class named ".pin-outline" is adding in the <body> and the class named ".open" is adding in the <div>#typora-sidebar. As clicking "Files", the class named ".active-tab-files" is adding in the <div>#typora-sidebar while clicking "Outline" the the class named ".active-tab-outline" is adding in it.
*/
/*=======================================================================*/
/*初始设置,让sidebar占满整个屏幕并让content显示在上方,调节其他部分依旧在左侧*//*Firstly setting for making sidebar cover the whole view and let content show above the header, and remaining other part at right area*/
/*更新层叠顺序,让content显示在header上方,并且依然保留下方调节sidebar大小的能力*//*Renew the z-index and width*/
header{ z-index: -1;}
.pin-outline header:hover ~ footer{ z-index: -2; }
/*设置【侧边栏】满宽度 *//*Set sidebar's width*/
.typora-node.pin-outline:not(.megamenu-opened):not(.typora-sourceview-on) #typora-sidebar{ width: 100% }
/*设置【信息侧边栏】宽度 *//*Set other parts' width*/
.info-panel-tab-wrapper { width: var(--sidebar-width);}
.sidebar-footer{ width: var(--sidebar-width);}
#file-library-search{ width: var(--sidebar-width);}
/*=======================================================================*/
/*逻辑设置,当点击“显示侧边栏时”,【内容】被移动到中间,留出两侧分别放置【文件】和【大纲】*//*Logical setting for you toggling sidebar, move the content to the middle area and remain the left area for Files and right area for Outline*/
/*当点击“显示侧边栏”时 【内容】 *//*When toggling sidebar, move the content to the middle area*/
.pin-outline content {
min-height: 0%;
height:calc(100% - 30px);
left: var(--sidebar-width);
right: var(--sidebar-width);
}
/*-----------------------------------------------------------------------*/
/*当点击“文件”时,【大纲侧边栏】同时显示在右侧*//*When clicking "Files", move outline bar to right area*/
/*点击“文件”时 【文件侧边栏】*//*When clicking "Files", set the files bar*/
.pin-outline .active-tab-files #file-library {
width: var(--sidebar-width);
min-width: 0%;
}
/*点击“文件”时 【大纲侧边栏】*//*When clicking "Files", set the outline bar*/
.pin-outline .active-tab-files #outline-content{
position: fixed;
/*fured: width: var(--sidebar-width);*/
width: max-content;
min-width: 0%;
right: 0;
left: calc(100% - var(--sidebar-width));
display: block;
padding-bottom: 84px;
}
/*-----------------------------------------------------------------------*/
/*当点击“大纲”时,【大纲侧边栏】显示在左侧,右侧空白由【文件侧边栏】的div去填补*//*When clicking "Outline", move outline bar to left area and let files bar fill the right area which is empty*/
/*点击“大纲”时 【大纲侧边栏】*//*When clicking "Outline", set the outline bar*/
.pin-outline .active-tab-outline #outline-content {
background-color: var(--side-bar-bg-color);
position: relative;
width: var(--sidebar-width);
min-width: 0%;
left: 0;
display: block;
}
/*点击“大纲”时 【文件侧边栏】*//*When clicking "Outline", set the files bar*/
.pin-outline .active-tab-outline #file-library{
background-color: var(--bg-color);
position: fixed;
top: 0;
width: var(--sidebar-width);
left: calc(100% - var(--sidebar-width));
display: block !important;
}
.pin-outline .active-tab-outline #file-library div{ /*Just let files bar be an empty bg-color div*/
display:none
}
/*=======================================================================*/
@include-when-export url(https://fonts.loli.net/css?family=Merriweather:900,900italic,300,300italic&subset=latin-ext);
@include-when-export url(https://fonts.loli.net/css?family=Lato:900,300&subset=latin-ext);
:root {
/*fured: --control-text-color: #777;*/
--bg-color: #363B40;
--side-bar-bg-color: #2E3033;
--text-color: #b8bfc6;
--select-text-bg-color:#4a89dc;
--item-hover-bg-color: #0a0d16;
--control-text-color: #b7b7b7;
--control-text-hover-color: #eee;
--window-border: 1px solid #555;
/*fured: --active-file-bg-color: rgb(34, 34, 34);*/
--active-file-bg-color: #428bca;
--active-file-border-color: #8d8df0;
--primary-color: #a3d5fe;
--active-file-text-color: white;
--item-hover-bg-color: #70717d;
--item-hover-text-color: white;
--primary-color: #6dc1e7;
--rawblock-edit-panel-bd: #333;
--search-select-bg-color: #428bca;
/*fured: end */
}
/**
* forked from pixyll.com
* MIT license
*/
@font-face {
font-family: 'Merriweather';
font-style: normal;
font-weight: normal;
src: local('Merriweather Light'), local('Merriweather-Light'), url('./pixyll/merriweather-v19-latin-300.woff') format('woff');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
font-family: 'Merriweather';
font-style: normal;
font-weight: bold;
src: local('Merriweather Heavy'), local('Merriweather-Heavy'), url('./pixyll/merriweather-v19-latin-700.woff') format('woff');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
font-family: 'Merriweather';
font-style: italic;
font-weight: normal;
src: local('Merriweather Light Italic'), local('Merriweather-LightItalic'), url('./pixyll/merriweather-v19-latin-300italic.woff') format('woff');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
font-family: 'Merriweather';
font-style: italic;
font-weight: bold;
src: local('Merriweather Heavy Italic'), local('Merriweather-HeavyItalic'), url('./pixyll/merriweather-v19-latin-700italic.woff') format('woff');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
font-family: 'Lato';
font-style: normal;
font-weight: normal;
src: local('Lato Light'), local('Lato-Light'), url('./pixyll/lato-v14-latin-300.woff') format('woff');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
font-family: 'Lato';
font-style: normal;
font-weight: bold;
src: local('Lato Black'), local('Lato-Blcak'), url('./pixyll/lato-v14-latin-900.woff') format('woff');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
font-family: 'Lato';
font-style: italic;
font-weight: normal;
src: local('Lato LightItalic'), local('Lato-LightItalic'), url('./pixyll/lato-v14-latin-300italic.woff') format('woff');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
font-family: 'Lato';
font-style: italic;
font-weight: bold;
src: local('Lato BlackItalic'), local('Lato-BlackItalic'), url('./pixyll/lato-v14-latin-900italic.woff') format('woff');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
h1,
.h1,
.f1 {
font-family: Consolas,"Microsoft Yahei",Arial,sans-serif;
color: #B8860B;
font-size: 3rem;
line-height: 3.5rem;
}
h2,
.h2,
.f2 {
color: #B8860B;
font-size: 2rem;
line-height: 2.5rem;
}
h3,
.h3,
.f3 {
color: #B8860B;
font-size: 1rem;
line-height: 1.5rem;
}
p,
.p,
.f4,
h4,
h5,
h6,
dl,
ol,
ul,
pre[cid],
div[cid],
#typora-source {
font-size: 1.2rem;
line-height: 1.5rem;
}
h4 {
color: #B8860B;
font-size: 0.5rem;
}
/*
Pixyll
A simple, beautiful theme for Jekyll that emphasizes content rather than aesthetic fluff.
Best served with BASSCSS (http://jxnblk.github.io/basscss)
Crafted with <3 by John Otander (@4lpine) - ©2015 John Otander MIT License http://opensource.org/licenses/MIT
*/
body {
/*fured: font-family: "Merriweather", "PT Serif", Georgia, "Times New Roman", "STSong", Serif;*/
font-family: Consolas,"Microsoft Yahei",Arial,sans-serif;
line-height: 1.5rem;
font-weight: 400;
}
#write {
max-width: 914px;
/*fured: color: #333;*/
color: #b8bfc6;
}
@media only screen and (min-width: 1400px) {
#write {
max-width: 1100px;
}
}
@media only screen and (min-width: 1700px) {
#write {
max-width: 1200px;
}
}
img {
width: auto;
max-width: 100%;
}
body {
font-size: 1.5rem;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.ty-table-edit {
background: #ededed;
}
table {
width: 100%;
font-size: 1.125rem;
}
table > thead > tr > th,
table > thead > tr > td,
table > tbody > tr > th,
table > tbody > tr > td,
table > tfoot > tr > th,
table > tfoot > tr > td {
padding: 12px;
line-height: 1.2;
vertical-align: top;
border-top: 1px solid #333;
}
table > thead > tr > th {
vertical-align: bottom;
border-bottom: 2px solid #333;
}
table > caption + thead > tr:first-child > th,
table > caption + thead > tr:first-child > td,
table > colgroup + thead > tr:first-child > th,
table > colgroup + thead > tr:first-child > td,
table > thead:first-child > tr:first-child > th,
table > thead:first-child > tr:first-child > td {
border-top: 0;
}
table > tbody + tbody {
border-top: 2px solid #333;
}
p {
font-weight: 300;
line-height: 1.5;
}
abbr {
border-bottom: 1px black dotted;
cursor: help;
}
pre,
code {
font-family: Menlo, Monaco, "Courier New", monospace;
color: #2E8B57;
}
code,
.md-fences {
color: #2E8B57;
background-color: #333;
/*fured: background-color: white;*/
/*fured: color: #7a7a7a;*/
}
.md-fences {
padding: 1.125em;
margin-bottom: 0.88em;
font-size: 2rem;
/*fured border: 1px solid #7a7a7a; */
border: 0px solid #7a7a7a;
padding-bottom: 0.5rem;
padding-top: 0.5rem;
}
blockquote {
padding: 1.33em;
font-style: italic;
border-left: 5px solid #7a7a7a;
color: #7a7a7a;
}
blockquote em {
color: #000;
}
blockquote footer {
font-size: .85rem;
font-style: normal;
background-color: #fff;
color: #7a7a7a;
border-color: transparent;
}
h1,
.h1,
h2,
.h2,
h3,
.h3,
h4,
.h4,
h5,
.h5,
h6,
.h6 {
/*font-family: "Lato", 'Helvetica Neue', Helvetica, sans-serif;*/
font-family: serif;
font-weight: bold;
line-height: 1.2;
margin: 1em 0 0.5em;
}
@media screen and (min-width: 48em) {
.h1,
h1 {
font-size: 3.250rem;
}
.h2,
h2 {
font-size: 2.298rem;
}
.h3,
h3 {
font-size: 1.625rem;
}
.h4,
h4 {
font-size: 1.3rem;
}
#write>h4.md-focus:before,
#write>h5.md-focus:before,
#write>h6.md-focus:before{
top: 1px;
}
.p,
p,
li {
/*fured: 正文文字和行高*/
font-size: 1.25rem;
line-height: 1.2;
}
table {
font-size: 1.25rem;
}
}
@media (max-width: 48em) {
blockquote {
margin-left: 1rem;
margin-right: 0;
padding: 0.5em;
}
.h1,
h1 {
font-size: 2.827rem;
}
.h2,
h2 {
font-size: 1.999rem;
}
.h3,
h3 {
font-size: 1.413rem;
}
.h4,
h4 {
font-size: 1.3rem;
}
}
@media screen and (min-width: 64em) {
.h1,
h1 {
/*fured: 标题字体大小*/
font-size: 5rem;
}
.h2,
h2 {
font-size: 3rem;
}
.h3,
h3 {
font-size: 2rem;
}
.h4,
h4 {
font-size: 1rem;
}
#write>h4.md-focus:before{
top:4px;
}
}
a {
/*fured: color: #463F5C;*/
color: green;
text-decoration: underline;
}
#write {
padding-top: 2rem;
}
#write pre.md-meta-block {
min-height: 35px;
padding: 0.5em 1em;
white-space: pre;
border: 0px;
border-left: 30px #f8f8f8 solid;
border-right: 30px #f8f8f8 solid;
width: 100vw;
max-width: calc(100% + 60px);
margin-left: -30px;
margin-bottom: 2em;
margin-top: -2010px;
padding-top: 2000px;
padding-bottom: 10px;
line-height: 1.5em;
color: #7a7a7a;
background-color: #fafafa;
font-family: 'Lato', 'Helvetica Neue', Helvetica, sans-serif;
font-weight: 300;
clear: both;
padding-left: 0;
font-size:1.125rem;
}
.md-image>.md-meta {
color: #463F5C
}
.footnotes {
font-size:1.1rem;
}
.md-tag {
font-family: 'Lato', 'Helvetica Neue', Helvetica, sans-serif;
}
.code-tooltip {
background: white;
}
.code-tooltip-content {
font-size: 1.1rem;
}
.task-list{
padding-left: 0;
}
.md-task-list-item {
padding-left:34px;
}
.md-task-list-item > input{
width: 1.25rem;
height: 1.25rem;
display: block;
-webkit-appearance: initial;
top: -0.2rem;
margin-left: -1.6em;
margin-top: calc(1rem - 7px);
border: none;
}
.md-task-list-item > input:focus{
outline: none;
box-shadow: none;
}
.md-task-list-item > input:before{
border: 1px solid #555;
border-radius: 1.5rem;
width: 1.5rem;
height: 1.5rem;
background: #fff;
content: ' ';
transition: background-color 200ms ease-in-out;
display: block;
}
.md-task-list-item > input:checked:before,
.md-task-list-item > input[checked]:before{
background: #333;
border-width: 2px;
display:inline-block;
transition: background-color 200ms ease-in-out;
}
.md-task-list-item > input:checked:after,
.md-task-list-item > input[checked]:after {
opacity: 1;
}
.md-task-list-item > input:after {
opacity: 1;
-webkit-transition: opacity 0.05s ease-in-out;
-moz-transition: opacity 0.05s ease-in-out;
transition: opacity 0.05s ease-in-out;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
transform: rotate(-45deg);
position: absolute;
top: 0.4375rem;
left: 0.28125rem;
width: 0.9375rem;
height: 0.5rem;
border: 3px solid #fff;
border-top: 0;
border-right: 0;
content: ' ';
opacity: 0;
}
.md-tag {
color:inherit;
}
.md-toc:focus .md-toc-content{
margin-top: 19px;
}
#typora-sidebar {
font-size:1rem !important;
}
.html-for-mac #typora-sidebar {
background-color:white;
}
.outline-content li, .outline-content ul {
font-size:1rem !important;
}
.outline-title {
line-height: inherit;
margin-top: 10px;
}
.outline-expander {
width: 18px;
}
.outline-expander:before {
content: "+";
font-family: inherit;
color: rgb(108, 108, 108);
font-size: 1.5rem;
top: -0.1rem;
}
.outline-expander:hover:before {
content: "+";
}
.outline-item-open>.outline-item>.outline-expander:before{
content: "-";
}
/** source code mode */
#typora-source {
font-family: Courier, monospace;
color: #6A6A6A;
}
.os-windows #typora-source {
font-family: inherit;
}
.cm-s-typora-default .cm-header,
.cm-s-typora-default .cm-property,
.CodeMirror.cm-s-typora-default div.CodeMirror-cursor {
color: #428bca;
}
.cm-s-typora-default .cm-atom, .cm-s-typora-default .cm-number {
color: #777777;
}
.md-diagram-panel {
margin-top: 24px;
margin-left: -1.2em;
}
.md-mathjax-midline {
background: #fafafa;
}
.enable-diagrams pre.md-fences[lang="sequence"] .code-tooltip,
.enable-diagrams pre.md-fences[lang="flow"] .code-tooltip,
.enable-diagrams pre.md-fences[lang="mermaid"] .code-tooltip {
bottom: -3.4em;
}
.dropdown-menu .divider {
border-color: #e5e5e5;
}
/*fured: 增加可折叠代码块 style */
/* 写法
<details>
<summary>数据库设计</summary>
<pre> code... 不能有空行
</pre>
<details>
*/
details {
background-color: #333;
}
/*fured 修改代码框中各种字符的颜色*/
.cm-s-inner .cm-variable, .cm-s-inner .cm-string, .cm-s-inner .cm-property {
color: #2E8B57;
}
/*fured 修改代码块行号旁边竖线颜色 */
.CodeMirror-gutters {
border-right: 1px solid #555;
}
/*fured 修改代码框中$字符颜色 */
.cm-s-inner .cm-def {
color: #7a7a7a;
}
/*fured 修改代码框中布尔值的颜色 */
.cm-s-inner .cm-atom, .cm-s-inner.cm-atom {
color: #7a7a7a;
}
1.3 效果
2 自定义主题
可以很方便自定义外观并且实时可预览,这也是喜欢Typora的原因!
方法:
视图 --> 开发者工具 或者 shift + F12
然后找到对应元素,修改即可,效果不错的话写到主题文件里即可!