Python matplotlib.colors.get_named_colors_mapping() Examples

The following are 4 code examples of matplotlib.colors.get_named_colors_mapping(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module matplotlib.colors , or try the search function .
Example #1
Source File: tools.py    From python-esppy with Apache License 2.0 6 votes vote down vote up
def getColor(self,name):
        if name.find("#") == 0:
            return(name)

        colors = mcolors.get_named_colors_mapping()

        color = None

        if name in colors:
            color = colors[name]
        elif name == "lightest":
            color = self.lightest
        elif name == "darkest":
            color = self.darkest

        return(color) 
Example #2
Source File: tools.py    From python-esppy with Apache License 2.0 5 votes vote down vote up
def getColorFromName(name):
        if name.find("#") == 0:
            return(name)

        colors = mcolors.get_named_colors_mapping()

        color = None

        if name in colors:
            color = colors[name]

        return(color) 
Example #3
Source File: test_colors.py    From typhon with MIT License 5 votes vote down vote up
def test_named_color_mapping(self):
        """Test if the typhon colors are available in the name mapping."""
        assert all([c in mcolors.get_named_colors_mapping()
                   for c in colors.TYPHON_COLORS.keys()]) 
Example #4
Source File: test_colors.py    From typhon with MIT License 5 votes vote down vote up
def test_named_color_hex(self):
        """Test if the 'ty:uhh-red' hex-value is correct."""
        assert mcolors.get_named_colors_mapping()['ty:uhh-red'] == '#ee1d23'