py_utilities.ui.color_utilities — py-utilities 0.0.1 documentation

# Source code for py_utilities.ui.color_utilities

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-

    import random

    def random_hex_color():
        """
        Returns a random hex color
        """
        def decimal_to_hex(dec):
            return "{0:02X}".format(dec)

        return '#{0}{1}{2}'.format(
            decimal_to_hex(random.randint(0, 255)),
            decimal_to_hex(random.randint(0, 255)),
            decimal_to_hex(random.randint(0, 255)),
        )

    # vim: filetype=python