The behaviour was due to the theme used in the browser (Firefox): I was using default theme (and the system theme is dark), so that it was actually using dark theme, even if Gitlab is set to use light theme. Selecting light theme also for the browser, the diagram displays with the correct colors.