Наработки за 5 лет
This commit is contained in:
29
HXtools/RGBconverter.py
Normal file
29
HXtools/RGBconverter.py
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# MAIN PROGRAM
|
||||
def main():
|
||||
color = int(input("Type color 0xHHHHHH>"), 16)
|
||||
|
||||
r = color >> 16
|
||||
g = (color >> 8) & 0x0000FF
|
||||
b = color & 0x0000FF
|
||||
|
||||
r1 = int(r / 255 * 31)
|
||||
g1 = int(g / 255 * 63)
|
||||
b1 = int(b / 255 * 31)
|
||||
|
||||
color = r1 << 11
|
||||
color = color + (g1 << 5)
|
||||
color = color + b1
|
||||
|
||||
print('RED: 0x%X, %i' % (r, r1))
|
||||
print('GREEN: 0x%X, %i' % (g, g1))
|
||||
print('BLUE: 0x%X, %i' % (b, b1))
|
||||
print('COLOR: 0x%X' % color)
|
||||
|
||||
|
||||
|
||||
# MAIN PROGRAM
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
6
HXtools/hxtools.nja
Normal file
6
HXtools/hxtools.nja
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"venv": "",
|
||||
"name": "HXtools",
|
||||
"license": "GNU General Public License v3",
|
||||
"description": ""
|
||||
}
|
||||
Reference in New Issue
Block a user