hajkmap / Hajk

A modern, full-featured OpenLayers based map viewer and editor
MIT License
122 stars 45 forks source link

Using custom colors for text-area in documenthandler breaks dark/light mode #739

Open sweco-seqtob opened 3 years ago

sweco-seqtob commented 3 years ago

Describe the bug It is possible to set the default-color for a text-area (faktaruta) for the tool "Dokumenthanterare 2.0". It is also possbile to override the colors for each document in the editor "Dokumenthanterare 2.0"

When using any of these settings the toggling of dark/light mode is broken, e.g the colors are not changing.

To Reproduce Steps to reproduce the behavior:

Global colors

  1. Go to the tool Dokumenthanterare 2.0 and change colors in the colorpickers for "Faktaruta"
  2. Open the map with the tool activated
  3. Toggle between dark and light mode

Overridden colors

  1. Go to the editor Dokumenthanterare 2.0 and create a "faktaruta" for a section of text
  2. Set custom colors (data-background-color and data-divider-color)
  3. Open the document in client
  4. Toggle between dark and light mode

Expected behavior The colors should switch when toggling between dark and light mode. This is kinda tricky because the administrator can set any color and it is difficult to programatically "find" contrasting colors when toggling dark and light mode.

Might be able to fix this with the function getContrastingColor in MaterialUI but it needs investigation. Currently dark and light mode is only working if no custom colors are set.

Screenshots image image

Desktop (please complete the following information): Any browser

Smartphone (please complete the following information): Any browser and device

Additional context Add any other context about the problem here.

jacobwod commented 3 years ago

As discussed, I think that the most important part was to get the warning text in place. Now we can live with that I guess.