Mercurial > gemma
changeset 4692:cad2b264542e
adjust fill color in pdf legend
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 16 Oct 2019 15:40:27 +0200 |
parents | 7a9388943840 |
children | c4adbebaf1a6 |
files | client/src/components/fairway/Fairwayprofile.vue |
diffstat | 1 files changed, 25 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/fairway/Fairwayprofile.vue Wed Oct 16 11:07:59 2019 +0200 +++ b/client/src/components/fairway/Fairwayprofile.vue Wed Oct 16 15:40:27 2019 +0200 @@ -364,19 +364,40 @@ this.pdf.doc.circle(x, y, 2, "FD"); this.pdf.doc.text(x + 3, y + 1, this.$gettext("Water")); + const toRGB = s => { + let [, r, g, b] = s.match(/.*?(\d+), (\d+), (\d+), .*/); + const toHex = n => { + console.log(n); + console.log(parseInt(n)); + let val = parseInt(n).toString(16); + if (val.length === 1) return `0${val}`; + return val; + }; + return `#${toHex(r)}${toHex(g)}${toHex(b)}`; + }; + + const los1Color = toRGB(this.getLayerStyle(1).strokeColor); + const los1Fill = "#ffffff"; + const los2Color = toRGB(this.getLayerStyle(2).strokeColor); + const los2Fill = "#ffffff"; + const los3Color = toRGB(this.getLayerStyle(3).strokeColor); + const los3Fill = "#ffffff"; + this.pdf.doc.setLineDashPattern([0.8], 0); - this.pdf.doc.setDrawColor("#0000ff"); - this.pdf.doc.setFillColor("#fcfacc"); + this.pdf.doc.setDrawColor(los1Color); + this.pdf.doc.setFillColor(los1Fill); this.pdf.doc.circle(x, y + 5, 2, "FD"); this.pdf.doc.text(x + 3, y + 6, this.$gettext("Fairway (LOS 1)")); this.pdf.doc.setLineDashPattern([1.8], 0); - this.pdf.doc.setFillColor("#fdfce5"); + this.pdf.doc.setFillColor(los2Fill); + this.pdf.doc.setDrawColor(los2Color); this.pdf.doc.circle(x, y + 10, 2, "FD"); this.pdf.doc.text(x + 3, y + 11, this.$gettext("Fairway (LOS 2)")); this.pdf.doc.setLineDashPattern([], 0); - this.pdf.doc.setFillColor("#ffffff"); + this.pdf.doc.setFillColor(los3Fill); + this.pdf.doc.setDrawColor(los3Color); this.pdf.doc.circle(x, y + 15, 2, "FD"); this.pdf.doc.text(x + 3, y + 16, this.$gettext("Fairway (LOS 3)"));