You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since our npmjs.com supports light mode only, we should add the CSS :root { color-scheme: only light } to our page.
According to GitHub's documentation Specifying the theme an image is shown to, more and more projects are changing their code to <picture> tags to support dark mode.
But our npmjs.com didn't set the color-scheme, which means it will show dark mode pictures when a user changes the operating system color theme to dark on npmjs.com.
How
Add a <picture> to the page. You can test with this code below:
PackagesHost your dependencies, libraries, and production-ready code, right from your repositoryProduct Feedback
2 participants
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Select Topic Area
Product Feedback
Body
Motivation ("The Why")
Since our npmjs.com supports light mode only, we should add the CSS
:root { color-scheme: only light }
to our page.According to GitHub's documentation Specifying the theme an image is shown to, more and more projects are changing their code to
<picture>
tags to support dark mode.But our npmjs.com didn't set the
color-scheme
, which means it will show dark mode pictures when a user changes the operating system color theme to dark on npmjs.com.How
Add a
<picture>
to the page. You can test with this code below:Or use an image which has prefers-color-scheme inside:
Then you can switch your operating system to dark mode.
Current Behaviour
It will show a blue color image on the page.
Desired Behaviour
The image should be kept in red for light mode.
References
Beta Was this translation helpful? Give feedback.
All reactions