def test_domain_range_scale_HEX_to_RGB(self): """ Tests :func:`colour.notation.triplet.HEX_to_RGB` definition domain and range scale support. """ HEX = '#74070a' RGB = HEX_to_RGB(HEX) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( HEX_to_RGB(HEX), RGB * factor, decimal=2)
def test_n_dimensional_HEX_to_RGB(self): """ Tests :func:`colour.notation.triplet.HEX_to_RGB` definition n-dimensional arrays support. """ HEX = '#74070a' RGB = HEX_to_RGB(HEX) HEX = np.tile(HEX, 6) RGB = np.tile(RGB, (6, 1)) np.testing.assert_almost_equal(HEX_to_RGB(HEX), RGB, decimal=2) HEX = np.reshape(HEX, (2, 3)) RGB = np.reshape(RGB, (2, 3, 3)) np.testing.assert_almost_equal(HEX_to_RGB(HEX), RGB, decimal=2)
def test_HEX_to_RGB(self): """ Tests :func:`colour.notation.triplet.HEX_to_RGB` definition. """ np.testing.assert_almost_equal( HEX_to_RGB('#74070a'), np.array([0.45620519, 0.03081071, 0.04091952]), decimal=2) np.testing.assert_almost_equal( HEX_to_RGB('#000000'), np.array([0.00000000, 0.00000000, 0.00000000]), decimal=2) np.testing.assert_almost_equal( HEX_to_RGB('#ffffff'), np.array([1.00000000, 1.00000000, 1.00000000]), decimal=2)
def test_HEX_to_RGB(self): """ Tests :func:`colour.notation.triplet.HEX_to_RGB` definition. """ np.testing.assert_almost_equal( HEX_to_RGB('#3f990c'), np.array([0.25000000, 0.60000000, 0.05000000]), decimal=2) np.testing.assert_almost_equal( HEX_to_RGB('#000000'), np.array([0.00000000, 0.00000000, 0.00000000]), decimal=2) np.testing.assert_almost_equal( HEX_to_RGB('#ffffff'), np.array([1.00000000, 1.00000000, 1.00000000]), decimal=2)