diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2020-04-29 12:43:06 +1000 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2020-04-29 12:43:06 +1000 |
commit | d017de19f18c154ae03a14c1d9ae76f3a9034c78 (patch) | |
tree | 2483d8365552084286a5100e1da66632f7d8c33f /src | |
parent | a6dae04f796cbcf878a4cfd98acae7c4645c2b7c (diff) | |
download | svg.js-d017de19f18c154ae03a14c1d9ae76f3a9034c78.tar.gz svg.js-d017de19f18c154ae03a14c1d9ae76f3a9034c78.zip |
finish color tests
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/core/regex.js | 2 | ||||
-rw-r--r-- | src/types/Color.js | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/modules/core/regex.js b/src/modules/core/regex.js index b8adb83..c32ac93 100644 --- a/src/modules/core/regex.js +++ b/src/modules/core/regex.js @@ -17,7 +17,7 @@ export const transforms = /\)\s*,?\s*/ export const whitespace = /\s/g // Test hex value -export const isHex = /^#[a-f0-9]{3,6}$/i +export const isHex = /^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i // Test rgb value export const isRgb = /^rgb\(/ diff --git a/src/types/Color.js b/src/types/Color.js index e9bc0ce..eb6368e 100644 --- a/src/types/Color.js +++ b/src/types/Color.js @@ -414,6 +414,10 @@ export default class Color { const color = new Color(grey, grey, grey) return color + } else { + + throw new Error('Unsupported random color mode') + } } |