Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

github-auto 的复制按钮样式在明暗切换场景显示异常 #36

Open
VoidYun opened this issue Jan 2, 2025 · 0 comments
Open
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@VoidYun
Copy link

VoidYun commented Jan 2, 2025

What type of issue is this?

/kind bug

System information:

What happened?

在明暗切换下复制按钮的样式没有变化

Image

What did you expect to happen?

来回切换下,亮色保持白底黑字,暗色保持黑底白字

How can we reproduce it (as minimally and precisely as possible)?

安装 highlight.js 代码高亮 1.3.2 样式设置为 github-auto.min.css ,在亮色模式观察复制按钮样式,随后切换为暗色模式观察样式,然后刷新页面再观察样式

Anything else we need to know?

目前我的解决办法是注入下面样式,其中 --bc-hljs--color-hljs 分别为 github-auto.min.css 的主题 background-color 和 color

<style>
.hljs-copy-button {
    --hljs-theme-background: var(--bc-hljs);
    --hljs-theme-color: var(--color-hljs);
}
</style>

主要是为了覆盖

// src/main/resources/static/plugins/highlightjs-copy.js:15

el.parentElement.style.setProperty("--hljs-theme-background", window.getComputedStyle(el).backgroundColor);
el.parentElement.style.setProperty("--hljs-theme-color", window.getComputedStyle(el).color);
@f2c-ci-robot f2c-ci-robot bot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

1 participant