Modify

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#10014 closed defect (fixed)

[Patch] Add support for canvas{fill-color}, deprecate canvas{background-color}

Reported by: simon04 Owned by: team
Priority: normal Milestone: 14.05
Component: Core mappaint Version:
Keywords: mapcss Cc: bastiK, skunk@…

Description

According to https://wiki.osm.org/wiki/MapCSS/0.2#Canvas_properties, the "official" tag for setting the background color using MapCSS is

canvas{
  fill-color: #abcdef;
}

instead of

canvas{
  background-color: #abcdef;
}

Therefore, I suggest to support the standard and deprecate the current implementation.

  • src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java

    diff --git a/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java b/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
    index 0855a69..1e30485 100644
    a b public class MapCSSStyleSource extends StyleSource {  
    202202
    203203    private void loadCanvas() {
    204204        Cascade c = constructSpecial("canvas");
    205         backgroundColorOverride = c.get("background-color", null, Color.class);
     205        backgroundColorOverride = c.get("fill-color", null, Color.class);
     206        if (backgroundColorOverride == null) {
     207            backgroundColorOverride = c.get("background-color", null, Color.class);
     208            if (backgroundColorOverride != null) {
     209                Main.warn("Detected deprecated canvas{background-color} which will be removed shortly.");
     210            }
     211        }
    206212    }
    207213
    208214    private Cascade constructSpecial(String type) {

Attachments (0)

Change History (4)

comment:1 by bastiK, 10 years ago

Good idea!

comment:2 by simon04, 10 years ago

Resolution: fixed
Status: newclosed

In 7110/josm:

fix #10014 - MapCSS: Add support for canvas{fill-color}, deprecate canvas{background-color}

comment:3 by Don-vip, 10 years ago

In 7127/josm:

see #10014 - use fill-color instead of background-color in P2 mapcss style

comment:4 by anonymous, 10 years ago

The background colour of power=pole icons (in the Potlatch2 style) has disappeared! :-(

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.