Skip to content

Commit

Permalink
tight gradient functions annotations and update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
roberto-arista committed Jul 30, 2024
1 parent 3041a02 commit 1bdd28d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions drawBot/aliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
Points = Sequence[Point]
SomePath = os.PathLike | str
CMYKColor = float | tuple[float, ...]
# used for output values which are always 4 elements
RGBAColorTuple = tuple[float, float, float, float]
RGBAColorTuple = CMYKColorTuple = tuple[float, float, float, float]
RGBColorTuple = tuple[float, float, float]
RGBColor = float | tuple[float, ...]
BoundingBox = tuple[float, float, float, float]
TransformTuple = tuple[float, float, float, float, float, float]
10 changes: 6 additions & 4 deletions drawBot/drawBotDrawingTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
Size,
SomePath,
CMYKColor,
CMYKColorTuple,
RGBColor,
RGBColorTuple,
RGBAColorTuple,
BoundingBox,
TransformTuple,
Expand Down Expand Up @@ -1060,15 +1062,15 @@ def linearGradient(
self,
startPoint: Point | None = None,
endPoint: Point | None = None,
colors: list[RGBColor] | None = None,
colors: list[RGBColor | RGBColorTuple] | None = None,
locations: list[float] | None = None,
):
"""
A linear gradient fill with:
* `startPoint` as (x, y)
* `endPoint` as (x, y)
* `colors` as a list of colors, described similary as `fill`
* `colors` as a list of colors, tuples of floating point values (0 → 1)
* `locations` of each color as a list of floats. (optionally)
Setting a gradient will ignore the `fill`.
Expand All @@ -1092,15 +1094,15 @@ def cmykLinearGradient(
self,
startPoint: Point | None = None,
endPoint: Point | None = None,
colors: list[CMYKColor] | None = None,
colors: list[CMYKColorTuple] | None = None,
locations=None,
):
"""
A cmyk linear gradient fill with:
* `startPoint` as (x, y)
* `endPoint` as (x, y)
* `colors` as a list of colors, described similary as `cmykFill`
* `colors` as a list of colors, tuples of floating point values (0 → 1)
* `locations` of each color as a list of floats. (optionally)
Setting a gradient will ignore the `fill`.
Expand Down

0 comments on commit 1bdd28d

Please sign in to comment.