Skip to content

fix(site): document search box adapts to the dark theme. #3046

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/sites/src/assets/custom-block.less
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ body {
--color-danger-title: #900;
}
}
.dark {
html.dark {
.markdown-body {
--color-tip-fg: #d3d5d6;
--color-tip-bg: #24292f;
Expand Down
12 changes: 6 additions & 6 deletions examples/sites/src/assets/custom-markdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
}

/* 以下为 github-markdown-css 包的预制颜色,根据暗色主题再修改 */
.dark .markdown-body {
html.dark .markdown-body {
color-scheme: dark;
--color-prettylights-syntax-comment: #8b949e;
--color-prettylights-syntax-constant: #79c0ff;
Expand Down Expand Up @@ -99,22 +99,22 @@ body .markdown-body {
text-shadow: none !important;
}

.dark.dark .markdown-body {
html.dark.dark .markdown-body {
background-color: #000;
}

.dark.dark .markdown-body pre {
html.dark.dark .markdown-body pre {
background-color: #1a1a1a;
}

.dark.dark .markdown-body code {
html.dark.dark .markdown-body code {
color: var(--tv-color-text);
}

.dark.dark .markdown-body code .token.operator {
html.dark.dark .markdown-body code .token.operator {
background-color: transparent;
}

.dark.dark .markdown-body code .hljs-string {
html.dark.dark .markdown-body code .hljs-string {
color: #6f42c1;
}
20 changes: 20 additions & 0 deletions examples/sites/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,26 @@ strong {
color: #969faf;
}

/** docsearch 的暗黑模式 */
html.dark {
--docsearch-text-color: #f5f6f7;
--docsearch-container-background: rgba(9, 10, 17, 0.8);
--docsearch-modal-background: #15172a;
--docsearch-modal-shadow: inset 1px 1px 0 0 #2c2e40, 0 3px 8px 0 #000309;
--docsearch-searchbox-background: #090a11;
--docsearch-searchbox-focus-background: #000;
--docsearch-hit-color: #bec3c9;
--docsearch-hit-shadow: none;
--docsearch-hit-background: #090a11;
--docsearch-key-gradient: linear-gradient(-26.5deg, #565872, #31355b);
--docsearch-key-shadow: inset 0 -2px 0 0 #282d55, inset 0 0 1px 1px #51577d, 0 2px 2px 0 rgba(3, 4, 9, 0.3);
--docsearch-key-pressed-shadow: inset 0 -2px 0 0 #282d55, inset 0 0 1px 1px #51577d, 0 1px 1px 0 #0304094d;
--docsearch-footer-background: #1e2136;
--docsearch-footer-shadow: inset 0 1px 0 0 rgba(73, 76, 106, 0.5), 0 -4px 8px 0 rgba(0, 0, 0, 0.2);
--docsearch-logo-color: #fff;
--docsearch-muted-color: #7f8497;
}

:root {
--docsearch-primary-color: #1476ff;
--docsearch-searchbox-background: #f5f5f5;
Expand Down
1 change: 1 addition & 0 deletions examples/sites/src/views/components-doc/common.vue
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ defineExpose({ loadPage })
justify-content: space-between;
align-items: flex-start;
column-gap: 16px;
overflow: auto;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding overflow: auto; might cause unexpected scrollbars in some browsers. Ensure this change is intended and tested across different browsers.

}

.cmp-container {
Expand Down
14 changes: 9 additions & 5 deletions examples/sites/src/views/components-doc/components/api-docs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,7 @@ defineExpose({ jumpToApi })
color: var(--primary);
border: 1px solid var(--primary);
}
.dark .api-groupname-tag {
color: var(--tv-color-text-secondary);
background-color: var(--tv-color-bg-header);
border: none;
}

.api-table-box {
overflow-x: auto;
width: 100%;
Expand Down Expand Up @@ -231,3 +227,11 @@ defineExpose({ jumpToApi })
}
}
</style>

<style lang="less">
html.dark .api-groupname-tag {
color: var(--tv-color-text-secondary);
background-color: var(--tv-color-bg-header);
border: none;
}
</style>
4 changes: 2 additions & 2 deletions examples/sites/src/views/components-doc/components/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,12 @@ onBeforeUnmount(() => {
</style>

<style lang="less">
.dark .pc-demo-container.pc-demo-container {
html.dark .pc-demo-container.pc-demo-container {
background-color: #1a1a1a;
border: none;
}

.dark .demo-content.demo-content .demo-desc {
html.dark .demo-content.demo-content .demo-desc {
color: #b3b3b3;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export default defineComponent({
margin-right: 0;
}
}
.dark .settings-btn {
html.dark .settings-btn {
background-color: var(--tv-color-bg-dark);
}

Expand Down Expand Up @@ -363,7 +363,7 @@ export default defineComponent({
border-radius: 12px;
background-color: var(--tv-color-bg);
}
.dark .tiny-popover.tiny-popper.theme-settings-popover {
html.dark .tiny-popover.tiny-popper.theme-settings-popover {
background-color: var(--tv-color-bg-dark);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const mdContent = computed(() =>
</style>

<style lang="less">
.dark .docs-header {
html.dark .docs-header {
background-color: #1a1a1a;

.markdown-top-body {
Expand Down
2 changes: 1 addition & 1 deletion examples/sites/src/views/layout/layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ export default defineComponent({
}
}

.dark #layoutSider {
html.dark #layoutSider {
border-right: 1px solid #1a1a1a; // 没有常用变量
}

Expand Down
4 changes: 2 additions & 2 deletions examples/sites/src/views/overview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export default defineComponent({
}
}

.dark .component-card {
html.dark .component-card {
&:hover {
box-shadow: 1px 1px 6px 6px rgba(255, 255, 255, 0.08);
}
Expand All @@ -229,7 +229,7 @@ export default defineComponent({
width: 24.25%;
}

.dark .overview-card-container {
html.dark .overview-card-container {
background-color: var(--tv-color-bg-dark);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/theme/src/checkbox/vars.less
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@
// 复选框选中禁用背景色
--tv-Checkbox-checked-disabled-bg-color: var(--tv-color-icon-checked-disabled);
// 复选框选中禁用边框色
--tv-Checkbox-checked-disabled-border-color: var(--tv-color-bg-disabled-control-unactive)
--tv-Checkbox-checked-disabled-border-color: var(--tv-color-bg-disabled-control-unactive);
}
Loading