File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,14 +53,14 @@ var colorMap = {};
5353var pointColors = { } ;
5454var pointSizes = { } ;
5555
56-
57- function hexToRGB ( hex , a ) {
58- // Converts a HEX value to an array of RGBA values
59- var a = a || 1.0 ;
60- var r = parseInt ( hex . slice ( 1 , 3 ) , 16 ) / 256 .0,
61- g = parseInt ( hex . slice ( 3 , 5 ) , 16 ) / 256 .0,
62- b = parseInt ( hex . slice ( 5 , 7 ) , 16 ) / 256.0 ;
63- return [ r , g , b , a ] ;
56+ function hexToRGB ( hex , alpha ) {
57+ var result = / ^ # ? ( [ a - f \d ] { 2 } ) ( [ a - f \d ] { 2 } ) ( [ a - f \d ] { 2 } ) $ / i . exec ( hex ) ;
58+ return result ? [
59+ parseInt ( result [ 1 ] , 16 ) / 255.0 ,
60+ parseInt ( result [ 2 ] , 16 ) / 255 .0,
61+ parseInt ( result [ 3 ] , 16 ) / 255 .0,
62+ alpha
63+ ] : [ 0 , 0 , 0 , alpha ] ;
6464}
6565
6666function strChunk ( str , size ) {
@@ -193,11 +193,8 @@ function constructColorScheme() {
193193 i = i % scheme . length ;
194194 var color = hexToRGB ( scheme [ i ] , 1.0 ) ;
195195 colorMap [ u ] = color ;
196- post ( color , '\n' )
197196 } ) ;
198197 mgraphics . redraw ( ) ;
199-
200-
201198 }
202199}
203200
You can’t perform that action at this time.
0 commit comments