Skip to content

Commit

Permalink
docs: add alpha channel to supported hex color specifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
macjohnny committed Jan 4, 2021
1 parent d374015 commit 9300598
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions docs/reference/ImageColor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,17 @@ Color Names

The ImageColor module supports the following string formats:

* Hexadecimal color specifiers, given as ``#rgb`` or ``#rrggbb``. For example,
``#ff0000`` specifies pure red.
* Hexadecimal color specifiers, given as ``#rgb``, ``#rgba``, ``#rrggbb`` or ``#rrggbbaa``,
with the following placeholders:
- ``r``: red
- ``g``: green
- ``b``: blue
- ``a``: alpha / opacity (can be used in combination with ``mode="RGBA"`` in :py:mod:`~PIL.ImageDraw`)

Examples:
- ``#ff0000`` specifies pure red.
- ``#ff0000aa`` specifies pure red with an opacity of 66.66% (aa = 170, opacity = 170/255).


* RGB functions, given as ``rgb(red, green, blue)`` where the color values are
integers in the range 0 to 255. Alternatively, the color values can be given
Expand Down

0 comments on commit 9300598

Please sign in to comment.