Skip to content

Add dark mode support. - #1521

Open
drgrice1 wants to merge 1 commit into
openwebwork:developfrom
drgrice1:dark-mode
Open

Add dark mode support.#1521
drgrice1 wants to merge 1 commit into
openwebwork:developfrom
drgrice1:dark-mode

Conversation

@drgrice1

Copy link
Copy Markdown
Member

This uses the data-bs-theme attribute the same as webwork2 does. Since PG also uses bootstrap components this is necessary to get those to honor dark mode without a lot of effort.

Drag and drop "buckets" are forced to light mode so that the colors it currently use don't cause contrast issues.

The graphtool is also forced to light mode, rather than heftily reworking it, and because JSXGraph doesn't really support dark mode. The same is true of JSXGraph images for the plots.pl macro.

"Knowl" dialogs are forced into light mode, because help files are not updated to work well in dark mode.

Images always have a white background so that if the image has a transparent background it will not have contrast issues.

MathQuill needs a couple of small changes so that it works well in dark mode. The cursor color needs to use the currentcolor and the background color of empty blocks needs to be color scheme responsive. That is in a pull request to the https://github.com/openwebwork/mathquill repository. Note that it is not published, so you will need to use the npm link approach to test with webwork2.

There may be further modifications needed, but all problems I have tested are working fine.

Note that one thing this cannot account for is colors that problem authors use. One thing that authors can do is use the CSS light-dark function instead of a single color. That will work for recent versions of all browsers.

This uses the `data-bs-theme` attribute the same as webwork2 does. Since
PG also uses bootstrap components this is necessary to get those to
honor dark mode without a lot of effort.

Drag and drop "buckets" are forced to light mode so that the colors it
currently use don't cause contrast issues.

The graphtool is also forced to light mode, rather than heftily
reworking it, and because JSXGraph doesn't really support dark mode.
The same is true of JSXGraph images for the `plots.pl` macro.

"Knowl" dialogs are forced into light mode, because help files are not
updated to work well in dark mode.

Images always have a white background so that if the image has a
transparent background it will not have contrast issues.

MathQuill needs a couple of small changes so that it works well in dark
mode.  The cursor color needs to use the `currentcolor` and the
background color of empty blocks needs to be color scheme responsive.
That is in a pull request to the https://github.com/openwebwork/mathquill
repository. Note that it is not published, so you will need to use the
`npm link` approach to test with webwork2.

There may be further modifications needed, but all problems I have
tested are working fine.

Note that one thing this cannot account for is colors that problem
authors use. One thing that authors can do is use the CSS `light-dark`
function instead of a single color. That will work for recent versions
of all browsers.
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

Successfully merging this pull request may close these issues.

1 participant