diff --git a/openslides/core/static/js/core/pdf.js b/openslides/core/static/js/core/pdf.js index 836b4722b..2c10ad50d 100644 --- a/openslides/core/static/js/core/pdf.js +++ b/openslides/core/static/js/core/pdf.js @@ -492,10 +492,12 @@ angular.module('OpenSlidesApp.core.pdf', []) // e.g. #fff or #ff0048 var rgbRegex = new RegExp('^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$'); // e.g. rgb(0,255,34) or rgb(22, 0, 0) + var nameRegex = new RegExp('^[a-z]+$'); + // matches just text like 'red', 'black', 'green' if (hexRegex.test(color)) { return color; - } else if(rgbRegex.test(color)) { + } else if (rgbRegex.test(color)) { var decimalColors = rgbRegex.exec(color).slice(1); for (var i = 0; i < 3; i++) { var decimalValue = parseInt(decimalColors[i]); @@ -507,6 +509,8 @@ angular.module('OpenSlidesApp.core.pdf', []) decimalColors[i] = hexString; } return '#' + decimalColors.join(''); + } else if (nameRegex.test(color)) { + return color; } else { console.error('Could not parse color "' + color + '"'); return color;