rgba
rgba
¶
RGBA colors are used for declaring visuals of rendering output.
This module contains RGBA class which can be used to provide such color.
RGBA
¶
Bases: FrozenGeneralModel
Representation of RGBA color.
Source code in src/pygerber/common/rgba.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
|
from_hex
classmethod
¶
Build RGBA color object from hexadecimal string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string |
str
|
String containing color value. Accepted formats are |
required |
Returns:
Type | Description |
---|---|
RGBA
|
Color built from hexadecimal values. |
Source code in src/pygerber/common/rgba.py
from_rgba
classmethod
¶
Build RGBA color object from reg, green, blue and alpha integer values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
r |
int
|
Red chanel value as integer from 0 to 255, inclusive. |
required |
g |
int
|
Green chanel value as integer from 0 to 255, inclusive. |
required |
b |
int
|
Blue chanel value as integer from 0 to 255, inclusive. |
required |
a |
int
|
Alpha chanel value as integer from 0 to 255, inclusive., by default 0xFF |
255
|
Returns:
Type | Description |
---|---|
Self
|
Color built from r, g, b, a values. |
Source code in src/pygerber/common/rgba.py
from_hsv
classmethod
¶
Build RGBA color object from hue, saturation, value and alpha.
For extended information refer to Wikipedia: https://en.wikipedia.org/wiki/HSL_and_HSV
Parameters:
Name | Type | Description | Default |
---|---|---|---|
h |
int
|
Hue of color, integer in range 0 to 360 inclusive. |
required |
s |
float
|
Saturation of color, float in range 0.0 to 100.0 inclusive. |
required |
v |
float
|
Value of color, float in range 0.0 to 100.0 inclusive. |
required |
a |
int
|
Alpha of color, int in range 0 to 255 inclusive. |
255
|
Returns:
Type | Description |
---|---|
Self
|
Color built from h, s, v, a values. |
Source code in src/pygerber/common/rgba.py
as_rgba_int
¶
as_rgba_float
¶
Return RGBA color as tuple of floats in range 0.0 to 1.0 inclusive.