lunatic-fox / lunatic-fox/deviconapi

[Feature Request] - Make theme selection automatic in GitHub Markdown

Open
#2 4 comments 2 reactions 1 assignee View on GitHub

@lunatic-fox is already working on this.

Since Oct 28, 2022.

enhancement good first issue help wanted
Dominant language
TypeScript
Stars
10
Forks
5
PR merge metrics
No merged PRs in 30d

Description

### Original issue

- [X] 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***
```html


html5

```

## 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***
```markdown
![](./icons/javascript.svg#gh-dark-mode-only)
![](./icons/javascript.svg#gh-light-mode-only)
```
 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***
```markdown
![](https://deviconapi.vercel.app/?css3&auto)
```
 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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.