U kg@s\dZddddddgZdZdZd Zd dZd dZd dZd dZddZ ddZ ddZ dS)aJConversion functions between RGB and other color systems. This modules provides two functions for each color system ABC: rgb_to_abc(r, g, b) --> a, b, c abc_to_rgb(a, b, c) --> r, g, b All inputs and outputs are triples of floats in the range [0.0...1.0] (with the exception of I and Q, which covers a slightly larger range). Inputs outside the valid range may cause exceptions or invalid outputs. Supported color systems: RGB: Red, Green, Blue components YIQ: Luminance, Chrominance (used by composite video signals) HLS: Hue, Luminance, Saturation HSV: Hue, Saturation, Value rgb_to_yiq yiq_to_rgb rgb_to_hls hls_to_rgb rgb_to_hsv hsv_to_rgbgUUUUUU?gUUUUUU?gUUUUUU?cCsRd|d|d|}d||d||}d||d||}|||fS)Ng333333?gzG?g)\(?gGz?gHzG?gQ?g= ףp=?)rgbyiqrr/usr/lib/python3.8/colorsys.pyr(scCs|d|d|}|d|d|}|d|d|}|dkrHd}|dkrTd}|dkr`d}|dkrld}|dkrxd}|dkrd}|||fS) Ng2rL?g,?g:?gnєW?g6޷?gJ"X??r)r r r rr r rrrr.s c Cst|||}t|||}||d}||kr6d|dfS|dkrP||||}n||d||}||||}||||}||||} ||kr| |} n"||krd|| } n d||} | dd} | ||fS)N@r?@@rmaxmin) rr r maxcminclsrcgcbchrrrrKs$       cCsn|dkr|||fS|dkr(|d|}n||||}d||}t|||tt|||t|||tfS)Nrrrr)_v ONE_THIRD)rrrm2m1rrrrbs  cCsT|d}|tkr$||||dS|dkr0|S|tkrP|||t|dS|S)Nrrr) ONE_SIXTH TWO_THIRD)r#r"Zhuerrrr lsr c Cst|||}t|||}|}||kr.dd|fS|||}||||}||||}||||} ||kr|| |} n"||krd|| } n d||} | dd} | ||fS)Nrrrrrr) rr r rrvrrrrrrrrr|s        cCs|dkr|||fSt|d}|d|}|d|}|d||}|d|d|}|d}|dkrt|||fS|dkr|||fS|dkr|||fS|dkr|||fS|d kr|||fS|d kr|||fSdS) Nrrr)int)rrr&r fpr trrrrs(         N) __doc____all__r!r$r%rrrrr rrrrrrs