2016-11-13 22:01:20 +00:00
|
|
|
# Copyright 2016 Virgil Dupras
|
2014-10-13 19:08:59 +00:00
|
|
|
#
|
2015-01-03 21:33:16 +00:00
|
|
|
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
|
2014-10-13 19:08:59 +00:00
|
|
|
# which should be included with this package. The terms are also available at
|
2015-01-03 21:33:16 +00:00
|
|
|
# http://www.gnu.org/licenses/gpl-3.0.html
|
2009-06-18 19:42:27 +00:00
|
|
|
|
2022-09-27 09:34:57 +00:00
|
|
|
from core.pe._cache import bytes_to_colors # noqa
|
2020-01-01 02:16:27 +00:00
|
|
|
|
2009-06-01 09:55:11 +00:00
|
|
|
|
2022-09-27 09:34:57 +00:00
|
|
|
def colors_to_bytes(colors):
|
|
|
|
"""Transform the 3 sized tuples 'colors' into a bytes string.
|
2014-10-13 19:08:59 +00:00
|
|
|
|
2022-09-27 09:34:57 +00:00
|
|
|
[(0,100,255)] --> b'\x00d\xff'
|
|
|
|
[(1,2,3),(4,5,6)] --> b'\x01\x02\x03\x04\x05\x06'
|
2009-06-01 09:55:11 +00:00
|
|
|
"""
|
2022-09-27 09:34:57 +00:00
|
|
|
return b"".join(map(bytes, colors))
|