Steps to replicate the issue (include links if applicable):
- At the English Wikivoyage: Look for a listing template, for instance in the Aalst article in the Understand section. Edit it without saving by adding the parameter | type = gold to this template and preview it. A gold background occurs but the text writing is white (and not black).
- At the German Wikivoyage: Take an article with a religious institution, for instance the article of Wettin to the "Kirchen" (churches) section. The marker backgrounds are orange and the text color is black by a user Lua script. With the browser's inspector click on such a marker. Go to the a.mw-kartographer-maplink tag and unmark the rule: .mw-parser-output .listing-map-inverse .mw-kartographer-maplink: color: #000 !important; The the text color will become white instead of black.
- The magenta pushpin marker as created and stored by the Wikimedia's map server is maybe wrong. The text color should be black, not white, see for instance: https://de.wikivoyage.org/wiki/Modul:Marker_utilities/Groups/Doku#Group_overview.
What happens?:
- In any case, the text color of Wikivoyage markers is white. This is done by CSS rules setting the link text color to white.
What should have happened instead?:
- Depending on the background color, the text color should be black or white like the text color of the pushpin markers on the maps. The color should not be changed by mouse hover actions.
Other information (browser name/version, screenshots, etc.):
Proposed solution
- Add not only the background color, but also the text color to a.mw-kartographer-autostyled (see MapLinkAttributeGenerator.php, lines 52-55)
- You have to calculate the relative luminance of the background color, see for instance Makizushi’s code for markers. Above a definite threshold the text color should be black.
What's the definite threshold?
- A good question, because it is handled in the Kartographer script and on the Wikimedia's map server in different ways. Makizushi and adamwight proposed a value of about 0.211 . But on the map server at which the map-marker icons are created and stored there seems to be a higher threshold.
- See for instance on https://de.wikivoyage.org/wiki/Modul:Marker_utilities/Groups. The first icon on the map is a magenta icon (#FF00FF). Due to Makizushi et al the text color should be black but it is white. That's why I was setting the Wikivoyage's threshold to 0.2848 (relative luminance of magenta) so the text color keeps to be white.

