aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/Utils.ts')
-rw-r--r--src/Utils.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Utils.ts b/src/Utils.ts
index 9a2f01f80..6889936b8 100644
--- a/src/Utils.ts
+++ b/src/Utils.ts
@@ -62,14 +62,14 @@ export namespace Utils {
}
export function fromRGBAstr(rgba: string) {
- let rm = rgba.match(/rgb[a]?\(([0-9]+)/);
+ let rm = rgba.match(/rgb[a]?\(([ 0-9]+)/);
let r = rm ? Number(rm[1]) : 0;
- let gm = rgba.match(/rgb[a]?\([0-9]+,([0-9]+)/);
+ let gm = rgba.match(/rgb[a]?\([ 0-9]+,([ 0-9]+)/);
let g = gm ? Number(gm[1]) : 0;
- let bm = rgba.match(/rgb[a]?\([0-9]+,[0-9]+,([0-9]+)/);
+ let bm = rgba.match(/rgb[a]?\([ 0-9]+,[ 0-9]+,([ 0-9]+)/);
let b = bm ? Number(bm[1]) : 0;
- let am = rgba.match(/rgba?\([0-9]+,[0-9]+,[0-9]+,([0-9]+)/);
- let a = am ? Number(am[1]) : 0;
+ let am = rgba.match(/rgba?\([ 0-9]+,[ 0-9]+,[ 0-9]+,([ .0-9]+)/);
+ let a = am ? Number(am[1]) : 1;
return { r: r, g: g, b: b, a: a };
}