コード例 #1
0
ファイル: utils.py プロジェクト: AVert/taiga-ncurses
def color_to_hex(color):
    """
    Given either an hexadecimal or HTML color name, return a the hex
    approximation without the `#`.
    """
    if color.startswith("#"):
        return x256.from_hex(color.strip("#"))
    else:
        return x256.from_html_name(color)
コード例 #2
0
def color_to_hex(color):
    """
    Given either an hexadecimal or HTML color name, return a the hex
    approximation without the `#`.
    """
    if color.startswith("#"):
        return x256.from_hex(color.strip("#"))
    else:
        return x256.from_html_name(color)
コード例 #3
0
ファイル: test_x256.py プロジェクト: jespino/python-x256
 def test_from_html_name(self):
     color = x256.from_html_name(self.html_name_red)
     self.assertEqual(self.red_color, color)
     color = x256.from_html_name(self.html_name_blue)
     self.assertEqual(self.blue_color, color)