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

Enable user to set default color scheme #1573

Open
musm opened this issue Apr 30, 2021 · 5 comments
Open

Enable user to set default color scheme #1573

musm opened this issue Apr 30, 2021 · 5 comments
Labels
Format: HTML Related to the default HTML output help wanted Type: Enhancement

Comments

@musm
Copy link

musm commented Apr 30, 2021

I have to admit, while I think the PR #1456 is interesting and useful, I'm not sure it's a great idea by default. I think at least having an optional feature to override the default color-scheme would be beneficial.

For example, many documentation sites are not optimally set-up for dark-theme first (if the user has the OS set to a dark theme).

For example, take a look at https://jump.dev/JuMP.jl
image

Similarly, the Makie docs look better with a light-default, as the animations and plots use a white background by default
image

@cormullion
Copy link
Contributor

cormullion commented May 1, 2021

Yes, the recent growth and popularity of DarkMode everywhere has caused a few problems - I've fixed a couple myself and am working through a few more.

The logo at the top left of the Documenter window can automatically switch between light and dark modes. The manual says:

If you want to create a separate design for the dark theme, add a file called logo-dark.svg (or PNG/WEBP/GIF/JPEG).

so that at least can be fixed in an elegant way.

Logos that consist mainly of black-on-transparent-background should probably be redrawn† so that they work better and independently whatever the background color, but it would be even better if Documenter could somehow accept two paths to graphics files and have them automatically selected for display. But this would be terrible for storage space for large documents.

For figures, it's hard to see an alternative to blinding white backgrounds contrasting with dark surroundings. I've been experimenting with off-white colors but I'm not convinced...

Not respecting the user/authors choice also seems wrong... 🤷‍♂️

† I'm always happy to help 😀

@mortenpi
Copy link
Member

mortenpi commented May 5, 2021

This would need some way to communicate the preference across multiple domains, which, I believe, is not possible with Web Storage which we currently use.

@musm
Copy link
Author

musm commented May 7, 2021

Not respecting the user/authors choice also seems wrong... 🤷‍♂️

I'm not sure this is really the case or holds true. For example, Github doesn't default to dark mode even thought I have dark mode set to true in my OS level system preferences. There are many examples of website that follow a similar rule.

My preference would be for Documenter.jl to allow package authors enable or disable this auto-detection of OS level dark-mode (still permitting a dark mode toggle).

@JakobAsslaender
Copy link

+1 for that feature! Ideally, there would be a way to have plots adopted to the theme, but as a first (hopefully easy) way, it would be great if it was possible to hard code the theme during the make.

Nonetheless: Massive fan of Documenter.jl!!!

@JakobAsslaender
Copy link

A hack to force the default theme to dark is to add

run(`sed -i'.old' 's/var darkPreference = false/var darkPreference = true/g' docs/build/assets/themeswap.js`)

to the make.jl after the makedocs call. As a result, the user can still manually switch to the light theme, but will, by default, always land on the dark theme regardless their OS setting. But again, this a hack on really not an elegant solution... Thanks to @RoyWiggins for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Format: HTML Related to the default HTML output help wanted Type: Enhancement
Projects
None yet
Development

No branches or pull requests

4 participants