Skip to content

Commit

Permalink
feat(first-screen): add background_img_dark configuration item
Browse files Browse the repository at this point in the history
  • Loading branch information
XPoet committed Oct 30, 2023
1 parent ba0d7a1 commit dceafaa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
5 changes: 4 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ style:
first_screen:
enable: false # Option values: true | false

# First screen background image (You can use local image or image external link)
# First screen background image (You can use local image path or image link)
background_img: /images/bg.svg

# First screen background image in dark mode (You can use local image path or image link)
background_img_dark: /images/bg.svg

# First screen description
# You can use the "||" to begin a newline, maximum is two lines.
description: Keep writing and Keep loving.
Expand Down
15 changes: 11 additions & 4 deletions source/css/layout/_partial/first-screen.styl
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
if (hexo-config('first_screen')) {
$temp-img = hexo-config('first_screen.background_img')
$temp-fs-bg-img-light = hexo-config('first_screen.background_img')
$temp-fs-bg-img-dark = hexo-config('first_screen.background_img_dark')
}
else {
$temp-img = ''
$temp-fs-bg-img-light = ''
$temp-fs-bg-img-dark = ''
}

$first-screen-img = $temp-img ? $temp-img : '/images/bg.svg'
$fs-bg-img-light = $temp-fs-bg-img-light ? $temp-fs-bg-img-light : '/images/bg.svg'
$fs-bg-img-dark = $temp-fs-bg-img-dark ? $temp-fs-bg-img-dark : $fs-bg-img-light

.first-screen-container {
width 100%
height 100vh
overflow hidden
background url($first-screen-img) center center / cover no-repeat
background url($fs-bg-img-light) center center / cover no-repeat

.dark-mode & {
background url($fs-bg-img-dark) center center / cover no-repeat
}

.first-screen-content {
display flex
Expand Down

0 comments on commit dceafaa

Please sign in to comment.