-
Notifications
You must be signed in to change notification settings - Fork 822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dark theme variant #4412
Comments
I think this is out of scope for this style - we try to produce one cartographic design, not a set of several, that would spread our resources too thin and we would end up producing several mediocre designs rather than a single decent one. What we try to do is making this style easily adaptable, there is room for improvement in that field w.r.t. colors - we still have plenty of colors inline in the code somewhere that could be organized more systematically for easy adjustment. |
Ref for a nice filter hack: openstreetmap/openstreetmap-website#2332 (comment) |
I didn't propose several alternative styles, just a dark addition to the existing bright one. This could perhaps done algorithmically by generating the colors by subtracting lightness from the base bright color and adding lightness to the base dark color. Something like: from enum import Enum
BASE_LIGHT_LIGHTNESS = 100
BASE_DARK_LIGHTNESS = 0
class ColorVariant(Enum):
LIGHT = 1
DARK = 2
def generate_color(hue: int, saturation: int, color_variant: ColorVariant) -> (int, int, int):
"""Generate a color.
Generate a color in HSL format given a hue, saturation and color variant.
Args:
hue -- The hue for the color to generate.
saturation: The saturation for the color to generate.
color_variant: The variant of the color to generate.
Returns:
A triplet representing a color in HSL format.
Raises:
ValueError -- On invalid color variant.
Example:
>>> generate_color(220, 50, ColorVariant.LIGHT)
(220, 50, 90)
>>> generate_color(220, 50, ColorVariant.DARK)
(220, 50, 10)
"""
if not 0 <= saturation <= 100:
raise ValueError("Saturation must be a value between 0 and 100")
lightness = 0
if color_variant is ColorVariant.LIGHT:
lightness = BASE_LIGHT_LIGHTNESS
lightness -= 10
elif color_variant is ColorVariant.DARK:
lightness = BASE_DARK_LIGHTNESS
lightness += 10
else:
raise ValueError("Unknown color variant")
return (hue, saturation, lightness) |
Are you interested in actually making and deploying such map style? In such case feel free to file issues about things that would make it easier. But what is attempted here is complicated enough without adding expectations that colour-swapped map style would be ALSO usable. |
I would hope to see it depoyed on the official OpenStreetMap tile server with a
I think that an algorithm (such as the one I provided above in my previous post) could be used to generate both light and dark themes. The color hue is inputted to the algorithm which then outputs a color with lightness (and possibly saturation) adjusted depending on the theme variant. |
Closing as we agree this is out of scope for this project. If you want to develop a fork/add-on for this style that changes the color palette used to something with dark area fills and brighter lines/symbols - using either some algorithm or manually - and need some changes in this style to facilitate this being technically easier such suggestions are welcome. Also relevant in that context would be http://blog.imagico.de/managing-patterns/ |
Create a dark theme variant. This could be useful when using a device in dark mode or at evening/night time.
The text was updated successfully, but these errors were encountered: