Colors – Reference Guide

This guide is for versions 1.0.0rc.2+ (Release Candidate)

Source code

Class Colors

    For color-related matters.

    The name-to-rgb mapping was adapted from matplotlib.colors (version 3.6.3)
    
nameargumentsreturns
get_named_colors_mappingdict
        Return the global mapping of color names
        to strings with their RGB coordinates as hex values

        :return:    A dict containing entries such as {'turquoise': '#40E0D0'}
        
nameargumentsreturns
to_rgbcolor_name :str(float, float, float)
        Convert a color, specified by a standard name,
        into RGB coordinates expressed as a triplet of numbers in the (0-1 range)

        :param color_name:
        :return:
        
nameargumentsreturns
lighten_colorcolor_name :str, factor=0.85str
        Lightens a CSS color by blending it with white; i.e., generate a return a lighter, paler tint
        of the given color

        :param color_name:  The CSS color name (e.g., "yellow")
        :param factor:      How much to lighten the color
                                (0.0 = no change,  1.0 = turn all to the way to white)
        :return:            The resulting color in RGB format, as a string.  EXAMPLE:  "rgb(255,255,200)"
        
nameargumentsreturns
assign_default_colorsn :int[int]
        Return a list of n colors, specified by their standard plotly names;
        meant for situations when 1 or more default colors are needed for line plots.

        The choice of default colors is hardwired in this function.

        :param n:   Desired number of default colors
        :return:    A list of n standard (CSS) color names
        
nameargumentsreturns
assign_default_heatmap_colorsn :int[int]
        Return a list of n colors, specified by their standard plotly names;
        meant for situations when 1 or more default colors are needed for a heatmap.

        The choice of default colors is hardwired in this function.

        :param n:   Desired number of default colors
        :return:    A list of n standard (CSS) color names