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

Adaptive favicon (light vs. dark mode) #1157

Closed
sl4m opened this issue Jun 26, 2020 · 5 comments · Fixed by #1185
Closed

Adaptive favicon (light vs. dark mode) #1157

sl4m opened this issue Jun 26, 2020 · 5 comments · Fixed by #1185
Labels
C-Enhancement A new feature or request

Comments

@sl4m
Copy link
Contributor

sl4m commented Jun 26, 2020

Summary

The current favicon is not quite visible when the dark system theme is used (I'm currently using macOS's dark mode).

Screenshot 2020-06-25 at 20 23 56

The proposal is to have an adaptive favicon, one that visibly changes the favicon based on the system's current theme using the prefers-color-scheme media query and a bit of JavaScript.

Light mode:

Screenshot 2020-06-25 at 20 17 43

Dark mode:

Screenshot 2020-06-25 at 20 17 23

Motivation

To easily identify the browser tabs that are opened to Rust websites.

Drawbacks

People might not like the light Rust logo in dark mode.

This also uses a CSS media query which is not supported on all versions of Firefox for Android, Samsung Internet, and IE. It's also not supported on the versions prior to:

  • Chrome 76
  • Edge 76
  • Firefox 67
  • Safari 12.1

See more here.

As a workaround, we can have it fallback to the default favicon that we see now (see Rationale and alternatives)

Rationale and alternatives

An alternative solution is to create a favicon that explicitly has a light background inside the Rust logo. Similar to how the favicon looks in light mode, the dark mode will still show dark Rust logo with a light background.

This requires no CSS media query feature support and no extra JavaScript.

Maintenance

I've already created a fix for this issue that involves using the CSS media query and JavaScript.

Unresolved Questions

N/A

@sl4m sl4m added the C-Enhancement A new feature or request label Jun 26, 2020
@Fasani
Copy link
Contributor

Fasani commented Jul 10, 2020

Came across this post today which was a no JS way:
https://catalin.red/svg-favicon-light-dark-theme/

@XAMPPRocky I can pick this task up if you agree to have 1 white and 1 black version of the Rust logo?

@Fasani
Copy link
Contributor

Fasani commented Jul 10, 2020

Actually @sl4m do you have a PR? Sorry I just read that part when you said you already did it. :-)

@XAMPPRocky
Copy link
Member

Thank you for your issue! I think this would be fine as a CSS media query.

@sl4m
Copy link
Contributor Author

sl4m commented Jul 10, 2020

@Fasani Yes, I'd like to take this on if you don't mind.

@Fasani
Copy link
Contributor

Fasani commented Jul 10, 2020

@sl4m please do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Enhancement A new feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants