adding files

cc
This commit is contained in:
2020-12-16 20:47:09 +01:00
commit fa3353c471
62 changed files with 3384 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
{"background": "#59bdf7",
"backgroundShade": "#81ccf7",
"outline": "#268cc7",
"outline-shade": "#2ba0e3",
"addition": "#1575ad",
"outline-dark": "#09517a"}

View File

@@ -0,0 +1,6 @@
{"background": "#75ebc2",
"backgroundShade": "#4debb4",
"outline": "#9baba5",
"outline-shade": "#81a195",
"addition": "#07db91",
"outline-dark": "#60716a"}

View File

@@ -0,0 +1,6 @@
{"background": "#8818c9",
"backgroundShade": "#8425ba",
"outline": "#dd26e0",
"outline-shade": "#7e38a6",
"addition": "#a716fa",
"outline-dark": "#5b1485"}

View File

@@ -0,0 +1,71 @@
import os
import json
import pygame
from itertools import cycle
pygame.init()
class Palettes:
def __init__(self, path):
self.path = path
self.palettes = {}
self.current_palette = "emerald" # set starting palette here
self.load_palettes()
self.palette = self.get_palette()
self.cycle = None
self.changed = False
def load_palettes(self):
current_dir = os.getcwd()
os.chdir(self.path)
files = os.listdir()
files.remove('palette_manager.py')
try:
files.remove("__pycache__")
except:
pass
for file in files:
with open(file, "r") as f:
fileX = json.load(f)
for color in fileX.keys():
fileX[color] = self.rgb(fileX[color])
file = "".join(list(file)[:-5])
self.palettes[file] = fileX
os.chdir(current_dir)
def get_palette(self):
return self.palettes[self.current_palette]
def swap_image(self, image, old_p, new_p):
for color in self.palettes[old_p].keys():
image = swap_color(image, self.palettes[old_p][color], self.palettes[new_p][color])
return image
def create_cycle(self):
names = self.palettes.keys()
self.cycle = cycle(names)
while next(self.cycle) != self.current_palette:
pass
@staticmethod
def rgb(color):
color = color.strip("#")
color = [int(color[i:i+2], 16) for i in range(0, 5, 2)]
return color
def swap_color(imageX, old, new):
image_copy = pygame.Surface(imageX.copy().get_size())
image_copy.fill(new)
imageX.set_colorkey(old)
image_copy.blit(imageX, [0, 0])
return image_copy

View File

@@ -0,0 +1,6 @@
{"background": "#c9c5c5",
"backgroundShade": "#a3a0a0",
"outline": "#9e2929",
"outline-shade": "#8f6565",
"addition": "#a83939",
"outline-dark": "#610e0e"}

View File

@@ -0,0 +1,6 @@
{"background": "#ff87df",
"backgroundShade": "#f7b2e5",
"outline": "#d94db4",
"outline-shade": "#fe75db",
"addition": "#eb3bbc",
"outline-dark": "#97316b"}

View File

@@ -0,0 +1,6 @@
{"background": "#faf9de",
"backgroundShade": "#f2f2df",
"outline": "#c7c689",
"outline-shade": "#ccca5e",
"addition": "#fffd6e",
"outline-dark": "#474731"}