-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Original issue
- Confirm
API parameter
theme
Problem to be solved
theme parameter only provides a standard color to the icon: #ffffff (dark theme) or #000000 (light theme). But it does not automatically select which theme should be used depending on GitHub Markdown theme.
Possible solution
Solution #1 - currently implemented
I recently created a interface page to make easier to use GitHub Markdown logic wrapping the themed icons. The generated code will be like the example below.
Example using html5 icon
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://deviconapi.vercel.app/?html5&theme=dark&size=128">
<img alt="html5" title="html5" src="https://deviconapi.vercel.app/?html5&theme=light&size=128">
</picture>Solution #2 - work with adjustments
Suggested by: @Snailedlt
We can use #gh-dark-mode-only and #gh-light-mode-only suffixes, but, as far as I searched, they only work to actual images. Which means the icons must be on an endpoint.
Example using javascript icon

 As it does not work with API query, it's possible to create those endpoints by adding a new "generator program" (@develop/generator/generators) to build them.
With this solution they will work like ./icons endpoints of Devicon repository.
Solution #3 - does not work properly
The best solution would be to use the API to return a .svg with some logic to automatically choose the correct theme. That way we could make just one request.
Example using css3 icon
This was tested and does not work with GitHub theme, only with browser theme.
Additional information
I'm searching some ways to implement the solution #3 or something close to it. If you have any ideas, it would be great to read them here.
This issue closes NONE