diff options
Diffstat (limited to 'layouts/partials/style.html')
| -rw-r--r-- | layouts/partials/style.html | 531 |
1 files changed, 531 insertions, 0 deletions
diff --git a/layouts/partials/style.html b/layouts/partials/style.html new file mode 100644 index 0000000..f108da6 --- /dev/null +++ b/layouts/partials/style.html @@ -0,0 +1,531 @@ +<style> + /* light theme */ + :root { + --width-max: 720px; + --font-primary: "Noto Serif SC", "Source Han Serif SC", serif; + --font-secondary: monospace; + --font-size-primary: 1em; + --font-size-secondary: 0.8em; + --body-bg-color: #ffffff; + --bold-text-color: #222; + --body-text-color: #444; + --link-color: #222; + --link-visited-color: #222; + --table-border-color: #f2f2f2; + --table-th-bg-color: #f2f2f2; + --img-border-color: #f2f2f2; + --code-bg-color: #f2f2f2; + --code-text-color: #222; + --blockquote-border-color: #666; + --blockquote-text-color: #666; + --upvoted-color: #fa8072; + --caption-text-color: #666; + --toc-text-color: #e5e5e5; + --toc-hover-color: #655e5e; + } + + .wm { + border: 1px #d0d7de solid; + border-radius: 0.25em; + padding-top: 0; + padding: 1.5vw; + background-color: #f6f8fa; + margin-top: 1vh; + } + + .wm p { + margin-top: 1px; + } + + .item-link { + white-space: nowrap; + overflow: hidden; + } + + .post-info { + text-align: center; + margin-bottom: 3vh; + } + .category-link { + color: #999; + } + + h1.post-title { + margin-top: 5vh; + margin-bottom: 10px; + text-align: center; + } + + h1.post-title a { + font-size: 30px; + font-weight: 700; + } + + .recent-list { + padding-left: 2vw; + } + + .recent-item { + list-style-type: none; + } + + .post-date { + display: inline; + } + + .post-date, + .post-date-shortcode { + margin-left: auto; + color: #999; + } + + article .post-date::after { + content: "/"; + } + + .site-name:hover { + background-color: transparent; + text-decoration: none; + color: #fff; + background-color: #7e4fa0; + } + + .site-name { + transition: 0.3s; + width: 66px; + border-radius: 5px; + text-transform: uppercase; + } + + @media (prefers-color-scheme: dark) { + :root { + --body-bg-color: #121212; + --bold-text-color: #eee; + --body-text-color: #ddd; + --link-color: #ddd; + --link-visited-color: #c3b1ee; + --table-border-color: #999; + --table-th-bg-color: #999; + --img-border-color: #999; + --code-bg-color: #141414; + --code-text-color: #ddd; + --blockquote-border-color: #ccc; + --blockquote-text-color: #ccc; + --caption-text-color: #aaa; + --toc-text-color: #373737; + --toc-hover-color: #cac3c3; + } + + .wm { + background-color: #161b22; + border-color: #30363d; + color: var(--body-text-color); + padding: 10px; + } + + .wm input { + background-color: #010409; + border: #30363d 1px solid; + color: var(--body-text-color); + outline: none; + transition: border-color 0.2s ease-in-out; + } + + #webmention-source:focus { + border-color: var(--color-accent-fg, #0969da); + box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1); + } + + .wm button { + color: var(--body-text-color); + background-color: #161b22; + border: #30363d 1px solid; + } + + .post-title a { + color: #fff !important; + } + + .post-summary { + color: var(--text-color-primary) !important; + } + + .post-item { + border-bottom: 1px solid #414141 !important; + } + + .pagination-link { + border: 1px solid #414141 !important; + } + + nav a, + h1.post-title a, + .category-link, + .blog-posts li a { + text-decoration: none !important; + } + + a { + font-weight: 700 !important; + } + + a:hover { + color: #ddd !important; + } + } + + body { + font-family: var(--font-primary); + font-size: var(--font-size-primary); + margin: auto; + padding: 20px; + max-width: var(--width-max); + text-align: left; + background-color: var(--body-bg-color); + word-wrap: break-word; + overflow-wrap: break-word; + line-height: 1.6; + color: var(--body-text-color); + } + + h1, + h2, + h3, + h4, + h5, + h6, + strong, + b { + color: var(--bold-text-color); + } + + h1, + h2, + h3, + h4, + h5, + h6 { + margin: 16px 0; + } + + a { + color: var(--link-color); + cursor: pointer; + text-decoration: underline 0.2px #d4d4d4; + transition-duration: 0.3s; + font-weight: 600; + } + + a:hover { + color: #3273dc; + } + + .posts-list li { + margin-bottom: 12px; + } + + .title { + text-decoration: none; + border: 0; + } + + .title:hover { + text-decoration: none; + } + + .title span { + font-weight: 400; + } + + nav { + margin-bottom: 15px; + } + + nav a { + margin-right: 8px; + } + + textarea { + width: 100%; + font-size: 16px; + } + + input { + font-size: 14px; + } + + article { + line-height: 1.6; + } + + table { + width: 100%; + border-collapse: collapse; + border: 1px solid var(--table-border-color); + border-radius: 4px; + margin-top: 16px; + } + + th, + td { + border: 1px solid var(--table-border-color); + padding: 4px; + } + + th { + background-color: var(--table-th-bg-color); + } + + hr { + border: 0; + border-top: 1px dashed; + } + + img { + max-width: 100%; + display: block; + margin-left: auto; + margin-right: auto; + border: 1px solid var(--img-border-color); + border-radius: 4px; + content-visibility: auto; + loading: lazy; + } + + img[src*="#minipic"] { + max-width: 50%; + margin-left: 0; + margin-right: auto; + } + + .image-caption figcaption { + text-align: center; + font-style: italic; + font-size: 0.8em; + margin-top: 0.6em; + color: var(--caption-text-color); + } + + .image-caption { + margin: auto; + } + + i { + font-style: normal; + } + + time { + font-family: var(--font-secondary); + font-size: 15px; + color: rgb(163, 163, 163); + } + + code { + font-family: var(--font-secondary); + background-color: var(--code-bg-color); + color: var(--code-text-color); + padding: 2px; + border-radius: 4px; + } + + pre code { + display: block; + padding: 16px; + white-space: pre-wrap; + overflow-x: auto; + } + + div.highlight pre { + border-radius: 4px; + } + + div.highlight code { + background-color: var(--code-bg-color); + color: var(--code-text-color); + } + + blockquote { + border-left: 2px solid var(--blockquote-border-color); + color: var(--blockquote-text-color); + margin: 0; + padding-left: 16px; + font-style: normal; + } + + blockquote p { + margin: 0; + } + + footer { + padding: 25px 0; + text-align: left; + font-size: var(--font-size-secondary); + } + + ul li:has(input) { + list-style-type: none; + margin-left: -25.5px; + } + + /* blog post list */ + ul.blog-posts { + list-style-type: none; + padding: unset; + } + + ul.blog-posts li { + display: flex; + margin-bottom: 8px; + } + + ul.blog-posts li span { + flex: 0 0 130px; + } + + ul.blog-posts li span.grouped { + flex: 0 0 80px; + } + + ul.blog-posts li a:visited { + color: var(--link-visited-color); + } + + ul.blog-posts a { + margin-left: 10px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + /* TOC 样式 */ + div.toc { + position: fixed; /* 固定定位 */ + top: 50%; /* 垂直居中 */ + left: calc( + (100vw + var(--width-max)) / 2 + ); /* 水平定位,根据视口宽度和最大内容宽度计算 */ + transform: translateY(-50%); /* 垂直居中调整 */ + width: calc((90vw - var(--width-max)) / 2); /* 宽度计算 */ + max-height: 80vh; /* 最大高度为视口高度的80% */ + overflow-y: auto; /* 垂直方向内容溢出时显示滚动条 */ + border: none; /* 无边框 */ + padding: 0; /* 无内边距 */ + margin: 0; /* 无外边距 */ + z-index: 99; /* 设置堆叠顺序,确保在其他元素之上 */ + + /* 隐藏滚动条 */ + &::-webkit-scrollbar { + /* Webkit 浏览器(Chrome, Safari)滚动条样式 */ + display: none; /* 隐藏滚动条 */ + } + + -ms-overflow-style: none; /* IE 和 Edge 隐藏滚动条 */ + scrollbar-width: none; /* Firefox 隐藏滚动条 */ + } + + .toc-nav { + /* 目录导航容器样式 */ + padding: 1.5rem; /* 内边距 */ + } + + .toc-nav ul { + /* 目录导航无序列表样式 */ + list-style: none; /* 移除列表项标记 */ + padding: 0; /* 移除内边距 */ + margin: 0; /* 移除外边距 */ + } + + .toc-nav li { + /* 目录导航列表项样式 */ + margin: 8px 0; /* 上下外边距 */ + } + + .toc-nav a { + /* 目录链接样式 */ + display: block; /* 块级显示 */ + text-decoration: none; /* 无下划线 */ + color: transparent; /* 默认透明 */ + padding: 0 12px; /* 内边距 */ + transition: all 0.2s ease; /* 所有属性过渡效果 */ + font-size: 0.9rem; /* 字体大小 */ + line-height: 1.4; /* 行高 */ + text-align: left; /* 文本左对齐 */ + white-space: nowrap; /* 禁止换行 */ + overflow: hidden; /* 隐藏溢出内容 */ + text-overflow: ellipsis; /* 显示省略号 */ + max-width: 100%; /* 限制最大宽度 */ + } + + .toc-nav:hover a { + color: var(--toc-text-color); /* hover时显示文字颜色 */ + } + + .toc-nav a::before { + /* 目录链接前的小横线样式 */ + content: ""; /* 生成内容 */ + display: inline-block; /* 行内块级显示 */ + width: 16px; /* 宽度 */ + height: 4px; /* 高度 */ + background-color: var(--toc-text-color); /* 灰色背景 */ + border-radius: 16px; /* 圆角 */ + margin-right: 12px; /* 右外边距 */ + vertical-align: middle; /* 垂直居中对齐 */ + } + + .toc-nav ul ul a::before { + /* 二级目录链接前的小横线样式 */ + width: 12px; /* 显示宽度 */ + margin-right: 16px; /* 调整右外边距,使其与默认 a::before 占据的总宽度一致 (12px + 12px = 24px) */ + } + + .toc-nav ul ul ul a::before { + /* 三级目录链接前的小横线样式 */ + width: 8px; /* 显示宽度 */ + margin-right: 20px; /* 调整右外边距,使其与默认 a::before 占据的总宽度一致 (8px + 16px = 24px) */ + } + + .toc-nav a.active, /* 活跃状态和鼠标悬停状态的目录链接样式 */ + .toc-nav a:hover { + text-decoration: none; /* 无下划线 */ + color: var(--toc-hover-color); /* 文字颜色变为深灰色 */ + } + + .toc-nav a.active::before, /* 活跃状态和鼠标悬停状态的目录链接前小横线样式 */ + .toc-nav a:hover::before { + background-color: var(--toc-hover-color); /* 背景颜色变为深灰色 */ + } + + /* upvote button style */ + button.upvote-btn { + margin: 0; + margin-left: auto; + padding: 0; + border: none; + background: none; + cursor: pointer; + display: flex; + flex-direction: column; + align-items: center; + color: var(--body-text-color); + } + + button.upvoted { + color: var(--upvoted-color); + } + + span.upvote-count { + margin-top: -4px; + font-size: smaller; + } + + @media (max-width: 800px) { + img[src*="#minipic"] { + max-width: 100%; + margin-left: auto; + margin-right: auto; + } + + div.toc { + display: none; + } + } +</style> |
