mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2025-09-15 12:58:48 +08:00
improvement: 首頁社交圖標左右邊距調整 feat: 文章版權增加圖標 improvement: 重構 main.js 代碼 improvement: 優化 pjax 下的性能 fix: 修復子目錄下,pjax 跳轉 404 錯誤 feat: getScript 增加 attribute 配置 improvement: 優化手機端 toc 打開和關閉特效 improvement: 文章進入特效改為 transform, 優化 stylus improvement: 目錄側邊欄出現滾動條時,元素不會被擠壓 feat: 文章左右對齊 improvement: 處理 waline 的 url 後面多 / 導致跨域的問題 fix: 修復夜間模式下,小屏幕的toc 滾動條顏色不明顯的 bug fix: 修復設置字體超過17px時,toc 裏面的邊框異常的 bug improvement: 優化語言文件部分用詞 improvement: disqus 和 disqusjs 的評論數獲取不到時,顯示為 0 improvement: disqusjs 的評論數改為 api 獲取 improvement: 代碼優化 improvement: 更新 plugins.yml
228 lines
4.6 KiB
Stylus
228 lines
4.6 KiB
Stylus
$highlight_theme = hexo-config('highlight_theme')
|
|
wordWrap = $highlight_enable && !$highlight_line_number && hexo-config('code_word_wrap')
|
|
|
|
@require 'theme'
|
|
|
|
:root
|
|
--hl-color: $highlight-foreground
|
|
--hl-bg: $highlight-background
|
|
--hltools-bg: $highlight-tools.bg-color
|
|
--hltools-color: $highlight-tools.color
|
|
--hlnumber-bg: $highlight-gutter.bg-color
|
|
--hlnumber-color: $highlight-gutter.color
|
|
--hlscrollbar-bg: $highlight-scrollbar
|
|
--hlexpand-bg: linear-gradient(180deg, rgba($highlight-background, .6), rgba($highlight-background, .9))
|
|
|
|
[data-theme='dark']
|
|
--hl-color: alpha(#FFFFFF, .7)
|
|
--hl-bg: lighten(#121212, 2)
|
|
--hltools-bg: lighten(#121212, 3)
|
|
--hltools-color: #90a4ae
|
|
--hlnumber-bg: lighten(#121212, 2)
|
|
--hlnumber-color: alpha(#FFFFFF, .4)
|
|
--hlscrollbar-bg: lighten(#121212, 5)
|
|
--hlexpand-bg: linear-gradient(180deg, rgba(lighten(#121212, 2), .6), rgba(lighten(#121212, 2), .9))
|
|
|
|
if $highlight_enable
|
|
@require 'highlight/index'
|
|
|
|
if $prismjs_enable
|
|
@require 'prismjs/index'
|
|
|
|
$code-block
|
|
overflow: auto
|
|
margin: 0 0 20px
|
|
padding: 0
|
|
background: var(--hl-bg)
|
|
color: var(--hl-color)
|
|
line-height: $line-height-code-block
|
|
|
|
if wordWrap
|
|
counter-reset: line
|
|
white-space: pre-wrap
|
|
|
|
#article-container
|
|
pre,
|
|
code
|
|
font-size: $code-font-size
|
|
font-family: $code-font-family !important
|
|
|
|
code
|
|
padding: 2px 4px
|
|
background: $code-background
|
|
color: $code-foreground
|
|
|
|
pre
|
|
@extend $code-block
|
|
padding: 10px 20px
|
|
|
|
code
|
|
padding: 0
|
|
background: none
|
|
color: var(--hl-color)
|
|
text-shadow: none
|
|
|
|
figure.highlight
|
|
@extend $code-block
|
|
position: relative
|
|
|
|
pre
|
|
margin: 0
|
|
padding: 8px 0
|
|
border: none
|
|
|
|
figcaption,
|
|
.caption
|
|
padding: 6px 0 2px 14px
|
|
font-size: $code-font-size
|
|
line-height: 1em
|
|
|
|
a
|
|
float: right
|
|
padding-right: 10px
|
|
color: var(--hl-color)
|
|
|
|
&:hover
|
|
border-bottom-color: var(--hl-color)
|
|
|
|
&.copy-true
|
|
user-select: all
|
|
|
|
& > table,
|
|
& > pre
|
|
display: block !important
|
|
opacity: 0
|
|
|
|
.highlight-tools
|
|
position: relative
|
|
display: flex
|
|
align-items: center
|
|
overflow: hidden
|
|
min-height: 24px
|
|
height: 2.15em
|
|
background: var(--hltools-bg)
|
|
color: var(--hltools-color)
|
|
font-size: $code-font-size
|
|
|
|
&.closed
|
|
& ~ *
|
|
display: none
|
|
|
|
.expand
|
|
transition: all .3s
|
|
transform: rotate(-90deg) !important
|
|
|
|
.expand
|
|
position: absolute
|
|
padding: .57em .7em
|
|
cursor: pointer
|
|
transition: transform .3s
|
|
|
|
& + .code-lang
|
|
left: 1.7em
|
|
|
|
.code-lang
|
|
position: absolute
|
|
left: 14px
|
|
text-transform: uppercase
|
|
font-weight: bold
|
|
font-size: 1.15em
|
|
user-select: none
|
|
|
|
.copy-notice
|
|
position: absolute
|
|
right: 2.4em
|
|
opacity: 0
|
|
transition: opacity .4s
|
|
|
|
.copy-button
|
|
position: absolute
|
|
right: 14px
|
|
cursor: pointer
|
|
transition: color .2s
|
|
|
|
&:hover
|
|
color: $theme-color
|
|
|
|
.gutter
|
|
user-select: none
|
|
|
|
.gist table
|
|
width: auto
|
|
|
|
td
|
|
border: none
|
|
|
|
if $highlight_theme == 'mac' || ($highlight_theme == 'mac light')
|
|
figure.highlight
|
|
margin: 0 0 24px
|
|
border-radius: 7px
|
|
box-shadow: 0 5px 10px 0 $highlight-mac-border
|
|
-webkit-transform: translateZ(0)
|
|
|
|
.highlight-tools
|
|
&:after
|
|
position: absolute
|
|
left: 14px
|
|
width: 12px
|
|
height: 12px
|
|
border-radius: 50%
|
|
background: #fc625d
|
|
box-shadow: 20px 0 #fdbc40, 40px 0 #35cd4b
|
|
content: ' '
|
|
|
|
.expand
|
|
right: 0
|
|
|
|
&.closed
|
|
transition: all .3s
|
|
transform: rotate(90deg) !important
|
|
|
|
& ~ .copy-notice
|
|
right: 3.45em
|
|
|
|
& ~ .copy-button
|
|
right: 2.1em
|
|
|
|
.code-lang
|
|
left: 75px
|
|
|
|
if hexo-config('highlight_height_limit')
|
|
.code-expand-btn
|
|
position: absolute
|
|
bottom: 0
|
|
z-index: 10
|
|
width: 100%
|
|
background: var(--hlexpand-bg)
|
|
text-align: center
|
|
font-size: $code-font-size
|
|
cursor: pointer
|
|
|
|
i
|
|
padding: 6px 0
|
|
color: var(--hlnumber-color)
|
|
animation: code-expand-key 1.2s infinite
|
|
|
|
&.expand-done
|
|
& > i
|
|
transform: rotate(180deg)
|
|
|
|
& + table,
|
|
& + pre
|
|
margin-bottom: 1.8em
|
|
|
|
&:not(.expand-done)
|
|
& ~ table,
|
|
& ~ pre
|
|
overflow: hidden
|
|
height: unit(hexo-config('highlight_height_limit'), px)
|
|
|
|
@keyframes code-expand-key
|
|
0%
|
|
opacity: .6
|
|
|
|
50%
|
|
opacity: .1
|
|
|
|
100%
|
|
opacity: .6 |