|
Methods defined here:
- check_get_8bits_color(*args) -> int
- This function performs checks for get_8bits_color
arguments and call it.
>>> Colors.check_get_8bits_color(7, 7, 3)
255
>>> Colors.check_get_8bits_color(255, -1, "invalid")
Traceback (most recent call last):
...
ValueError: Colors.get_8bits_color the first two arguments should be int between 0 and 7 and the third should be int between 0 and 4 (255 is invalid).
>>> Colors.check_get_8bits_color(6, -1, "invalid")
Traceback (most recent call last):
...
ValueError: Colors.get_8bits_color the first two arguments should be int between 0 and 7 and the third should be int between 0 and 4 (-1 is invalid).
>>> Colors.check_get_8bits_color(6, 0, "invalid")
Traceback (most recent call last):
...
ValueError: Colors.get_8bits_color the first two arguments should be int between 0 and 7 and the third should be int between 0 and 4 ('invalid' is invalid).
>>>
- check_html_to_int(color: str) -> Tuple[int, int, int]
- This function performs checks for html_to_int
arguments and call it.
>>> Colors.check_html_to_int('#FF0096')
(255, 0, 150)
>>> Colors.check_html_to_int(7)
Traceback (most recent call last):
...
ValueError: Color should be a hexadecimal string of length 7 starting with '#' (7 is invalid).
>>> Colors.check_html_to_int('')
Traceback (most recent call last):
...
ValueError: Color should be a hexadecimal string of length 7 starting with '#' ('' is invalid).
>>> Colors.check_html_to_int('!FF0096')
Traceback (most recent call last):
...
ValueError: Color should be a hexadecimal string of length 7 starting with '#' ('!FF0096' is invalid).
>>> Colors.check_html_to_int('#ZF0096')
Traceback (most recent call last):
...
ValueError: Color should be a hexadecimal string of length 7 starting with '#' ('#ZF0096' is invalid).
>>>
- check_int_to_html(*args) -> str
- This function performs checks for int_to_html
arguments and call it.
>>> Colors.check_int_to_html(255, 0, 150)
'#ff0096'
>>> Colors.check_int_to_html(256, -1, "invalid")
Traceback (most recent call last):
...
ValueError: Colors.int_to_html arguments should be int between 0 and 255 (256 is invalid).
>>> Colors.check_int_to_html(255, -1, "invalid")
Traceback (most recent call last):
...
ValueError: Colors.int_to_html arguments should be int between 0 and 255 (-1 is invalid).
>>> Colors.check_int_to_html(255, 0, "invalid")
Traceback (most recent call last):
...
ValueError: Colors.int_to_html arguments should be int between 0 and 255 ('invalid' is invalid).
>>>
- check_int_to_rgb(*args) -> str
- This function performs checks for int_to_rgb
arguments and call it.
>>> Colors.check_int_to_rgb(255, 0, 150)
'rgb(255, 0, 150)'
>>> Colors.check_int_to_rgb(256, -1, "invalid")
Traceback (most recent call last):
...
ValueError: Colors.int_to_rgb arguments should be int between 0 and 255 (256 is invalid).
>>> Colors.check_int_to_rgb(255, -1, "invalid")
Traceback (most recent call last):
...
ValueError: Colors.int_to_rgb arguments should be int between 0 and 255 (-1 is invalid).
>>> Colors.check_int_to_rgb(255, 0, "invalid")
Traceback (most recent call last):
...
ValueError: Colors.int_to_rgb arguments should be int between 0 and 255 ('invalid' is invalid).
>>>
- check_int_to_rgba(*args) -> str
- This function performs checks for int_to_rgba
arguments and call it.
>>> Colors.check_int_to_rgba(255, 0, 150, 0.5)
'rgba(255, 0, 150, 0.5)'
>>> Colors.check_int_to_rgba(256, -1, "invalid")
Traceback (most recent call last):
...
ValueError: Colors.int_to_rgba arguments should be int between 0 and 255 (256 is invalid).
>>> Colors.check_int_to_rgba(255, -1, "invalid")
Traceback (most recent call last):
...
ValueError: Colors.int_to_rgba arguments should be int between 0 and 255 (-1 is invalid).
>>> Colors.check_int_to_rgba(255, 0, "invalid")
Traceback (most recent call last):
...
ValueError: Colors.int_to_rgba arguments should be int between 0 and 255 ('invalid' is invalid).
>>>
- check_rgb_to_int(color: str) -> Tuple[int, int, int]
- This function performs checks for rgb_to_int
arguments and call it.
>>> Colors.check_rgb_to_int('rgb(255, 0, 150)')
(255, 0, 150)
>>> Colors.check_rgb_to_int('rgb ( 255 , 0 , 150 ) ')
(255, 0, 150)
>>> Colors.check_rgb_to_int(7)
Traceback (most recent call last):
...
ValueError: Color should be a string of 'rbg' call with three byte values separated by commas (example: 'rgb(255, 0, 2)') (7 is invalid).
>>> Colors.check_rgb_to_int('')
Traceback (most recent call last):
...
ValueError: Color should be a string of 'rbg' call with three byte values separated by commas (example: 'rgb(255, 0, 2)') ('' is invalid).
>>> Colors.check_rgb_to_int('rgb')
Traceback (most recent call last):
...
ValueError: Color should be a string of 'rbg' call with three byte values separated by commas (example: 'rgb(255, 0, 2)') ('rgb' is invalid).
>>> Colors.check_rgb_to_int('rgb(')
Traceback (most recent call last):
...
ValueError: Color should be a string of 'rbg' call with three byte values separated by commas (example: 'rgb(255, 0, 2)') ('rgb(' is invalid).
>>> Colors.check_rgb_to_int('rgb()')
Traceback (most recent call last):
...
ValueError: Color should be a string of 'rbg' call with three byte values separated by commas (example: 'rgb(255, 0, 2)') ('rgb()' is invalid).
>>> Colors.check_rgb_to_int('rgb(,,)')
Traceback (most recent call last):
...
ValueError: Color should be a string of 'rbg' call with three byte values separated by commas (example: 'rgb(255, 0, 2)') ('rgb(,,)' is invalid).
>>> Colors.check_rgb_to_int('rgb(256, -1, 5)')
Traceback (most recent call last):
...
ValueError: Color should be a string of 'rbg' call with three byte values separated by commas (example: 'rgb(255, 0, 2)') ('rgb(256, -1, 5)' is invalid).
>>> Colors.check_rgb_to_int('rgb(255, -1, 5)')
Traceback (most recent call last):
...
ValueError: Color should be a string of 'rbg' call with three byte values separated by commas (example: 'rgb(255, 0, 2)') ('rgb(255, -1, 5)' is invalid).
>>>
- check_rgba_to_int(color: str) -> Tuple[int, int, int]
- This function performs checks for rgba_to_int
arguments and call it.
>>> Colors.check_rgba_to_int('rgba(255, 0, 150, 0.0)')
(255, 0, 150)
>>> Colors.rgba_to_int('rgba ( 255 , 0 , 150 , 1) ')
(255, 0, 150)
>>> Colors.check_rgba_to_int(7)
Traceback (most recent call last):
...
ValueError: Color should be a string of 'rbga' call with three byte values separated by commas and a float between 0 and 1 (example: 'rgba(255, 0, 2, 0.5)') (7 is invalid).
>>> Colors.check_rgba_to_int('')
Traceback (most recent call last):
...
ValueError: Color should be a string of 'rbga' call with three byte values separated by commas and a float between 0 and 1 (example: 'rgba(255, 0, 2, 0.5)') ('' is invalid).
>>> Colors.check_rgba_to_int('rgba')
Traceback (most recent call last):
...
ValueError: Color should be a string of 'rbga' call with three byte values separated by commas and a float between 0 and 1 (example: 'rgba(255, 0, 2, 0.5)') ('rgba' is invalid).
>>> Colors.check_rgba_to_int('rgba(')
Traceback (most recent call last):
...
ValueError: Color should be a string of 'rbga' call with three byte values separated by commas and a float between 0 and 1 (example: 'rgba(255, 0, 2, 0.5)') ('rgba(' is invalid).
>>> Colors.check_rgba_to_int('rgba()')
Traceback (most recent call last):
...
ValueError: Color should be a string of 'rbga' call with three byte values separated by commas and a float between 0 and 1 (example: 'rgba(255, 0, 2, 0.5)') ('rgba()' is invalid).
>>> Colors.check_rgba_to_int('rgba(,,)')
Traceback (most recent call last):
...
ValueError: Color should be a string of 'rbga' call with three byte values separated by commas and a float between 0 and 1 (example: 'rgba(255, 0, 2, 0.5)') ('rgba(,,)' is invalid).
>>> Colors.check_rgba_to_int('rgba(256, -1, 5, 0.5)')
Traceback (most recent call last):
...
ValueError: Color should be a string of 'rbga' call with three byte values separated by commas and a float between 0 and 1 (example: 'rgba(255, 0, 2, 0.5)') ('rgba(256, -1, 5, 0.5)' is invalid).
>>> Colors.check_rgba_to_int('rgba(255, -1, 5, 0.5)')
Traceback (most recent call last):
...
ValueError: Color should be a string of 'rbga' call with three byte values separated by commas and a float between 0 and 1 (example: 'rgba(255, 0, 2, 0.5)') ('rgba(255, -1, 5, 0.5)' is invalid).
>>> Colors.check_rgba_to_int('rgba(255, 0, 5, 0.5.5)')
Traceback (most recent call last):
...
ValueError: Color should be a string of 'rbga' call with three byte values separated by commas and a float between 0 and 1 (example: 'rgba(255, 0, 2, 0.5)') ('rgba(255, 0, 5, 0.5.5)' is invalid).
>>> Colors.check_rgba_to_int('rgba(255, 0, 5, 1.5)')
Traceback (most recent call last):
...
ValueError: Color should be a string of 'rbga' call with three byte values separated by commas and a float between 0 and 1 (example: 'rgba(255, 0, 2, 0.5)') ('rgba(255, 0, 5, 1.5)' is invalid).
>>>
- get_8bits_color(red: int, green: int, blue: int) -> int
- This function returns integer (0-255) representing 8bits-1byte colors.
>>> Colors.get_8bits_color(7, 7, 3)
255
>>> Colors.get_8bits_color(0, 0, 0)
0
>>>
- html_to_int(colors: str) -> Tuple[int, int, int]
- This function translates HTML colors to integers colors.
>>> Colors.html_to_int('#FF0096')
(255, 0, 150)
>>> Colors.html_to_int('#ff0096')
(255, 0, 150)
>>>
- int_to_html(red: int, green: int, blue: int) -> str
- This function translates integers colors to HTML colors.
>>> Colors.int_to_html(255, 0, 150)
'#ff0096'
>>>
- int_to_rgb(red: int, green: int, blue: int) -> str
- This function translates integers
colors to RGB (CSS function) colors.
>>> Colors.int_to_rgb(255, 0, 150)
'rgb(255, 0, 150)'
>>>
- int_to_rgba(red: int, green: int, blue: int, transparency: float = 1) -> str
- This function translates integers
colors to RGBA (CSS function) colors.
>>> Colors.int_to_rgba(255, 0, 150)
'rgba(255, 0, 150, 1)'
>>>
- rgb_to_int(colors: str) -> Tuple[int, int, int]
- This function translates RGB (CSS function)
colors to integers colors.
>>> Colors.rgb_to_int('rgb(255, 0, 150)')
(255, 0, 150)
>>>
- rgba_to_int(colors: str) -> Tuple[int, int, int]
- This function translates RGBA (CSS function)
colors to integers colors.
>>> Colors.rgba_to_int('rgba(255, 0, 150, 0.5)')
(255, 0, 150)
>>>
- safe_get_8bits_color(*args) -> int
- This function performs checks for get_8bits_color
arguments and call it.
>>> Colors.safe_get_8bits_color(7, 7, 3)
255
>>> Colors.safe_get_8bits_color(255, 150, "abc")
248
>>>
- safe_html_to_int(color: str) -> Tuple[int, int, int]
- This function performs checks for html_to_int
arguments and call it.
>>> Colors.safe_html_to_int('#FF0096')
(255, 0, 150)
>>> Colors.safe_html_to_int('!FF0Z')
(255, 0, 0)
>>>
- safe_int_to_html(*args) -> str
- This function performs checks for int_to_html
arguments and call it.
>>> Colors.safe_int_to_html(255, 0, 150)
'#ff0096'
>>> Colors.safe_int_to_html(256, -1, "invalid")
'#00ff00'
>>>
- safe_int_to_rgb(*args) -> str
- This function performs checks for int_to_rgb
arguments and call it.
>>> Colors.safe_int_to_rgb(255, 0, 150)
'rgb(255, 0, 150)'
>>> Colors.safe_int_to_rgb(256, -1, "invalid")
'rgb(0, 255, 0)'
>>>
- safe_int_to_rgba(*args) -> str
- This function performs checks for int_to_rgba
arguments and call it.
>>> Colors.safe_int_to_rgba(255, 0, 150)
'rgba(255, 0, 150, 1)'
>>> Colors.safe_int_to_rgba(256, -1, "invalid", 1.9)
'rgba(0, 255, 0, 0.9)'
>>>
- safe_rgb_to_int(color: str) -> Tuple[int, int, int]
- This function performs checks for rgb_to_int
arguments and call it.
>>> Colors.safe_rgb_to_int('rgb(255, 0, 150)')
(255, 0, 150)
>>> Colors.safe_rgb_to_int('rgb(255, 0, 150,)')
(255, 0, 150)
>>> Colors.safe_rgb_to_int('azerty | qwe255, rty1500 |')
(255, 220, 0)
>>>
- safe_rgba_to_int(color: str) -> Tuple[int, int, int]
- This function performs checks for rgba_to_int
arguments and call it.
>>> Colors.safe_rgba_to_int('rgba(255, 0, 150, 0.5)')
(255, 0, 150)
>>> Colors.safe_rgba_to_int('rgba(0.5)')
(5, 0, 0)
>>> Colors.safe_rgba_to_int('azerty | qwe255, rty1500, 0.2 |')
(255, 220, 2)
>>>
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|