Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Top Languages Card having issues with picture and source elements for light and dark mode #3722

Closed
kennethjmyers opened this issue Apr 13, 2024 · 0 comments

Comments

@kennethjmyers
Copy link

kennethjmyers commented Apr 13, 2024

Describe the bug

I'm trying to use the picture element to switch between light and dark mode views for the top-langs card but I am running into visual issues that I don't see with the stats card. I'm including two tests, one for the version I'm trying to include in my readme, and one where I remove the light mode source. I'm noticing a few things:

  1. Light mode and dark mode get used, but everything after the first query seems to get ignored.
    1. in my first test HTML is placed first in the list of languages to hide. This indeed seems to get filtered out, but we can see jupyter notebook and css get left in and are not filtered out as expected.
    2. In my second test, jupyter notebook is placed first. Now jupyter notebook is filtered out but HTML is allowed in
  2. This seems mainly an issue with the source element because if you remove the light-mode source and let it default to the img tag, then light mode turns out fine (third test)

What's odd is I'm only seeing this issue on github and not my IDE's preview (I've included screenshots of this, I'm using pycharm in case that's relevant). So Is this somehow an issue on Github's end? I have tested this in chrome and safari and I'm seeing the same results.

First test (copied from readme example, but changed the src link so it uses the top-langs card):

html:

<picture>
  <source
    srcset="https://github-readme-stats.vercel.app/api/top-langs?username=kennethjmyers&show_icons=true&locale=en&layout=compact&theme=dark&hide=HTML,CSS,SCSS,Ruby,Jupyter%20Notebook"
    media="(prefers-color-scheme: dark)"
  />
  <source
    srcset="https://github-readme-stats.vercel.app/api/top-langs?username=kennethjmyers&show_icons=true&locale=en&layout=compact&hide=HTML,CSS,SCSS,Ruby,Jupyter%20Notebook"
    media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)"
  />
  <img src="https://github-readme-stats.vercel.app/api/top-langs?username=kennethjmyers&show_icons=true&locale=en&layout=compact&hide=HTML,CSS,SCSS,Ruby,Jupyter%20Notebook" />
</picture>

What I'm seeing right now on github (dark mode):
image

What I see in my IDE preview (dark mode):

image

IDE preview looks right.

What I'm seeing on github (light mode):

image

Both light mode and dark mode filter out HTML, but not the others

Second Test - put jupyter notebook first

html:

<picture>
  <source
    srcset="https://github-readme-stats.vercel.app/api/top-langs?username=kennethjmyers&show_icons=true&locale=en&layout=compact&theme=dark&hide=Jupyter%20Notebook,HTML,CSS,SCSS,Ruby"
    media="(prefers-color-scheme: dark)"
  />
  <source
    srcset="https://github-readme-stats.vercel.app/api/top-langs?username=kennethjmyers&show_icons=true&locale=en&layout=compact&hide=Jupyter%20Notebook,HTML,CSS,SCSS,Ruby"
    media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)"
  />
  <img src="https://github-readme-stats.vercel.app/api/top-langs?username=kennethjmyers&show_icons=true&locale=en&layout=compact&hide=Jupyter%20Notebook,HTML,CSS,SCSS,Ruby" />
</picture>

What I'm seeing right now on github (dark mode):
image

Jupyter notebook is filtered out (because it is first) but HTML is not filtered out.

What I see in my IDE preview (dark mode):

image

IDE preview still looks right

Third Test - remove the source element for light color-scheme

html:

<picture>
  <source
    srcset="https://github-readme-stats.vercel.app/api/top-langs?username=kennethjmyers&show_icons=true&locale=en&layout=compact&theme=dark&hide=HTML,CSS,SCSS,Ruby,Jupyter%20Notebook"
    media="(prefers-color-scheme: dark)"
  />
  <img src="https://github-readme-stats.vercel.app/api/top-langs?username=kennethjmyers&show_icons=true&locale=en&layout=compact&hide=HTML,CSS,SCSS,Ruby,Jupyter%20Notebook" />
</picture>

What I'm seeing right now on github (dark mode):

image

What I see in my IDE preview (dark mode):

(same as first test, looks correct)

What I'm seeing on github (light mode):

image

So it seems correct if you don't try to use the source element for light mode.

Expected behavior

All of the query elements should be filtered out, not just the first onw.

Screenshots / Live demo link

see above

Additional context

No response

@kennethjmyers kennethjmyers added the bug Something isn't working. label Apr 13, 2024
@kennethjmyers kennethjmyers changed the title Top Languages Card having issues picture and source elements for light and dark mode Top Languages Card having issues with picture and source elements for light and dark mode Apr 13, 2024
@qwerty541 qwerty541 removed the bug Something isn't working. label Apr 13, 2024
Repository owner locked and limited conversation to collaborators Apr 13, 2024
@qwerty541 qwerty541 converted this issue into discussion #3723 Apr 13, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants