NineSec Team Shell
Server IP : 184.107.3.203  /  Your IP : 216.73.216.51
Web Server : Apache
System : Linux dedicated2.avenfashion.com.ph 4.18.0-553.40.1.el8_10.x86_64 #1 SMP Mon Feb 10 12:11:18 EST 2025 x86_64
User : adminteladeoro ( 1015)
PHP Version : 8.2.28
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /usr/share/doc/python2-docs/html/_sources/library/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //usr/share/doc/python2-docs/html/_sources/library/colorsys.rst.txt
:mod:`colorsys` --- Conversions between color systems
=====================================================

.. module:: colorsys
   :synopsis: Conversion functions between RGB and other color systems.
.. sectionauthor:: David Ascher <da@python.net>

**Source code:** :source:`Lib/colorsys.py`

--------------

The :mod:`colorsys` module defines bidirectional conversions of color values
between colors expressed in the RGB (Red Green Blue) color space used in
computer monitors and three other coordinate systems: YIQ, HLS (Hue Lightness
Saturation) and HSV (Hue Saturation Value).  Coordinates in all of these color
spaces are floating point values.  In the YIQ space, the Y coordinate is between
0 and 1, but the I and Q coordinates can be positive or negative.  In all other
spaces, the coordinates are all between 0 and 1.

.. seealso::

   More information about color spaces can be found at
   http://www.poynton.com/ColorFAQ.html and
   https://www.cambridgeincolour.com/tutorials/color-spaces.htm.

The :mod:`colorsys` module defines the following functions:


.. function:: rgb_to_yiq(r, g, b)

   Convert the color from RGB coordinates to YIQ coordinates.


.. function:: yiq_to_rgb(y, i, q)

   Convert the color from YIQ coordinates to RGB coordinates.


.. function:: rgb_to_hls(r, g, b)

   Convert the color from RGB coordinates to HLS coordinates.


.. function:: hls_to_rgb(h, l, s)

   Convert the color from HLS coordinates to RGB coordinates.


.. function:: rgb_to_hsv(r, g, b)

   Convert the color from RGB coordinates to HSV coordinates.


.. function:: hsv_to_rgb(h, s, v)

   Convert the color from HSV coordinates to RGB coordinates.

Example::

   >>> import colorsys
   >>> colorsys.rgb_to_hsv(0.2, 0.4, 0.4)
   (0.5, 0.5, 0.4)
   >>> colorsys.hsv_to_rgb(0.5, 0.5, 0.4)
   (0.2, 0.4, 0.4)

NineSec Team - 2022