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

问一下自定义css修改, 如何适配不同主题 #196

Open
GJKen opened this issue Nov 5, 2024 · 2 comments
Open

问一下自定义css修改, 如何适配不同主题 #196

GJKen opened this issue Nov 5, 2024 · 2 comments

Comments

@GJKen
Copy link

GJKen commented Nov 5, 2024

冒昧的问一下, 我个人不是很会前端

如何自定义元素的背景颜色, 以致于可适配不同主题的切换

background-color: var(--bgColor-default, var(--color-canvas-default));

image

修改--bgColor-default, 或者是--color-canvas-default的值切换主题都会出现问题, 我太菜了

@GJKen GJKen changed the title 问一下css的问题 问一下自定义css修改, 如何适配不同主题 Nov 5, 2024
@Meekdai
Copy link
Owner

Meekdai commented Nov 6, 2024

你可以使用 @media (prefers-color-scheme: light)的方式来定义颜色变量 ,或者可以直接使用primer.css里面的不同主题对应的颜色变量也行

@GJKen
Copy link
Author

GJKen commented Nov 6, 2024

你可以使用 @media (prefers-color-scheme: light)的方式来定义颜色变量 ,或者可以直接使用primer.css里面的不同主题对应的颜色变量也行

我是直接修改primer.css

增加了@media响应dark模式
image

实际换到dark主题还是未生效

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants