summaryrefslogtreecommitdiffstats
path: root/src/types
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-26 14:15:55 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-26 14:15:55 +0100
commitd64b964d21e1399b198e44555be68a12378053e7 (patch)
tree460fc3f518d061742083cdd9a5e0c77accc663ee /src/types
parentba63b0157f04d2aa11ff4f2e9ba5bbe3271b9086 (diff)
downloadsvg.js-d64b964d21e1399b198e44555be68a12378053e7.tar.gz
svg.js-d64b964d21e1399b198e44555be68a12378053e7.zip
Fix bug when converting black to cymk space
Diffstat (limited to 'src/types')
-rw-r--r--src/types/Color.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/types/Color.js b/src/types/Color.js
index 3cd7dd0..0004251 100644
--- a/src/types/Color.js
+++ b/src/types/Color.js
@@ -313,6 +313,12 @@ export default class Color {
// Get the cmyk values in an unbounded format
const k = Math.min(1 - r, 1 - g, 1 - b)
+
+ if (k === 1) {
+ // Catch the black case
+ return new Color(0, 0, 0, 1, 'cmyk')
+ }
+
const c = (1 - r - k) / (1 - k)
const m = (1 - g - k) / (1 - k)
const y = (1 - b - k) / (1 - k)