diff --git a/branca/colormap.py b/branca/colormap.py index 67f24b1..1f84ec9 100644 --- a/branca/colormap.py +++ b/branca/colormap.py @@ -126,15 +126,21 @@ def rgb_bytes_tuple(self, x): def rgb_hex_str(self, x): """Provides the color corresponding to value `x` in the - form of a string of hewadecimal values "#RRGGBB". + form of a string of hexadecimal values "#RRGGBB". """ return '#%02x%02x%02x' % self.rgb_bytes_tuple(x) + def rgba_hex_str(self, x): + """Provides the color corresponding to value `x` in the + form of a string of hexadecimal values "#RRGGBBAA". + """ + return '#%02x%02x%02x%02x' % self.rgba_bytes_tuple(x) + def __call__(self, x): """Provides the color corresponding to value `x` in the - form of a string of hewadecimal values "#RRGGBB". + form of a string of hexadecimal values "#RRGGBBAA". """ - return self.rgb_hex_str(x) + return self.rgba_hex_str(x) def _repr_html_(self): return ( @@ -143,8 +149,10 @@ def _repr_html_(self): [('').format( i=i*1, - color=self.rgb_hex_str(self.vmin + - (self.vmax-self.vmin)*i/499.)) + color=self.rgba_hex_str( + self.vmin + + (self.vmax-self.vmin)*i/499.) + ) for i in range(500)]) + '{}'.format(self.vmin) + '{}'.format(