openstreetmap / iD

🆔 The easy-to-use OpenStreetMap editor in JavaScript.
https://www.openstreetmap.org/edit?editor=id
ISC License
3.38k stars 1.21k forks source link

Update highway colors to match openstreetmap-carto #2764

Closed bhousel closed 9 years ago

bhousel commented 9 years ago

RE: gravitystorm/openstreetmap-carto#1736 Discussion seems pretty much settled.

Although the goals of iD and openstreetmap-carto are different, I think we should update our highway styling to match what they are doing. Blue and green roads can be difficult to see on different backgrounds, and it would be weird for users of iD to see a drastically different road coloring than what is displayed on the main osm site.

That said, I think iD should retain some kind of color for highway=tertiary to make things less confusing for editing, so I'm planning to just pick something between the yellow highway=secondary and white highway=residential colors.

ghost commented 9 years ago

+1

Stalfur commented 9 years ago

Thanks @bhousel - some sort of clearer marking of tertiary in iD will help.

pnorman commented 9 years ago

You may want to use https://github.com/matkoniecz/openstreetmap-carto/blob/gsoc/scripts/generate_road_colours.py

It allows you to distribute a set of road colours across a range of hues by classification, and compute both fill colours and casing colours.

Even if you end up using different colours, being able to distribute them is very useful, and saves a lot of experimentation.

To customize it, you might want to change road_classes, line_colour_infos["fill"], and line_colour_infos["casing"]

matkoniecz commented 9 years ago

Note, https://github.com/gravitystorm/openstreetmap-carto/pull/1736 was merged and it will be included in the next release (nearest one, v.2.35 was released before this merge).

You may want to use https://github.com/matkoniecz/openstreetmap-carto/blob/gsoc/scripts/generate_road_colours.py

This script after merge resides at https://github.com/gravitystorm/openstreetmap-carto/blob/master/scripts/generate_road_colours.py

Even if you end up using different colours, being able to distribute them is very useful, and saves a lot of experimentation.

Yes, one of my biggest mistakes during developing road colours was not starting from writing this script.

bhousel commented 9 years ago

Even if you end up using different colours, being able to distribute them is very useful, and saves a lot of experimentation.

Yes, one of my biggest mistakes during developing road colours was not starting from writing this script.

@matkoniecz, @pnorman Can you elaborate? I'm not clear on what it means to "distribute" colors.

matkoniecz commented 9 years ago

Instead of manually selecting colour for every road type (motorway, trunk, primary, secondary in current script configuration) using this script it is possible to set hue, chroma and lightness range.

In script

road_classes = ["motorway", "trunk", "primary", "secondary"]

sets list of roads over which colours will be distributed

and for example

min_h = 10 max_h = 106

sets hue range (each road always have the same hue, chroma and lightness is different for fill, casing etc)

For example to generate fill, with lightness ranging from 70 to 97 and chroma from 35 to 29:

line_colour_infos["fill"] = ColourInfo(start_l = 70, end_l = 97, start_c = 35, end_c = 29)

In that case motorway will be lch(70, 35, 10) and secondary lch(97,29,106), with trunk and primary in the middle. Script also converts from lch to rgb. In that case it outputs.

@motorway-fill: #e892a2; // Lch(70,35,10), error 0.5 @trunk-fill: #f9b29c; // Lch(79,33,42), error 0.7 @primary-fill: #fcd6a4; // Lch(88,31,74), error 1.7 @secondary-fill: #f7fabf; // Lch(97,29,106), error 1.7

So "try everything more saturated" means changing start_c and end_c values, rather than manually tweaking four separate colours trying to keep them equally separated without changing lightness and hue (what is nearly impossible to do in RGB space and taking a long time with manually tweaking lch and converting each new value separately).

I attempted to rewrite script to move setting data to top and it may be slightly more readable: https://github.com/matkoniecz/openstreetmap-carto/blob/clean/scripts/generate_road_colours.py (I am not happy about it and shield generation is still at the bottom with a special case of tertiary).

It seems that this script may be improved by properly separating setting wanted values and processing them. Also, probably some readme should be added at beginning.

matkoniecz commented 9 years ago

https://github.com/matkoniecz/openstreetmap-carto/blob/clean/scripts/generate_road_colours.py now has separation of setting data and processing it what hopefully should make more clear what is happening.

bhousel commented 9 years ago

@matkoniecz, @pnorman That sounds so complicated!

Because iD uses SVG for everything, I just adjust styles live in Chrome developer tools:

id live styles

gravitystorm commented 9 years ago

FYI, I've just tagged the release of openstreetmap-carto that contains these new colours, so I expect it to be rolled out on the OSMF servers at some point soon.

https://github.com/gravitystorm/openstreetmap-carto/releases/tag/v2.36.0 is the release version (2.36.0) https://github.com/openstreetmap/chef/issues/38 is the ticket for the OSMF server rollout.

bhousel commented 9 years ago

FYI, I've just tagged the release of openstreetmap-carto that contains these new colours, so I expect it to be rolled out on the OSMF servers at some point soon.

Awesome! I'm finishing up styling our preset icons to match the new colors, and will tag an iD release within the next few days..