Merge pull request #3256 from FinnStutzenstein/Issue3243
extending the color parser (fixes #3243)
This commit is contained in:
commit
3b2c7634f0
@ -492,6 +492,8 @@ angular.module('OpenSlidesApp.core.pdf', [])
|
|||||||
// e.g. #fff or #ff0048
|
// e.g. #fff or #ff0048
|
||||||
var rgbRegex = new RegExp('^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$');
|
var rgbRegex = new RegExp('^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$');
|
||||||
// e.g. rgb(0,255,34) or rgb(22, 0, 0)
|
// 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)) {
|
if (hexRegex.test(color)) {
|
||||||
return color;
|
return color;
|
||||||
@ -507,6 +509,8 @@ angular.module('OpenSlidesApp.core.pdf', [])
|
|||||||
decimalColors[i] = hexString;
|
decimalColors[i] = hexString;
|
||||||
}
|
}
|
||||||
return '#' + decimalColors.join('');
|
return '#' + decimalColors.join('');
|
||||||
|
} else if (nameRegex.test(color)) {
|
||||||
|
return color;
|
||||||
} else {
|
} else {
|
||||||
console.error('Could not parse color "' + color + '"');
|
console.error('Could not parse color "' + color + '"');
|
||||||
return color;
|
return color;
|
||||||
|
Loading…
Reference in New Issue
Block a user