Skip to content

Commit

Permalink
feat: #1 代码块样式优化,整体颜色适配
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Feb 24, 2023
1 parent 635118e commit 13164fe
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 38 deletions.
19 changes: 16 additions & 3 deletions src/styles/common/common.sass
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
/* 字体 */
/* 字体定义 */
@import "/appearance/themes/zhi/csslib/webfont.css"
$font-family-mono: "JetBrains Mono", "LXGW WenKai", "-apple-system", "Microsoft YaHei", "Times New Roman", "方正北魏楷书_GBK"

/* 颜色 */
$primary-color: #333
/* 颜色定义 */
$body-bg: #f4f4f4
$main-bg: #fff
$sidebar-bg: hsla(0, 0%, 100%, 0.8)
$blur-bg: hsla(0, 0%, 100%, 0.9)
$custom-block-bg: #f1f1f1
$text-color: #00323c
$text-lighten-color: #0085ad
$border-color: rgba(0, 0, 0, 0.12)
$code-bg: #f6f6f6
$code-color: #525252

body
--zhi-text-color: #{$text-color}
--zhi-body-bg: #{$body-bg}
16 changes: 15 additions & 1 deletion src/zhi-dark.sass
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/* -------------------------------------------------暗黑模式适配--------------------------------------------------- */
html
&[data-theme-mode="dark"]
color: #ffffff
$body-bg: #27272b
$main-bg: #1e1e22
$sidebar-bg: rgba(30, 30, 34, 0.8)
$blur-bg: rgba(30, 30, 34, 0.8)
$custom-block-bg: #27272b
$text-color: #9b9baa
$text-lighten-color: #0085ad
$border-color: #30363d
$code-bg: #252526
$code-color: #fff

body
--zhi-text-color: #{$text-color}
--zhi-body-bg: #{$body-bg}
17 changes: 17 additions & 0 deletions src/zhi-green.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* -------------------------------------------------护眼模式适配--------------------------------------------------- */
html
&[data-theme-mode-zhi="green"]
$body-bg: #ececcc
$main-bg: #f5f5d5
$sidebar-bg: rgba(245, 245, 213, 0.8)
$blur-bg: rgba(245, 245, 213, 0.9)
$custom-block-bg: #ececcc
$text-color: #704214
$text-lighten-color: #963
$border-color: rgba(0, 0, 0, 0.15)
$code-bg: #282c34
$code-color: #fff

body
--zhi-text-color: #{$text-color}
--zhi-body-bg: #{$body-bg}
26 changes: 14 additions & 12 deletions src/zhi-light.sass
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
/* -------------------------------------------------浅色模式适配--------------------------------------------------- */
html
&[data-theme-mode="light"]
color: red
$body-bg: #f4f4f4
$main-bg: #fff
$sidebar-bg: hsla(0, 0%, 100%, 0.8)
$blur-bg: hsla(0, 0%, 100%, 0.9)
$custom-block-bg: #f1f1f1
$text-color: #00323c
$text-lighten-color: #0085ad
$border-color: rgba(0, 0, 0, 0.12)
$code-bg: #f6f6f6
$code-color: #525252

body
--bodyBg: #f4f4f4
--mainBg: #fff
--sidebarBg: hsla(0, 0%, 100%, 0.8)
--blurBg: hsla(0, 0%, 100%, 0.9)
--customBlockBg: #f1f1f1
--textColor: #00323c
--textLightenColor: #0085ad
--borderColor: rgba(0, 0, 0, 0.12)
--codeBg: #f6f6f6
--codeColor: #525252
body
--zhi-text-color: #{$text-color}
--zhi-body-bg: #{$body-bg}
16 changes: 14 additions & 2 deletions src/zhi.sass
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,20 @@
--b3-font-family-math: var(--b3-font-family)
--b3-border-radius-round: 50%

// 整体背景、字体颜色
body
margin: 0
padding: 0
font-family: var(--b3-font-family)
-webkit-font-smoothing: antialiased
-moz-osx-font-smoothing: grayscale
-webkit-tap-highlight-color: transparent
font-size: 16px
color: var(--zhi-text-color)
background: var(--zhi-body-bg)

// 代码块
@import styles/zhi/widgets/code-block

// 浅色、暗黑单独适配
@import zhi-light, zhi-dark
// 浅色、暗黑、护眼适配
@import zhi-light, zhi-dark, zhi-green
49 changes: 31 additions & 18 deletions theme.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions theme.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 13164fe

Please sign in to comment.