Skip to content

Commit

Permalink
chore: adjust the directory structure and naming of CSS files
Browse files Browse the repository at this point in the history
  • Loading branch information
XPoet committed Sep 12, 2023
1 parent bb2e0ad commit ac9c67c
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 168 deletions.
5 changes: 3 additions & 2 deletions source/css/common/basic.styl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@import 'variables.styl'
@import 'css-variables.styl'
@import 'stylus-variables.styl'
@import 'animated.styl'
@import 'keep-theme.styl'
@import 'keep-style.styl'

// ======================================================================
// all
Expand Down
2 changes: 1 addition & 1 deletion source/css/common/code-block/code-theme.styl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "../variables.styl"
@import "../stylus-variables.styl"

// A single line block of code
$code-foreground = lighten($text-color-3, 2%)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "variables.styl"
@import "stylus-variables.styl"

:root {
// ==============================================================================================
Expand Down
161 changes: 161 additions & 0 deletions source/css/common/keep-style.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
@import 'stylus-variables.styl'

keep-container(sValue, pValue, mbValue) {
box-sizing border-box
margin-bottom mbValue
padding pValue
background var(--content-background-color)
border-radius var(--box-border-radius)
box-shadow 0 0 8px var(--shadow-color)

if (sValue != 1) {
transition-t("transform", "0", "0.2", "linear")
}

&:hover {
if (sValue != 1) {
transform scale(sValue)
}
box-shadow 0 0 12px var(--shadow-hover-color)
}

+keep-tablet() {
margin-bottom mbValue * 0.8
padding pValue * 0.8
border-radius calc(var(--box-border-radius) * 0.8)
}


+keep-mobile() {
margin-bottom mbValue * 0.6
padding pValue * 0.6
border-radius calc(var(--box-border-radius) * 0.6)
}
}


disable-user-select() {
-moz-user-select none
-ms-user-select none
-webkit-user-select none
user-select none
}


not-text-size-adjust() {
-ms-text-size-adjust none
-moz-text-size-adjust none
-webkit-text-size-adjust none
}


keep-tablet() {
@media (max-width $media-max-width) {
{ block }
}
}


keep-mobile() {
@media (max-width $media-max-width-mobile) {
{ block }
}
}


root-color(mode) {
// primary color
--primary-color $primary-color
--primary-color-light-1 $primary-color-light-1
--primary-color-light-2 $primary-color-light-2
--primary-color-dark-1 $primary-color-dark-1
--primary-color-dark-2 $primary-color-dark-2

// background color
--background-color-1 mode == 'light' ? $background-color-1 : $dark-background-color-1
--background-color-1-transparent mode == 'light' ? $background-color-1-transparent : $dark-background-color-1-transparent
--background-color-2 mode == 'light' ? $background-color-2 : $dark-background-color-2
--background-color-3 mode == 'light' ? $background-color-3 : $dark-background-color-3

// content background color
--content-background-color mode == 'light' ? $content-background-color : $dark-content-background-color

// text color
--text-color-1 mode == 'light' ? $text-color-1 : $dark-text-color-1
--text-color-2 mode == 'light' ? $text-color-2 : $dark-text-color-2
--text-color-3 mode == 'light' ? $text-color-3 : $dark-text-color-3
--text-color-4 mode == 'light' ? $text-color-4 : $dark-text-color-4
--text-color-5 mode == 'light' ? $text-color-5 : $dark-text-color-5
--text-color-6 mode == 'light' ? $text-color-6 : $dark-text-color-6

// toc text color
--toc-text-color mode == 'light' ? $toc-text-color : $dark-toc-text-color

// badge color
--badge-color mode == 'light' ? $badge-color : $dark-badge-color
--badge-background-color mode == 'light' ? $badge-background-color : $dark-badge-background-color

// border color
--border-color mode == 'light' ? $border-color : $dark-border-color

// selection color
--selection-color mode == 'light' ? $selection-color : $dark-selection-color

// shadow color
--shadow-color mode == 'light' ? $shadow-color : $dark-shadow-color
--shadow-hover-color mode == 'light' ? $shadow-hover-color : $dark-shadow-hover-color

// scrollbar color
--scrollbar-color mode == 'light' ? $scrollbar-color : $dark-scrollbar-color
--scrollbar-background-color mode == 'light' ? $scrollbar-background-color : $dark-scrollbar-background-color
--toc-scrollbar-color mode == 'light' ? $toc-scrollbar-color : $dark-toc-scrollbar-color

// copyright icon background color
--copyright-icon-bg-color mode == 'light' ? $copyright-icon-bg-color : $dark-copyright-icon-bg-color

// avatar background color
--avatar-background-color mode == 'light' ? $avatar-background-color : $dark-avatar-background-color

// header transparent background color
--header-transparent-background-1 mode == 'light' ? $header-transparent-background-1 : $dark-header-transparent-background-1
--header-transparent-background-2 mode == 'light' ? $header-transparent-background-2 : $dark-header-transparent-background-2

// pjax progress bar color
--pjax-progress-bar-color mode == 'light' ? $pjax-progress-bar-color : $dark-pjax-progress-bar-color

// article aging tips primary color
--article-aging-tips-color mode == 'light' ? $article-aging-tips-color : $dark-article-aging-tips-color
--article-aging-tips-background-color mode == 'light' ? $article-aging-tips-background-color : $dark-article-aging-tips-background-color
--article-aging-tips-border-color mode == 'light' ? $article-aging-tips-border-color : $dark-article-aging-tips-border-color

--post-h-bottom-border-color mode == 'light' ? $post-h-bottom-border-color : $dark-post-h-bottom-border-color
}


:root {
root-color('light')
}


@media (prefers-color-scheme light) {
:root {
root-color('light')
}
}


@media (prefers-color-scheme dark) {
:root {
root-color('dark')
}
}


.light-mode {
root-color('light')
}


.dark-mode {
root-color('dark')
}
50 changes: 0 additions & 50 deletions source/css/common/keep-theme.styl

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,6 @@ $has-fs-content-max-width = $content-max-width * 1.2
$media-max-width = 800px // media query max width (tablet)
$media-max-width-mobile = 500px // media query max width (mobile)

keep-tablet() {
@media (max-width $media-max-width) {
{ block }
}
}

keep-mobile() {
@media (max-width $media-max-width-mobile) {
{ block }
}
}


// ==============================================================================================
// z-index
Expand Down Expand Up @@ -76,7 +64,7 @@ $primary-color-dark-2 = darken($primary-color, 20%)


// ==============================================================================================
// theme light mode color set
// theme light mode color
// ==============================================================================================
$background-color-1 = #fff
$background-color-1-transparent = alpha($background-color-1, 0.6)
Expand Down Expand Up @@ -123,7 +111,7 @@ $post-h-bottom-border-color = alpha($text-color-3, 0.15)


// ==============================================================================================
// theme dark mode color set
// theme dark mode color
// ==============================================================================================
$dark-background-color-1 = #22272e
$dark-background-color-1-transparent = alpha($dark-background-color-1, 0.6)
Expand Down Expand Up @@ -167,102 +155,3 @@ $dark-article-aging-tips-background-color = alpha($dark-article-aging-tips-color
$dark-article-aging-tips-border-color = alpha($dark-article-aging-tips-color, 0.6)

$dark-post-h-bottom-border-color = alpha($dark-text-color-3, 0.15)


// ==============================================================================================
// light/dark mode color
// ==============================================================================================
root-color(mode) {
// primary color
--primary-color $primary-color
--primary-color-light-1 $primary-color-light-1
--primary-color-light-2 $primary-color-light-2
--primary-color-dark-1 $primary-color-dark-1
--primary-color-dark-2 $primary-color-dark-2

// background color
--background-color-1 mode == 'light' ? $background-color-1 : $dark-background-color-1
--background-color-1-transparent mode == 'light' ? $background-color-1-transparent : $dark-background-color-1-transparent
--background-color-2 mode == 'light' ? $background-color-2 : $dark-background-color-2
--background-color-3 mode == 'light' ? $background-color-3 : $dark-background-color-3

// content background color
--content-background-color mode == 'light' ? $content-background-color : $dark-content-background-color

// text color
--text-color-1 mode == 'light' ? $text-color-1 : $dark-text-color-1
--text-color-2 mode == 'light' ? $text-color-2 : $dark-text-color-2
--text-color-3 mode == 'light' ? $text-color-3 : $dark-text-color-3
--text-color-4 mode == 'light' ? $text-color-4 : $dark-text-color-4
--text-color-5 mode == 'light' ? $text-color-5 : $dark-text-color-5
--text-color-6 mode == 'light' ? $text-color-6 : $dark-text-color-6

// toc text color
--toc-text-color mode == 'light' ? $toc-text-color : $dark-toc-text-color

// badge color
--badge-color mode == 'light' ? $badge-color : $dark-badge-color
--badge-background-color mode == 'light' ? $badge-background-color : $dark-badge-background-color

// border color
--border-color mode == 'light' ? $border-color : $dark-border-color

// selection color
--selection-color mode == 'light' ? $selection-color : $dark-selection-color

// shadow color
--shadow-color mode == 'light' ? $shadow-color : $dark-shadow-color
--shadow-hover-color mode == 'light' ? $shadow-hover-color : $dark-shadow-hover-color

// scrollbar color
--scrollbar-color mode == 'light' ? $scrollbar-color : $dark-scrollbar-color
--scrollbar-background-color mode == 'light' ? $scrollbar-background-color : $dark-scrollbar-background-color
--toc-scrollbar-color mode == 'light' ? $toc-scrollbar-color : $dark-toc-scrollbar-color

// copyright icon background color
--copyright-icon-bg-color mode == 'light' ? $copyright-icon-bg-color : $dark-copyright-icon-bg-color

// avatar background color
--avatar-background-color mode == 'light' ? $avatar-background-color : $dark-avatar-background-color

// header transparent background color
--header-transparent-background-1 mode == 'light' ? $header-transparent-background-1 : $dark-header-transparent-background-1
--header-transparent-background-2 mode == 'light' ? $header-transparent-background-2 : $dark-header-transparent-background-2

// pjax progress bar color
--pjax-progress-bar-color mode == 'light' ? $pjax-progress-bar-color : $dark-pjax-progress-bar-color

// article aging tips primary color
--article-aging-tips-color mode == 'light' ? $article-aging-tips-color : $dark-article-aging-tips-color
--article-aging-tips-background-color mode == 'light' ? $article-aging-tips-background-color : $dark-article-aging-tips-background-color
--article-aging-tips-border-color mode == 'light' ? $article-aging-tips-border-color : $dark-article-aging-tips-border-color

--post-h-bottom-border-color mode == 'light' ? $post-h-bottom-border-color : $dark-post-h-bottom-border-color
}


:root {
root-color('light')
}

@media (prefers-color-scheme light) {
:root {
root-color('light')
}
}

@media (prefers-color-scheme dark) {
:root {
root-color('dark')
}
}


.light-mode {
root-color('light')
}


.dark-mode {
root-color('dark')
}
1 change: 0 additions & 1 deletion source/css/style.styl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "common/css-vars.styl"
@import "common/basic.styl"
@import "common/markdown.styl"
@import "common/code-block/highlight.styl"
Expand Down

0 comments on commit ac9c67c

Please sign in to comment.