mirror of
https://github.com/rozniak/xfce-winxp-tc.git
synced 2026-05-01 11:41:30 +00:00
Prelim: Updated handling of colour scheme constants
This commit is contained in:
@@ -10,11 +10,14 @@ from PIL import Image, ImageDraw
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(prog="Theme Part Composer Utility", description="Composes theme part graphics from source files.", epilog="See README.MD if you want to know the details.")
|
||||
|
||||
parser.add_argument("scheme", help="path to the scheme file")
|
||||
parser.add_argument("inputdir", help="the input directory to scan for files")
|
||||
parser.add_argument("outputdir", help="the output directory to place composed files")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
scheme = parse_scheme(args.scheme)
|
||||
|
||||
for filename in os.listdir(args.inputdir):
|
||||
if fnmatch.fnmatch(filename, "*.src.png"):
|
||||
basename = get_basename(filename)
|
||||
@@ -30,7 +33,10 @@ def main():
|
||||
|
||||
drawing = ImageDraw.Draw(newImage)
|
||||
|
||||
drawing.bitmap((0, 0), maskMono, "rgb(128,128,128)")
|
||||
if "progress" in basename:
|
||||
drawing.bitmap((0, 0), maskMono, scheme["ACTIVE_TITLE_BAR_BG1"])
|
||||
else:
|
||||
drawing.bitmap((0, 0), maskMono, scheme["THREED_OBJECTS_BG"])
|
||||
|
||||
composed = Image.alpha_composite(newImage, pngRGB)
|
||||
|
||||
@@ -43,5 +49,22 @@ def main():
|
||||
def get_basename(filename):
|
||||
return filename[0:filename.find(".")]
|
||||
|
||||
def parse_scheme(path):
|
||||
scheme = dict()
|
||||
|
||||
with open(path) as schemefile:
|
||||
for line in schemefile:
|
||||
if line == "":
|
||||
continue
|
||||
|
||||
equals_pos = line.find("=")
|
||||
|
||||
scheme_id = line[0:equals_pos]
|
||||
scheme_value = line[equals_pos + 1:len(line)]
|
||||
|
||||
scheme[scheme_id] = scheme_value
|
||||
|
||||
return scheme
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user