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

[FEATURE REQUEST] Ability to set theme=auto #927

Open
shreyas-a-s opened this issue Apr 23, 2024 · 7 comments
Open

[FEATURE REQUEST] Ability to set theme=auto #927

shreyas-a-s opened this issue Apr 23, 2024 · 7 comments

Comments

@shreyas-a-s
Copy link

Feature requested

Even though I prefer dark mode always, the one who views my profile might be using a light theme and it would be great to have an auto option so that it detects users browser settings and applies theme based on it.

@shreyas-a-s
Copy link
Author

I am not fully sure, but I think it is possible using prefers-color-scheme property of css.

@Jeesson
Copy link

Jeesson commented May 1, 2024

Hi there! @shreyas-a-s

I'm so happy you're interested in learning more about this. I've already done the hard work for you and found a great resource that explains how to do this. You can check it out here. Let me know if you have any questions!

@shreyas-a-s
Copy link
Author

shreyas-a-s commented May 2, 2024

Wow! Such an interesting and cool way of doing it. Thanks @Jeesson for doing the hard work of finding it and letting me know of such a feature.

I have tried it out and it seems this only works if we use image files like svg, png, etc. and not working well with links like in the case of skill-icons.

This is the code I have tried to implement and it didn't work. It only showed the light mode icons:

<picture>
 <source media="(prefers-color-scheme: dark)" srcset="https://skillicons.dev/icons?i=git,neovim,vim,linux,bash,aws,md,html,css,js,python,c,php&theme=dark&perline=8">
  <source media="(prefers-color-scheme: light)" srcset="https://skillicons.dev/icons?i=git,neovim,vim,linux,bash,aws,md,html,css,js,python,c,php&theme=light&perline=8">
  <img alt="Shows my tech stack in dark mode and light mode." src="https://skillicons.dev/icons?i=git,neovim,vim,linux,bash,aws,md,html,css,js,python,c,php&theme=light&perline=8">
</picture>

Now I have settled on using the links to create svg images and use them in the readme and it works using this code:

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://github.com/shreyas-a-s/shreyas-a-s/blob/7456db2fddfea17a9c103a805fd7644186a2d04a/tech-stack-dark.svg">
  <source media="(prefers-color-scheme: light)" srcset="https://github.com/shreyas-a-s/shreyas-a-s/blob/7456db2fddfea17a9c103a805fd7644186a2d04a/tech-stack-light.svg">
  <img alt="Shows my tech stack in dark mode and light mode." src="https://github.com/shreyas-a-s/shreyas-a-s/blob/7456db2fddfea17a9c103a805fd7644186a2d04a/tech-stack-light.svg">
</picture>

Have you had any luck directly using the skill-icon link in the code?

@Jeesson
Copy link

Jeesson commented May 2, 2024

I'm so happy to say that I absolutely succeeded! I would love to share the result with you, but I think you're already on the right direction!

@shreyas-a-s
Copy link
Author

Thanks for the help as well as the inspiring words, @Jeesson. I have played around with it a bit more but having the same conclusion. Not able to directly use links in the code. I would love to see the results you've had.

@LelouchFR
Copy link
Contributor

It would be interresting, you can open a new issue on my project so I can try to find a way to implement this on mine (is kinda the same, but basically community driven + made in go for better performances) https://github.com/LelouchFR/skill-icons

@shreyas-a-s
Copy link
Author

It would be interresting, you can open a new issue on my project so I can try to find a way to implement this on mine (is kinda the same, but basically community driven + made in go for better performances) https://github.com/LelouchFR/skill-icons

Cool. I think that would be great to see it implemented there so that maybe a new method can be found. If so that will benefit everybody and even this project as well. I can open an issue in your repo. See ya there. 👋

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

3 participants