Remove the leading `#` in the color command

Starting with PHP 7.4 passing invalid characters to `hexdec` generates a deprecation notice.
This commit is contained in:
Maximilian Mader 2020-11-01 18:26:16 +01:00
parent ae637128c3
commit 4544813255
Signed by: Max
GPG Key ID: F71D56A3151C4FB3
1 changed files with 4 additions and 1 deletions

View File

@ -18,7 +18,10 @@ define(['../Command', '../Parser'], function (Command, Parser) {
getParameterParser() {
// Either match a color in hexadecimal RGB notation or a color name (just letters)
const color = Parser.F.try(
Parser.RGBHex.map((color) => ({ type: 'hex', value: color }))
Parser.RGBHex.map((color) => ({
type: 'hex',
value: color.replace(/^#/, ''),
}))
).or(new Parser.X().word().map((word) => ({ type: 'word', value: word })))
// Either match a single color or two colors separated by a space