Skip to content

Commit 0015e7f

Browse files
committed
Optimize primary text style
1 parent ca74195 commit 0015e7f

File tree

11 files changed

+180
-161
lines changed

11 files changed

+180
-161
lines changed

404.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<section class="container-404">
1717
<h1 class="title">404</h1>
1818
<p style="text-align: center;">目标页面不存在或已被迁移到新地址</p>
19-
<P style="text-align: center;">博客更新有时会调整URL结构</P>
19+
<P style="text-align: center;">博客更新有时会调整 URL 结构</P>
2020
<P style="text-align: center;">早期链接可能失效</P>
2121
<picture>
2222
<source srcset="https://apqx-host.oss-cn-hangzhou.aliyuncs.com/blog/emojis/noto-animated-emoji/think-face/512.webp"

npm/dist/assets/blog-post.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

npm/dist/assets/blog-scaffold.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

npm/dist/blog-scaffold.js

Lines changed: 119 additions & 119 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

npm/src/component/dialog/SearchDialog.scss

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,20 @@ input {
6161

6262
.search-result-item-type {
6363
font-size: calc(var(--mdc-typography-body1-font-size) - 0.2rem);
64-
padding: 0.06rem 0.5rem;
65-
border-radius: 0.5rem;
64+
padding: 0.2rem 0.5rem;
65+
border-radius: calc(var(--mdc-typography-body1-font-size) - 0.5rem);
6666
margin-right: 0.2rem;
67+
6768
color: var(--list-chip-1-ink);
6869
background: var(--list-chip-1-bg);
6970
}
7071

72+
.font-noto-serif-sc {
73+
.search-result-item-type {
74+
padding: 0.15rem 0.5rem;
75+
}
76+
}
77+
7178
.search-result-item-snippet {
7279
text-align: justify;
7380
line-break: anywhere;

npm/src/component/dialog/TagDialog.scss

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
.tag-list-item__secondary-container {
99
display: flex;
1010
white-space: nowrap;
11+
align-items: center;
1112
}
1213

1314
.tag-list-item__block-container {
1415
overflow-x: auto;
15-
padding-left: 0.1rem;
16-
padding-right: 0.1rem;
1716
}
1817

1918
// 移动端Chrome的scrollBar一直显示,需要消除,其它浏览器scrollBar都会自动隐藏
@@ -52,7 +51,7 @@
5251
.tag-list-item__post-type,
5352
.tag-list-item__post-block1,
5453
.tag-list-item__post-block2 {
55-
padding: 0.18rem 0.5rem;
54+
padding: 0.15rem 0.5rem;
5655
}
5756
}
5857

npm/src/component/dialog/TagDialog.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,11 @@ class PostItem extends React.Component<PostItemProps, any> {
250250
<span className="mdc-deprecated-list-item__text">
251251
<span className="list-item__primary-text one-line">{this.props.data.title}</span>
252252
<div className="list-item__secondary-text tag-list-item__secondary-container">
253-
<span>{this.props.data.date}</span>
253+
{/* <span>{this.props.data.date}</span> */}
254+
<span>
255+
<span className="tag-list-item__post-type">{this.props.data.date}{this.props.data.type}</span>
256+
</span>
254257
<span className="tag-list-item__block-container">
255-
<span className="tag-list-item__post-type">{this.props.data.type}</span>
256258
{this.props.data.block1Array.map(block =>
257259
<span
258260
key={block}

npm/src/component/text.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ p {
7272
code {
7373
@include basicText();
7474
font-family: var(--text-code-font-family);
75+
// 段落中的代码块字重与段落字体匹配
7576
font-weight: var(--text-code-font-weight);
7677
margin: 0;
7778
}
@@ -82,6 +83,8 @@ pre code.hljs {
8283
display: block;
8384
overflow-x: scroll;
8485
line-height: calc(var(--mdc-typography-body1-font-size) + 0.5rem);
86+
// 独立代码块字重为 normal
87+
font-weight: base.$font-weight-normal-default;
8588
border-radius: var(--post-inner-shape-round);
8689
padding: 1rem;
8790
background: var(--pre-code-bg);

npm/src/component/theme.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { showSnackbar } from "./react/Snackbar"
88
export const darkClass = "dark"
99

1010
export function initTheme() {
11+
checkColorfulToolbar()
1112
checkUserTheme()
1213
// 监听系统级主题变化,即系统和导航栏都可以控制主题变化
1314
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", e => {
@@ -26,35 +27,28 @@ export function initTheme() {
2627
}
2728

2829
const metaThemeColor = {
30+
colorful: "#556a3b",
2931
light: "#ffffff",
30-
lightMobile: "#ffffff",
31-
lightChrome: "#ffffff",
32-
dark: "#1d1d1d",
33-
darkMobile: "#1d1d1d",
34-
darkChrome: "#1d1d1d",
32+
dark: "#1d1d1d"
3533
}
3634

3735
const topbarBlur = {
3836
default: true,
3937
mobile: false,
4038
}
4139

40+
// 是否启用彩色标题栏
41+
// 在使用 Material You 的 Android Chrome 上,浅色主题的主题色不会影响 Chrome 工具栏和状态栏颜色,需要设置更深的主题色才会生效
42+
// 暗黑模式下则完全不影响,所以不必设置
43+
const colorfulToolbar = false
44+
4245
function checkMetaThemeColor(dark: boolean, show: boolean) {
43-
// 黑配色
4446
if (show) {
4547
if (dark) {
46-
if (isChrome()) {
47-
setMetaThemeColor(metaThemeColor.darkChrome)
48-
} else if (isMobileOrTablet()) {
49-
setMetaThemeColor(metaThemeColor.darkMobile)
50-
} else {
51-
setMetaThemeColor(metaThemeColor.dark)
52-
}
48+
setMetaThemeColor(metaThemeColor.dark)
5349
} else {
54-
if (isChrome()) {
55-
setMetaThemeColor(metaThemeColor.lightChrome)
56-
} else if (isMobileOrTablet()) {
57-
setMetaThemeColor(metaThemeColor.lightMobile)
50+
if (document.querySelector(".colorful") != null) {
51+
setMetaThemeColor(metaThemeColor.colorful)
5852
} else {
5953
setMetaThemeColor(metaThemeColor.light)
6054
}
@@ -69,6 +63,12 @@ function checkMetaThemeColor(dark: boolean, show: boolean) {
6963
}
7064
}
7165

66+
function checkColorfulToolbar() {
67+
if (colorfulToolbar && isChrome() && isMobileOrTablet()) {
68+
toggleClassWithEnable(document.querySelector(".mdc-top-app-bar"), "colorful", true)
69+
}
70+
}
71+
7272
/**
7373
* 设置浏览器的theme-color属性
7474
* @param {String} color 如果为null则删除属性

npm/src/component/topbar.scss

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,23 @@ body {
1414
--top-bar-slid-translateY : calc(0px - var(--top-bar-height) - 10px)
1515
}
1616

17+
.mdc-top-app-bar.colorful {
18+
background-color: #556a3b;
19+
* {
20+
color: white;
21+
}
22+
}
23+
24+
.dark .mdc-top-app-bar.colorful {
25+
background-color: var(--mdc-theme-primary);
26+
* {
27+
color: var(--mdc-theme-on-primary);
28+
}
29+
}
30+
1731
.mdc-top-app-bar {
1832
// 颜色,默认为 primary
19-
@include top-app-bar.fill-color(var(--mdc-theme-primary));
33+
background-color: var(--mdc-theme-primary);
2034
// 阴影
2135
@include elevation.elevation(map.get(base.$top-bar-elevation, "elevation"), map.get(base.$top-bar-elevation, "shadow-light"), 0);
2236
// border-bottom: 1px solid color.adjust(map.get(base.$top-bar, "bg-light"), $lightness: - 3%);

0 commit comments

Comments
 (0)