Skip to content

Commit

Permalink
fixed Color.fromString() parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoenig committed Jan 22, 2024
1 parent 77cf6fb commit 1ffb82a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ inspired by Squeak
written by Jens Mönig
[email protected]

Copyright (C) 2010-2023 by Jens Mönig
Copyright (C) 2010-2024 by Jens Mönig

Morphic.js is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
Expand Down
8 changes: 4 additions & 4 deletions morphic.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
written by Jens Mönig
[email protected]
Copyright (C) 2010-2023 by Jens Mönig
Copyright (C) 2010-2024 by Jens Mönig
This file is part of Snap!.
Expand Down Expand Up @@ -1306,7 +1306,7 @@

/*jshint esversion: 11, bitwise: false*/

var morphicVersion = '2023-November-07';
var morphicVersion = '2024-January-22';
var modules = {}; // keep track of additional loaded modules
var useBlurredShadows = true;

Expand Down Expand Up @@ -2130,8 +2130,8 @@ Color.prototype.toRGBstring = function () {

Color.fromString = function (aString) {
// I parse rgb/rgba strings into a Color object
var components = aString.split(/[\(),]/).slice(1,5);
return new Color(components[0], components[1], components[2], components[3]);
var channels = aString.split(/[\(),]/).slice(0,4);
return new Color(+channels[0], +channels[1], +channels[2], +channels[3]);
};

// Color copying:
Expand Down

0 comments on commit 1ffb82a

Please sign in to comment.