encommon.colors package#
Subpackages#
Submodules#
encommon.colors.color module#
Functions and routines associated with Enasis Network Common Library.
This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.
- class encommon.colors.color.Color(source: str)[source]#
Bases:
object
Covert colors to various forms using provided hex value.
Example#
>>> color = Color('#003333') >>> color.rgb (0, 51, 51) >>> color.hsl (180, 100, 10) >>> color.xyz (1.7814, 2.6067, 3.5412) >>> color.xy (0.2247, 0.3287)
Example#
>>> color1 = Color('#003333') >>> color2 = Color('#330000') >>> color1 - color2 Color('#32CCCD') >>> color1 + color2 Color('#333333')
- param source:
Source color used when converting values.
- classmethod from_hsl(hue: int, sat: int, lev: int) Color [source]#
Initialize instance for class using provided parameters.
- classmethod from_rgb(red: int, green: int, blue: int) Color [source]#
Initialize instance for class using provided parameters.
- property hsl: tuple[int, int, int]#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property rgb: tuple[int, int, int]#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property source: str#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
Module contents#
Functions and routines associated with Enasis Network Common Library.
This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.
- class encommon.colors.Color(source: str)[source]#
Bases:
object
Covert colors to various forms using provided hex value.
Example#
>>> color = Color('#003333') >>> color.rgb (0, 51, 51) >>> color.hsl (180, 100, 10) >>> color.xyz (1.7814, 2.6067, 3.5412) >>> color.xy (0.2247, 0.3287)
Example#
>>> color1 = Color('#003333') >>> color2 = Color('#330000') >>> color1 - color2 Color('#32CCCD') >>> color1 + color2 Color('#333333')
- param source:
Source color used when converting values.
- classmethod from_hsl(hue: int, sat: int, lev: int) Color [source]#
Initialize instance for class using provided parameters.
- classmethod from_rgb(red: int, green: int, blue: int) Color [source]#
Initialize instance for class using provided parameters.
- property hsl: tuple[int, int, int]#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property rgb: tuple[int, int, int]#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property source: str#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.