Gray/RGB/CMYK mode components to color value.
(components:list)
| 180 | |
| 181 | |
| 182 | def rgb_value(components:list): |
| 183 | '''Gray/RGB/CMYK mode components to color value.''' |
| 184 | num = len(components) |
| 185 | # CMYK mode |
| 186 | if num==4: |
| 187 | c, m, y, k = map(float, components) |
| 188 | color = cmyk_to_rgb(c, m, y, k, cmyk_scale=1.0) |
| 189 | # RGB mode |
| 190 | elif num==3: |
| 191 | r, g, b = map(float, components) |
| 192 | color = rgb_to_value([r, g, b]) |
| 193 | # gray mode |
| 194 | elif num==1: |
| 195 | g = float(components[0]) |
| 196 | color = rgb_to_value([g,g,g]) |
| 197 | else: |
| 198 | color = 0 |
| 199 | |
| 200 | return color |
| 201 | |
| 202 | |
| 203 | # ------------------------- |
no test coverage detected
searching dependent graphs…