# HG changeset patch # User Thomas Junk # Date 1571233227 -7200 # Node ID cad2b264542e51ea211afdb137597fadc8b65a07 # Parent 7a93889438409e9678954a680f9c50f310725d34 adjust fill color in pdf legend diff -r 7a9388943840 -r cad2b264542e client/src/components/fairway/Fairwayprofile.vue --- 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)"));