def _hex_to_rgba(hexs):
 hexs = np.atleast_1d(np.array(hexs, '|U9'))
 out = np.ones((len(hexs), 4), np.float32)
 for (hi, h) in enumerate(hexs):
  assert isinstance(h, string_types)
  off = (1 if (h[0] == '#') else 0)
  assert (len(h) in ((6 + off), (8 + off)))
  e = ((len(h) - off) // 2)
  out[hi, :e] = [(int(h[i:(i + 2)], 16) / 255.0) for i in range(off, len(h), 2)]
 return out

def _hex_to_rgba ( hexs ) : hexs = np . atleast_1d ( np . array ( hexs , '|U9' ) ) out = np . ones ( ( len ( hexs ) , 4 ) , np . float32 ) for ( hi , h ) in enumerate ( hexs ) : assert isinstance ( h , string_types ) off = ( 1 if ( h [ 0 ] == '#' ) else 0 ) assert ( len ( h ) in ( ( 6 + off ) , ( 8 + off ) ) ) e = ( ( len ( h ) - off ) // 2 ) out [ hi , : e ] = [ ( int ( h [ i : ( i + 2 ) ] , 16 ) / 255.0 ) for i in range ( off , len ( h ) , 2 ) ] return out
convert hex to rgba .