summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2020-04-29 12:43:06 +1000
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2020-04-29 12:43:06 +1000
commitd017de19f18c154ae03a14c1d9ae76f3a9034c78 (patch)
tree2483d8365552084286a5100e1da66632f7d8c33f /src
parenta6dae04f796cbcf878a4cfd98acae7c4645c2b7c (diff)
downloadsvg.js-d017de19f18c154ae03a14c1d9ae76f3a9034c78.tar.gz
svg.js-d017de19f18c154ae03a14c1d9ae76f3a9034c78.zip
finish color tests
Diffstat (limited to 'src')
-rw-r--r--src/modules/core/regex.js2
-rw-r--r--src/types/Color.js4
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')
+
}
}