Skip to content

Commit 0ec3811

Browse files
committed
refactor(theme-default): tweak style variables and page padding
1 parent 160df2d commit 0ec3811

File tree

3 files changed

+19
-23
lines changed

3 files changed

+19
-23
lines changed
Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@import '@vuepress/plugin-palette/palette';
22

3-
// colors
3+
// base colors
44
$accentColor: #3eaf7c !default;
55
$textColor: #2c3e50 !default;
66
$borderColor: #eaecef !default;
@@ -9,11 +9,6 @@ $tipColor: #42b983 !default;
99
$warningColor: #e7c000 !default;
1010
$dangerColor: #cc0000 !default;
1111

12-
// code colors
13-
$codeBgColor: #282c34 !default;
14-
$highlightLineBgColor: rgba(0, 0, 0, 66%) !default;
15-
$lineNumbersColor: rgba(255, 255, 255, 0.3) !default;
16-
1712
// badge component colors
1813
$badgeTipColor: $tipColor !default;
1914
$badgeWarningColor: $warningColor !default;
@@ -22,6 +17,7 @@ $badgeDangerColor: $dangerColor !default;
2217
// layout
2318
$navbarHeight: 3.6rem !default;
2419
$sidebarWidth: 20rem !default;
20+
$mobileSidebarWidth: $sidebarWidth * 0.82 !default;
2521
$contentWidth: 740px !default;
2622
$homePageWidth: 960px !default;
2723

@@ -30,11 +26,11 @@ $MQNarrow: 959px !default;
3026
$MQMobile: 719px !default;
3127
$MQMobileNarrow: 419px !default;
3228

33-
// code
29+
// code blocks
30+
$codeBgColor: #282c34 !default;
31+
$highlightLineBgColor: rgba(0, 0, 0, 66%) !default;
32+
$lineNumbersColor: rgba(255, 255, 255, 0.3) !default;
3433
$lineNumbersWrapperWidth: 3.5rem !default;
3534
$codeLang: 'c' 'cpp' 'cs' 'css' 'dart' 'docker' 'fs' 'go' 'html' 'java' 'js'
3635
'json' 'kt' 'less' 'makefile' 'md' 'php' 'py' 'rb' 'rs' 'sass' 'scss' 'sh'
3736
'styl' 'ts' 'toml' 'vue' 'yml' !default;
38-
39-
// other
40-
$contentClass: '.theme-default-content' !default;

packages/@vuepress/theme-default/src/client/styles/code.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ pre[class*='language-'] {
123123

124124
// ===============================
125125

126-
#{$contentClass} {
126+
.theme-default-content {
127127
code {
128128
color: color.scale($textColor, $lightness: 20%);
129129
padding: 0.25rem 0.5rem;
@@ -134,7 +134,7 @@ pre[class*='language-'] {
134134
}
135135
}
136136

137-
#{$contentClass} {
137+
.theme-default-content {
138138
pre,
139139
pre[class*='language-'] {
140140
line-height: 1.4;
@@ -266,7 +266,7 @@ div[class*='language-'] {
266266

267267
// narrow mobile
268268
@media (max-width: $MQMobileNarrow) {
269-
#{$contentClass} {
269+
.theme-default-content {
270270
div[class*='language-'] {
271271
margin: 0.85rem -1.5rem;
272272
border-radius: 0;

packages/@vuepress/theme-default/src/client/styles/layout.scss

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
@import '_variables';
22
@import '_wrapper';
33

4-
$mobileSidebarWidth: $sidebarWidth * 0.82;
5-
64
.page {
5+
padding-top: $navbarHeight;
76
padding-left: $sidebarWidth;
87
}
98

@@ -63,7 +62,7 @@ $mobileSidebarWidth: $sidebarWidth * 0.82;
6362
}
6463

6564
&.no-navbar {
66-
#{$contentClass}:not(.custom) > h1,
65+
.theme-default-content:not(.custom) > h1,
6766
h2,
6867
h3,
6968
h4,
@@ -73,6 +72,10 @@ $mobileSidebarWidth: $sidebarWidth * 0.82;
7372
padding-top: 0;
7473
}
7574

75+
.page {
76+
padding-top: 0;
77+
}
78+
7679
.sidebar {
7780
top: 0;
7881
}
@@ -97,13 +100,12 @@ h3,
97100
h4,
98101
h5,
99102
h6 {
100-
#{$contentClass}:not(.custom) > & {
103+
.theme-default-content:not(.custom) > & {
101104
margin-top: 0.5rem - $navbarHeight;
102105
padding-top: ($navbarHeight + 1rem);
103106
margin-bottom: 0;
104107

105108
&:first-child {
106-
margin-top: -1.5rem;
107109
margin-bottom: 1rem;
108110

109111
+ p,
@@ -115,12 +117,10 @@ h6 {
115117
}
116118
}
117119

118-
#{$contentClass}:not(.custom) {
120+
.theme-default-content:not(.custom) {
119121
@extend %wrapper;
120122

121-
> *:first-child {
122-
margin-top: $navbarHeight;
123-
}
123+
padding-top: 0;
124124

125125
a:hover {
126126
text-decoration: underline;
@@ -137,7 +137,7 @@ h6 {
137137
}
138138
}
139139

140-
#{$contentClass}.custom {
140+
.theme-default-content.custom {
141141
padding: 0;
142142
margin: 0;
143143

0 commit comments

Comments
 (0)