golden hour
/opt/saltstack/salt/lib/python3.10
⬆️ Go Up
Upload
File/Folder
Size
Actions
__future__.py
5.03 KB
Del
OK
__phello__.foo.py
64 B
Del
OK
__pycache__
-
Del
OK
_aix_support.py
3.19 KB
Del
OK
_bootsubprocess.py
2.61 KB
Del
OK
_collections_abc.py
31.53 KB
Del
OK
_compat_pickle.py
8.54 KB
Del
OK
_compression.py
5.55 KB
Del
OK
_markupbase.py
14.31 KB
Del
OK
_osx_support.py
21.28 KB
Del
OK
_py_abc.py
6.04 KB
Del
OK
_pydecimal.py
223.32 KB
Del
OK
_pyio.py
92.25 KB
Del
OK
_sitebuiltins.py
3.05 KB
Del
OK
_strptime.py
24.68 KB
Del
OK
_sysconfigdata__linux_x86_64-linux-gnu.py
31.51 KB
Del
OK
_threading_local.py
7.05 KB
Del
OK
_weakrefset.py
5.78 KB
Del
OK
abc.py
6.37 KB
Del
OK
aifc.py
31.84 KB
Del
OK
antigravity.py
500 B
Del
OK
argparse.py
96.23 KB
Del
OK
ast.py
58.5 KB
Del
OK
asynchat.py
11.25 KB
Del
OK
asyncio
-
Del
OK
asyncore.py
19.79 KB
Del
OK
base64.py
20.36 KB
Del
OK
bdb.py
31.64 KB
Del
OK
binhex.py
14.44 KB
Del
OK
bisect.py
3.06 KB
Del
OK
bz2.py
11.57 KB
Del
OK
cProfile.py
6.2 KB
Del
OK
calendar.py
24 KB
Del
OK
cgi.py
33.37 KB
Del
OK
cgitb.py
11.81 KB
Del
OK
chunk.py
5.31 KB
Del
OK
cmd.py
14.51 KB
Del
OK
code.py
10.37 KB
Del
OK
codecs.py
35.85 KB
Del
OK
codeop.py
5.48 KB
Del
OK
collections
-
Del
OK
colorsys.py
3.92 KB
Del
OK
compileall.py
19.78 KB
Del
OK
concurrent
-
Del
OK
config-3.10-x86_64-linux-gnu
-
Del
OK
configparser.py
53.33 KB
Del
OK
contextlib.py
25.28 KB
Del
OK
contextvars.py
129 B
Del
OK
copy.py
8.48 KB
Del
OK
copyreg.py
7.25 KB
Del
OK
crypt.py
3.76 KB
Del
OK
csv.py
15.65 KB
Del
OK
ctypes
-
Del
OK
curses
-
Del
OK
dataclasses.py
55.07 KB
Del
OK
datetime.py
86.02 KB
Del
OK
dbm
-
Del
OK
decimal.py
320 B
Del
OK
difflib.py
81.36 KB
Del
OK
dis.py
19.55 KB
Del
OK
distutils
-
Del
OK
doctest.py
102.68 KB
Del
OK
email
-
Del
OK
encodings
-
Del
OK
ensurepip
-
Del
OK
enum.py
38.9 KB
Del
OK
filecmp.py
9.94 KB
Del
OK
fileinput.py
16.06 KB
Del
OK
fnmatch.py
6.56 KB
Del
OK
fractions.py
27.58 KB
Del
OK
ftplib.py
34.66 KB
Del
OK
functools.py
37.18 KB
Del
OK
genericpath.py
4.86 KB
Del
OK
getopt.py
7.31 KB
Del
OK
getpass.py
5.85 KB
Del
OK
gettext.py
26.63 KB
Del
OK
glob.py
7.7 KB
Del
OK
graphlib.py
9.35 KB
Del
OK
gzip.py
21.34 KB
Del
OK
hashlib.py
9.99 KB
Del
OK
heapq.py
22.34 KB
Del
OK
hmac.py
7.54 KB
Del
OK
html
-
Del
OK
http
-
Del
OK
imaplib.py
53.58 KB
Del
OK
imghdr.py
3.72 KB
Del
OK
imp.py
10.34 KB
Del
OK
importlib
-
Del
OK
inspect.py
121.46 KB
Del
OK
io.py
4.1 KB
Del
OK
ipaddress.py
72.97 KB
Del
OK
json
-
Del
OK
keyword.py
1.04 KB
Del
OK
lib-dynload
-
Del
OK
lib2to3
-
Del
OK
linecache.py
5.56 KB
Del
OK
locale.py
76.29 KB
Del
OK
logging
-
Del
OK
lzma.py
12.97 KB
Del
OK
mailbox.py
76.95 KB
Del
OK
mailcap.py
8.9 KB
Del
OK
mimetypes.py
22.01 KB
Del
OK
modulefinder.py
23.83 KB
Del
OK
multiprocessing
-
Del
OK
netrc.py
5.61 KB
Del
OK
nntplib.py
40.06 KB
Del
OK
ntpath.py
28.79 KB
Del
OK
nturl2path.py
2.82 KB
Del
OK
numbers.py
10.11 KB
Del
OK
opcode.py
5.76 KB
Del
OK
operator.py
10.5 KB
Del
OK
optparse.py
58.95 KB
Del
OK
os.py
38.63 KB
Del
OK
pathlib.py
48.41 KB
Del
OK
pdb.py
61.74 KB
Del
OK
pickle.py
63.43 KB
Del
OK
pickletools.py
91.29 KB
Del
OK
pipes.py
8.71 KB
Del
OK
pkgutil.py
24 KB
Del
OK
platform.py
41.04 KB
Del
OK
plistlib.py
27.69 KB
Del
OK
poplib.py
14.84 KB
Del
OK
posixpath.py
15.87 KB
Del
OK
pprint.py
23.87 KB
Del
OK
profile.py
22.35 KB
Del
OK
pstats.py
28.64 KB
Del
OK
pty.py
5.09 KB
Del
OK
py_compile.py
7.65 KB
Del
OK
pyclbr.py
11.13 KB
Del
OK
pydoc.py
107.02 KB
Del
OK
pydoc_data
-
Del
OK
queue.py
11.23 KB
Del
OK
quopri.py
7.1 KB
Del
OK
random.py
32.44 KB
Del
OK
re.py
15.49 KB
Del
OK
reprlib.py
5.14 KB
Del
OK
rlcompleter.py
7.63 KB
Del
OK
runpy.py
12.8 KB
Del
OK
sched.py
6.2 KB
Del
OK
secrets.py
1.99 KB
Del
OK
selectors.py
19.08 KB
Del
OK
shelve.py
8.36 KB
Del
OK
shlex.py
13.18 KB
Del
OK
shutil.py
53.29 KB
Del
OK
signal.py
2.38 KB
Del
OK
site-packages
-
Del
OK
site.py
22.06 KB
Del
OK
smtpd.py
34.34 KB
Del
OK
smtplib.py
44.35 KB
Del
OK
sndhdr.py
6.93 KB
Del
OK
socket.py
35.92 KB
Del
OK
socketserver.py
26.66 KB
Del
OK
sqlite3
-
Del
OK
sre_compile.py
27.32 KB
Del
OK
sre_constants.py
7.01 KB
Del
OK
sre_parse.py
39.82 KB
Del
OK
ssl.py
52.63 KB
Del
OK
stat.py
5.36 KB
Del
OK
statistics.py
42.19 KB
Del
OK
string.py
10.32 KB
Del
OK
stringprep.py
12.61 KB
Del
OK
struct.py
257 B
Del
OK
subprocess.py
82.93 KB
Del
OK
sunau.py
17.73 KB
Del
OK
symtable.py
9.98 KB
Del
OK
sysconfig.py
26.96 KB
Del
OK
tabnanny.py
11.03 KB
Del
OK
tarfile.py
103.63 KB
Del
OK
telnetlib.py
22.71 KB
Del
OK
tempfile.py
28.5 KB
Del
OK
textwrap.py
19.31 KB
Del
OK
this.py
1003 B
Del
OK
threading.py
55.86 KB
Del
OK
timeit.py
13.18 KB
Del
OK
token.py
2.33 KB
Del
OK
tokenize.py
25.31 KB
Del
OK
trace.py
28.53 KB
Del
OK
traceback.py
25.61 KB
Del
OK
tracemalloc.py
17.62 KB
Del
OK
tty.py
879 B
Del
OK
turtle.py
140.39 KB
Del
OK
types.py
9.88 KB
Del
OK
typing.py
90.39 KB
Del
OK
unittest
-
Del
OK
urllib
-
Del
OK
uu.py
7.13 KB
Del
OK
uuid.py
26.86 KB
Del
OK
venv
-
Del
OK
warnings.py
19.23 KB
Del
OK
wave.py
17.58 KB
Del
OK
weakref.py
21.05 KB
Del
OK
webbrowser.py
23.68 KB
Del
OK
wsgiref
-
Del
OK
xdrlib.py
5.77 KB
Del
OK
xml
-
Del
OK
xmlrpc
-
Del
OK
zipapp.py
7.36 KB
Del
OK
zipfile.py
87.34 KB
Del
OK
zipimport.py
30.17 KB
Del
OK
zoneinfo
-
Del
OK
Edit: colorsys.py
"""Conversion 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 """ # References: # http://en.wikipedia.org/wiki/YIQ # http://en.wikipedia.org/wiki/HLS_color_space # http://en.wikipedia.org/wiki/HSV_color_space __all__ = ["rgb_to_yiq","yiq_to_rgb","rgb_to_hls","hls_to_rgb", "rgb_to_hsv","hsv_to_rgb"] # Some floating point constants ONE_THIRD = 1.0/3.0 ONE_SIXTH = 1.0/6.0 TWO_THIRD = 2.0/3.0 # YIQ: used by composite video signals (linear combinations of RGB) # Y: perceived grey level (0.0 == black, 1.0 == white) # I, Q: color components # # There are a great many versions of the constants used in these formulae. # The ones in this library uses constants from the FCC version of NTSC. def rgb_to_yiq(r, g, b): y = 0.30*r + 0.59*g + 0.11*b i = 0.74*(r-y) - 0.27*(b-y) q = 0.48*(r-y) + 0.41*(b-y) return (y, i, q) def yiq_to_rgb(y, i, q): # r = y + (0.27*q + 0.41*i) / (0.74*0.41 + 0.27*0.48) # b = y + (0.74*q - 0.48*i) / (0.74*0.41 + 0.27*0.48) # g = y - (0.30*(r-y) + 0.11*(b-y)) / 0.59 r = y + 0.9468822170900693*i + 0.6235565819861433*q g = y - 0.27478764629897834*i - 0.6356910791873801*q b = y - 1.1085450346420322*i + 1.7090069284064666*q if r < 0.0: r = 0.0 if g < 0.0: g = 0.0 if b < 0.0: b = 0.0 if r > 1.0: r = 1.0 if g > 1.0: g = 1.0 if b > 1.0: b = 1.0 return (r, g, b) # HLS: Hue, Luminance, Saturation # H: position in the spectrum # L: color lightness # S: color saturation def rgb_to_hls(r, g, b): maxc = max(r, g, b) minc = min(r, g, b) sumc = (maxc+minc) rangec = (maxc-minc) l = sumc/2.0 if minc == maxc: return 0.0, l, 0.0 if l <= 0.5: s = rangec / sumc else: s = rangec / (2.0-sumc) rc = (maxc-r) / rangec gc = (maxc-g) / rangec bc = (maxc-b) / rangec if r == maxc: h = bc-gc elif g == maxc: h = 2.0+rc-bc else: h = 4.0+gc-rc h = (h/6.0) % 1.0 return h, l, s def hls_to_rgb(h, l, s): if s == 0.0: return l, l, l if l <= 0.5: m2 = l * (1.0+s) else: m2 = l+s-(l*s) m1 = 2.0*l - m2 return (_v(m1, m2, h+ONE_THIRD), _v(m1, m2, h), _v(m1, m2, h-ONE_THIRD)) def _v(m1, m2, hue): hue = hue % 1.0 if hue < ONE_SIXTH: return m1 + (m2-m1)*hue*6.0 if hue < 0.5: return m2 if hue < TWO_THIRD: return m1 + (m2-m1)*(TWO_THIRD-hue)*6.0 return m1 # HSV: Hue, Saturation, Value # H: position in the spectrum # S: color saturation ("purity") # V: color brightness def rgb_to_hsv(r, g, b): maxc = max(r, g, b) minc = min(r, g, b) v = maxc if minc == maxc: return 0.0, 0.0, v s = (maxc-minc) / maxc rc = (maxc-r) / (maxc-minc) gc = (maxc-g) / (maxc-minc) bc = (maxc-b) / (maxc-minc) if r == maxc: h = bc-gc elif g == maxc: h = 2.0+rc-bc else: h = 4.0+gc-rc h = (h/6.0) % 1.0 return h, s, v def hsv_to_rgb(h, s, v): if s == 0.0: return v, v, v i = int(h*6.0) # XXX assume int() truncates! f = (h*6.0) - i p = v*(1.0 - s) q = v*(1.0 - s*f) t = v*(1.0 - s*(1.0-f)) i = i%6 if i == 0: return v, t, p if i == 1: return q, v, p if i == 2: return p, v, t if i == 3: return p, q, v if i == 4: return t, p, v if i == 5: return v, p, q # Cannot get here
Save