Skip to content

Commit

Permalink
Fixed color style in pdf print (geosolutions-it#2792)
Browse files Browse the repository at this point in the history
* Fixed color style in pdf print

* Tinycolor version
  • Loading branch information
kappu72 authored and kappu committed Apr 26, 2018
1 parent 721fcc9 commit 468335b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@
"leaflet-extra-markers": "1.0.6",
"leaflet-minimap": "3.6.0",
"leaflet-plugins": "3.0.2",
"leaflet.gridlayer.googlemutant": "0.6.4",
"leaflet-simple-graticule": "1.0.2",
"leaflet.gridlayer.googlemutant": "0.6.4",
"leaflet.locatecontrol": "0.62.0",
"leaflet.nontiledlayer": "1.0.7",
"lodash": "4.16.6",
Expand Down
2 changes: 2 additions & 0 deletions web/client/utils/ColorUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
const tinycolor = require("tinycolor2");
const {toNumber} = require("lodash");

/**
* Porting of various MapStore(1) utilities for random/color scale generations
* @name ColorUtils
Expand Down Expand Up @@ -157,6 +158,7 @@ const ColorUtils = {
return ColorUtils.rgbToHsv(rgb);
}
},
colorToHexStr: (color = 'red') => tinycolor(color).toHexString(),
/**
* convert any valid css color to rgba str
* @param {string} color any valid css color
Expand Down
6 changes: 3 additions & 3 deletions web/client/utils/PrintUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

const CoordinatesUtils = require('./CoordinatesUtils');
const MapUtils = require('./MapUtils');

const {colorToHexStr} = require("./ColorUtils");

const {isArray} = require('lodash');

Expand Down Expand Up @@ -339,14 +339,14 @@ const PrintUtils = {
}
// commented the available options.
return {
"fillColor": PrintUtils.rgbaTorgb(style.fillColor),
"fillColor": colorToHexStr(style.fillColor),
"fillOpacity": style.fillOpacity,
// "rotation": "30",
"externalGraphic": style.iconUrl,
// "graphicName": "circle",
// "graphicOpacity": 0.4,
"pointRadius": style.radius,
"strokeColor": PrintUtils.rgbaTorgb(style.fillColor),
"strokeColor": colorToHexStr(style.fillColor),
"strokeOpacity": style.opacity,
"strokeWidth": style.weight
// "strokeLinecap": "round",
Expand Down

0 comments on commit 468335b

Please sign in to comment.