openproblems-bio / website

Website hosted at https://openproblems.bio
Creative Commons Attribution 4.0 International
3 stars 7 forks source link

funkyheatmap dark mode #176

Open scottgigante-immunai opened 1 year ago

scottgigante-immunai commented 1 year ago
          Can we discuss how you want the funkyheatmap to look with the night theme? I can adapt different elements and use css variables for styles

Originally posted by @mxposed in https://github.com/openproblems-bio/website/issues/172#issuecomment-1464268001

Rather than hacking the css, we can design the funkyheatmap to be responsive to colour variables.

Here's my two cents:

This could be achieved with --bs-white for header text, --bs-body-color for other text, --bs-body-bg for row background, --bs-button-hover for alternate rows background.

cc @rcannood @KaiWaldrant

KaiWaldrant commented 1 year ago

that seems about right to me

mxposed commented 1 year ago

For the colour schemes, I think @rcannood had a plan to have 2 funkyheatmap cells with light and dark palettes and then to switch them via https://github.com/openproblems-bio/website/pull/200

scottgigante-immunai commented 1 year ago

Seems ugly... is there no better way to define the endpoints of your colour scheme in js?

mxposed commented 1 year ago

It does, but the other way would be to make funkyheatmap aware of the light/dark mode, which is ugly too (because it's a separate component, and you can't just pass a style to alter the palette), or at least I haven't thought of a good way yet.

Any ideas are welcome

scottgigante-immunai commented 1 year ago

How do you create the component with a different palette in js?

rcannood commented 1 year ago

Right now the palettes are decided on in r. To fix this, we need to either define two palettes in R and pass them both to JS, or move the code that decides the palette in JS.

Happy to discuss when I'm back from holidays next week.

scottgigante-immunai commented 1 year ago

I don't know how funkyheatmapJS interacts with the R code, but this seems eminently solvable with css.

mxposed commented 1 year ago

I learn more and more about css : )

If the filter trick does the job and looks ok, then let's just use that and call it a day?

I wouldn't like moving palettes to css entirely, but I can add the css variable that determines palette position, and then we can add css to convert that to color.

scottgigante-immunai commented 1 year ago

If we use css filter, we should add a css class on all of the circles / rects so I can select them more easily (.quarto-figure svg g:first-child ~ g text ~ rect, .quarto-figure svg g:first-child ~ g text ~ circle is ugly). Beyond that, the demo I show above I think does a reasonable job. Open to input from others.

mxposed commented 1 year ago

I'll add this to your branch, but also waiting for input from others