Colors¶
src.helpers.colors.hex_to_rgb(color: str) -> list[int]
¶
src.helpers.colors.rgb_black() -> SolidColor
¶
src.helpers.colors.rgb_grey() -> SolidColor
¶
src.helpers.colors.rgb_white() -> SolidColor
¶
src.helpers.colors.get_rgb(r: int, g: int, b: int) -> SolidColor
¶
Creates a SolidColor object with the given RGB values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
int
|
Integer from 0 to 255 for red spectrum. |
required |
g
|
int
|
Integer from 0 to 255 for green spectrum. |
required |
b
|
int
|
Integer from 0 to 255 for blue spectrum. |
required |
Returns:
| Type | Description |
|---|---|
SolidColor
|
SolidColor object. |
Source code in src\helpers\colors.py
src.helpers.colors.get_rgb_from_hex(hex_code: str) -> SolidColor
¶
Creates an RGB SolidColor object with the given hex value. Allows prepending # or without.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hex_code
|
str
|
Hexadecimal color code. |
required |
Returns:
| Type | Description |
|---|---|
SolidColor
|
SolidColor object. |
Source code in src\helpers\colors.py
src.helpers.colors.get_cmyk(c: float, m: float, y: float, k: float) -> SolidColor
¶
Creates a SolidColor object with the given CMYK values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
c
|
float
|
Float from 0.0 to 100.0 for Cyan component. |
required |
m
|
float
|
Float from 0.0 to 100.0 for Magenta component. |
required |
y
|
float
|
Float from 0.0 to 100.0 for Yellow component. |
required |
k
|
float
|
Float from 0.0 to 100.0 for black component. |
required |
Returns:
| Type | Description |
|---|---|
SolidColor
|
SolidColor object. |
Source code in src\helpers\colors.py
src.helpers.colors.get_color(color: ColorObject) -> SolidColor
¶
Automatically get either cmyk or rgb color given a range of possible input notations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
ColorObject
|
List of 3 (RGB) or 4 (CMYK) numbers between 0 and 255, the hex of a color, the name of a known color, or a SolidColor object. |
required |
Returns:
| Type | Description |
|---|---|
SolidColor
|
SolidColor object. |
Source code in src\helpers\colors.py
src.helpers.colors.get_text_layer_color(layer: ArtLayer) -> SolidColor
¶
Occasionally, Photoshop has issues with retrieving the color of a text layer. This helper guards against errors and null values by defaulting to black in the event of a problem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
layer
|
ArtLayer
|
Layer object that must be TextLayer |
required |
Returns:
| Type | Description |
|---|---|
SolidColor
|
SolidColor object representing the color of the text item. |
Source code in src\helpers\colors.py
src.helpers.colors.get_text_item_color(item: TextItem) -> SolidColor
¶
Utility definition for get_text_layer_color, targeting a known TextItem.
Source code in src\helpers\colors.py
src.helpers.colors.get_pinline_gradient(colors: str, color_map: Optional[dict] = None, location_map: dict = None) -> Union[list[int], list[dict]]
¶
Return a gradient color list notation for some given pinline colors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
colors
|
str
|
Pinline colors to produce a gradient. |
required |
color_map
|
dict | None
|
Color map to color the pinlines. |
None
|
location_map
|
dict
|
Location map to position gradients. |
None
|
Returns:
| Type | Description |
|---|---|
list[int] | list[dict]
|
Gradient color list notation. |
Source code in src\helpers\colors.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | |
src.helpers.colors.apply_rgb_from_list(action: ActionDescriptor, color: list[int], color_type: str = 'color') -> None
¶
Applies RGB color to action descriptor from a list of values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
ActionDescriptor
|
ActionDescriptor object. |
required |
color
|
list[int]
|
List of integers for R, G, B. |
required |
color_type
|
str
|
Color action descriptor type, defaults to 'color'. |
'color'
|
Source code in src\helpers\colors.py
src.helpers.colors.apply_cmyk_from_list(action: ActionDescriptor, color: list[int], color_type: str = 'color') -> None
¶
Applies CMYK color to action descriptor from a list of values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
ActionDescriptor
|
ActionDescriptor object. |
required |
color
|
list[int]
|
List of integers for R, G, B. |
required |
color_type
|
str
|
Color action descriptor type, defaults to 'color'. |
'color'
|
Source code in src\helpers\colors.py
src.helpers.colors.apply_rgb(action: ActionDescriptor, c: SolidColor, color_type: str = 'color') -> None
¶
Apply RGB SolidColor object to action descriptor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
ActionDescriptor
|
ActionDescriptor object. |
required |
c
|
SolidColor
|
SolidColor object matching RGB model. |
required |
color_type
|
str
|
Color action descriptor type, defaults to 'color'. |
'color'
|
Source code in src\helpers\colors.py
src.helpers.colors.apply_cmyk(action: ActionDescriptor, c: SolidColor, color_type: str = 'color') -> None
¶
Apply CMYK SolidColor object to action descriptor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
ActionDescriptor
|
ActionDescriptor object. |
required |
c
|
SolidColor
|
SolidColor object matching CMYK model. |
required |
color_type
|
str
|
Color action descriptor type, defaults to 'color'. |
'color'
|
Source code in src\helpers\colors.py
src.helpers.colors.apply_color(action: ActionDescriptor, color: ColorObject, color_type: str = 'color') -> None
¶
Applies color to the specified action descriptor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
ActionDescriptor
|
ActionDescriptor object. |
required |
color
|
ColorObject
|
RGB/CMYK SolidColor object, list of RGB/CMYK values, a hex string, or a named color. |
required |
color_type
|
str
|
Color action descriptor type, defaults to 'color'. |
'color'
|
Source code in src\helpers\colors.py
src.helpers.colors.add_color_to_gradient(action_list: ActionList, color: ColorObject, location: int, midpoint: int) -> None
¶
Adds a SolidColor to gradient at a given location, with a given midpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action_list
|
ActionList
|
Action list to add this color to. |
required |
color
|
ColorObject
|
SolidColor object. |
required |
location
|
int
|
Location of the color along the track. |
required |
midpoint
|
int
|
Percentage midpoint between this color and the next. |
required |
Source code in src\helpers\colors.py
src.helpers.colors.fill_layer_primary()
¶
Fill active layer using foreground color.