mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Improve color parsing for 4 characters hex code (#1565)
This commit is contained in:
parent
d070286cde
commit
6f2d75442c
3 changed files with 6 additions and 3 deletions
|
@ -20,7 +20,7 @@ solid fixes, as we are paving the way for the upcoming release of `1.0.0`. Here
|
|||
- Draw shadows on `Raster` images (#1437)
|
||||
- Fix boolean operation edge case (#1506, #1513, #1515).
|
||||
- Remove memory leak on gradient colors (#1499).
|
||||
- Support alpha channel in CSS colors (#1468, #1539).
|
||||
- Support alpha channel in CSS colors (#1468, #1539, #1565).
|
||||
- Improve color CSS string parsing and documentation.
|
||||
- Improve caching of item positions (#1503).
|
||||
- Always draw selected position in global coordinates system (#1545).
|
||||
|
|
|
@ -64,7 +64,7 @@ var Color = Base.extend(new function() {
|
|||
var match = string.match(
|
||||
/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})([\da-f]{2})?$/i
|
||||
) || string.match(
|
||||
/^#([\da-f])([\da-f])([\da-f])$/i
|
||||
/^#([\da-f])([\da-f])([\da-f])([\da-f])?$/i
|
||||
),
|
||||
type = 'rgb',
|
||||
components;
|
||||
|
|
|
@ -69,8 +69,11 @@ test('Creating Colors', function() {
|
|||
equals(new Color('#FF3300'), new Color(1, 0.2, 0),
|
||||
'Color from uppercase hex string');
|
||||
|
||||
equals(new Color('#f009'), new Color(1, 0, 0, .6),
|
||||
'Color from 4 characters hex code with alpha');
|
||||
|
||||
equals(new Color('#ff000099'), new Color(1, 0, 0, .6),
|
||||
'Color from hex code with alpha');
|
||||
'Color from 8 characters hex code with alpha');
|
||||
|
||||
equals(new Color('rgb(255, 0, 0)'), new Color(1, 0, 0),
|
||||
'Color from rgb() string');
|
||||
|
|
Loading…
Reference in a new issue