Colour Re-implementation

* Overhauled colour codes support with Ren'py supplied Color class
* Added support for hexadecimals alongside colour tuples w/ backwards compatibility
* Reduced colour assignments overhead
* Converted all colour lists into hexadecimals for all characters
This commit is contained in:
LoafyLemon 2023-02-08 21:40:28 +00:00
parent 3586bba211
commit dcdd54cdfe
12 changed files with 660 additions and 659 deletions

View File

@ -11,29 +11,29 @@ default ast_body_default = DollOutfit([ast_frame_default], hidden=True)
## Hair ##
##########
default ast_hair_base = DollCloth("astoria", ("head", "hair"), "hair", "base", [[229, 198, 129, 255], [163, 125, 80, 255]], unlocked=True)
default ast_hair_short = DollCloth("astoria", ("head", "hair"), "hair", "short", [[229, 198, 129, 255], [163, 125, 80, 255]], unlocked=True)
default ast_hair_base = DollCloth("astoria", ("head", "hair"), "hair", "base", ["#e5c681ff", "#a37d50ff"], unlocked=True)
default ast_hair_short = DollCloth("astoria", ("head", "hair"), "hair", "short", ["#e5c681ff", "#a37d50ff"], unlocked=True)
#######################
## Schoolgirl Outfit ##
#######################
default ast_top_school1 = DollCloth("astoria", ("upper body", "shirts"), "top", "top_school_1", [[183, 183, 184, 255], [109, 105, 121, 255], [58, 115, 75, 255], [205, 205, 206, 255]], unlocked=True)
default ast_top_school2 = DollCloth("astoria", ("upper body", "shirts"), "top", "top_school_2", [[183, 183, 184, 255], [109, 105, 121, 255], [58, 115, 75, 255], [205, 205, 206, 255]], level=4, unlocked=True)
default ast_top_school3 = DollCloth("astoria", ("upper body", "shirts"), "top", "top_school_3", [[183, 183, 184, 255], [58, 115, 75, 255], [205, 205, 206, 255]], level=8, unlocked=True)
default ast_top_school4 = DollCloth("astoria", ("upper body", "shirts"), "top", "top_school_4", [[183, 183, 184, 255], [58, 115, 75, 255], [205, 205, 206, 255]], level=8, unlocked=True)
default ast_top_school5 = DollCloth("astoria", ("upper body", "shirts"), "top", "top_school_5", [[183, 183, 184, 255], [58, 115, 75, 255], [205, 205, 206, 255]], level=12, unlocked=True)
default ast_top_school6 = DollCloth("astoria", ("upper body", "shirts"), "top", "top_school_6", [[109, 105, 121, 255], [58, 115, 75, 255], [205, 205, 206, 255]], level=12, unlocked=True)
default ast_top_school1 = DollCloth("astoria", ("upper body", "shirts"), "top", "top_school_1", ["#b7b7b8ff", "#6d6979ff", "#3a734bff", "#cdcdceff"], unlocked=True)
default ast_top_school2 = DollCloth("astoria", ("upper body", "shirts"), "top", "top_school_2", ["#b7b7b8ff", "#6d6979ff", "#3a734bff", "#cdcdceff"], level=4, unlocked=True)
default ast_top_school3 = DollCloth("astoria", ("upper body", "shirts"), "top", "top_school_3", ["#b7b7b8ff", "#3a734bff", "#cdcdceff"], level=8, unlocked=True)
default ast_top_school4 = DollCloth("astoria", ("upper body", "shirts"), "top", "top_school_4", ["#b7b7b8ff", "#3a734bff", "#cdcdceff"], level=8, unlocked=True)
default ast_top_school5 = DollCloth("astoria", ("upper body", "shirts"), "top", "top_school_5", ["#b7b7b8ff", "#3a734bff", "#cdcdceff"], level=12, unlocked=True)
default ast_top_school6 = DollCloth("astoria", ("upper body", "shirts"), "top", "top_school_6", ["#6d6979ff", "#3a734bff", "#cdcdceff"], level=12, unlocked=True)
default ast_bottom_skirt1 = DollCloth("astoria", ("lower body", "skirts"), "bottom", "school_skirt_1", [[103, 90, 108, 255], [232, 177, 13, 255]], unlocked=True)
default ast_bottom_skirt2 = DollCloth("astoria", ("lower body", "skirts"), "bottom", "school_skirt_2", [[103, 90, 108, 255], [232, 177, 13, 255]], level=4, unlocked=True)
default ast_bottom_skirt3 = DollCloth("astoria", ("lower body", "skirts"), "bottom", "school_skirt_3", [[103, 90, 108, 255], [232, 177, 13, 255]], level=8, unlocked=True)
default ast_bottom_skirt4 = DollCloth("astoria", ("lower body", "skirts"), "bottom", "school_skirt_4", [[103, 90, 108, 255], [232, 177, 13, 255]], level=12, unlocked=True)
default ast_bottom_skirt1 = DollCloth("astoria", ("lower body", "skirts"), "bottom", "school_skirt_1", ["#675a6cff", "#e8b10dff"], unlocked=True)
default ast_bottom_skirt2 = DollCloth("astoria", ("lower body", "skirts"), "bottom", "school_skirt_2", ["#675a6cff", "#e8b10dff"], level=4, unlocked=True)
default ast_bottom_skirt3 = DollCloth("astoria", ("lower body", "skirts"), "bottom", "school_skirt_3", ["#675a6cff", "#e8b10dff"], level=8, unlocked=True)
default ast_bottom_skirt4 = DollCloth("astoria", ("lower body", "skirts"), "bottom", "school_skirt_4", ["#675a6cff", "#e8b10dff"], level=12, unlocked=True)
default ast_bra_basic1 = DollCloth("astoria", ("upper undergarment", "bras"), "bra", "basic_bra_1", [[213, 62, 65, 255], [234, 236, 234, 255]], unlocked=True)
default ast_bra_basic2 = DollCloth("astoria", ("upper undergarment", "bras"), "bra", "basic_bra_2", [[213, 62, 65, 255]], unlocked=True)
default ast_panties_basic1 = DollCloth("astoria", ("lower undergarment", "panties"), "panties", "basic_panties_1", [[213, 62, 65, 255], [234, 236, 234, 255]], unlocked=True)
default ast_panties_basic2 = DollCloth("astoria", ("lower undergarment", "panties"), "panties", "basic_panties_2", [[213, 62, 65, 255]], unlocked=True)
default ast_bra_basic1 = DollCloth("astoria", ("upper undergarment", "bras"), "bra", "basic_bra_1", ["#d53e41ff", "#eaeceaff"], unlocked=True)
default ast_bra_basic2 = DollCloth("astoria", ("upper undergarment", "bras"), "bra", "basic_bra_2", ["#d53e41ff"], unlocked=True)
default ast_panties_basic1 = DollCloth("astoria", ("lower undergarment", "panties"), "panties", "basic_panties_1", ["#d53e41ff", "#eaeceaff"], unlocked=True)
default ast_panties_basic2 = DollCloth("astoria", ("lower undergarment", "panties"), "panties", "basic_panties_2", ["#d53e41ff"], unlocked=True)
default ast_outfit_default = DollOutfit([ast_hair_base, ast_top_school1, ast_bottom_skirt1, ast_bra_basic1, ast_panties_basic1], unlocked=True)
default ast_outfit_last = DollOutfit([ast_hair_base], hidden=True)
@ -42,12 +42,12 @@ default ast_outfit_last = DollOutfit([ast_hair_base], hidden=True)
## Ann Outfit ##
################
default ast_hair_ann = DollCloth("astoria", ("head", "hair"), "hair", "ann_takamaki", [[229, 198, 129, 255], [163, 125, 80, 255], [255, 209, 105, 255]])
default ast_hat_ann = DollClothDynamic("astoria", ("head", "headgear"), "headgear", "ann_takamaki", [[173, 18, 18, 255], [238, 188, 187, 255]], level=14, tracking="?hair")
default ast_top_ann = DollCloth("astoria", ("upper body", "other"), "top", "ann_takamaki", [[173, 18, 18, 255], [232, 232, 232, 255], [238, 188, 187, 255]], level=14, blacklist=("bottom", "bra", "garterbelt"))
default ast_stockings_ann = DollCloth("astoria", ("legwear", "stockings"), "stockings", "ann_takamaki", [[99, 42, 42, 255], [181, 135, 135, 255]], level=14, blacklist=["bottom"])
default ast_gloves_ann = DollCloth("astoria", ("upper body", "gloves"), "gloves", "ann_takamaki", [[249, 139, 225, 255]])
default ast_buttplug_ann = DollCloth("astoria", ("misc", "accessory"), "accessory", "ann_takamaki", [[99, 42, 42, 255], [181, 135, 135, 255]], level=14, zorder=-1)
default ast_hair_ann = DollCloth("astoria", ("head", "hair"), "hair", "ann_takamaki", ["#e5c681ff", "#a37d50ff", "#ffd169ff"])
default ast_hat_ann = DollClothDynamic("astoria", ("head", "headgear"), "headgear", "ann_takamaki", ["#ad1212ff", "#eebcbbff"], level=14, tracking="?hair")
default ast_top_ann = DollCloth("astoria", ("upper body", "other"), "top", "ann_takamaki", ["#ad1212ff", "#e8e8e8ff", "#eebcbbff"], level=14, blacklist=("bottom", "bra", "garterbelt"))
default ast_stockings_ann = DollCloth("astoria", ("legwear", "stockings"), "stockings", "ann_takamaki", ["#632a2aff", "#b58787ff"], level=14, blacklist=["bottom"])
default ast_gloves_ann = DollCloth("astoria", ("upper body", "gloves"), "gloves", "ann_takamaki", ["#f98be1ff"])
default ast_buttplug_ann = DollCloth("astoria", ("misc", "accessory"), "accessory", "ann_takamaki", ["#632a2aff", "#b58787ff"], level=14, zorder=-1)
default ast_outfit_ann = DollOutfit([ast_hair_ann, ast_hat_ann, ast_top_ann, ast_stockings_ann, ast_gloves_ann, ast_buttplug_ann, ast_panties_basic1], price=500, name="Ann Costume", desc="Wearing this will make you look like a different persona.")
@ -55,18 +55,18 @@ default ast_outfit_ann = DollOutfit([ast_hair_ann, ast_hat_ann, ast_top_ann, ast
## Pubic Hair ##
################
default ast_pubes_arrow = DollCloth("astoria", ("lower undergarment", "pubes"), "pubes", "arrow", [[229, 198, 129, 255]], unlocked=True)
default ast_pubes_beaver = DollCloth("astoria", ("lower undergarment", "pubes"), "pubes", "beaver", [[229, 198, 129, 255]], unlocked=True)
default ast_pubes_stuble = DollCloth("astoria", ("lower undergarment", "pubes"), "pubes", "stuble", [[139, 107, 69, 255]], unlocked=True)
default ast_pubes_unshaved = DollCloth("astoria", ("lower undergarment", "pubes"), "pubes", "unshaved", [[139, 107, 69, 255]], unlocked=True)
default ast_pubes_arrow = DollCloth("astoria", ("lower undergarment", "pubes"), "pubes", "arrow", ["#e5c681ff"], unlocked=True)
default ast_pubes_beaver = DollCloth("astoria", ("lower undergarment", "pubes"), "pubes", "beaver", ["#e5c681ff"], unlocked=True)
default ast_pubes_stuble = DollCloth("astoria", ("lower undergarment", "pubes"), "pubes", "stuble", ["#8b6b45ff"], unlocked=True)
default ast_pubes_unshaved = DollCloth("astoria", ("lower undergarment", "pubes"), "pubes", "unshaved", ["#8b6b45ff"], unlocked=True)
# Lipstick
default ast_makeup_lipstick = DollMakeup("astoria", ("head", "makeup"), "makeup", "lipstick", [[255, 70, 70, 255]], unlocked=True, tracking="mouth")
default ast_makeup_lipstick = DollMakeup("astoria", ("head", "makeup"), "makeup", "lipstick", ["#ff4646ff"], unlocked=True, tracking="mouth")
##########
## Misc ##
##########
default ast_cloth_pants1 = DollCloth("astoria", ("lower body", "trousers"), "bottom", "pants_1", [[180, 180, 180, 255], [213, 161, 13, 255]], unlocked=True)
default ast_cloth_shorts1 = DollCloth("astoria", ("lower body", "shorts"), "bottom", "pants_1_short", [[180, 180, 180, 255], [213, 161, 13, 255]], level=8, unlocked=True)
default ast_cloth_pantyhose1 = DollCloth("astoria", ("legwear", "pantyhose"), "stockings", "pantyhose", [[190, 146, 129, 255]], unlocked=True)
default ast_cloth_pants1 = DollCloth("astoria", ("lower body", "trousers"), "bottom", "pants_1", ["#b4b4b4ff", "#d5a10dff"], unlocked=True)
default ast_cloth_shorts1 = DollCloth("astoria", ("lower body", "shorts"), "bottom", "pants_1_short", ["#b4b4b4ff", "#d5a10dff"], level=8, unlocked=True)
default ast_cloth_pantyhose1 = DollCloth("astoria", ("legwear", "pantyhose"), "stockings", "pantyhose", ["#be9281ff"], unlocked=True)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -11,16 +11,16 @@ default hoo_body_default = DollOutfit([hoo_frame_default], hidden=True)
## Hair ##
###############
default hoo_hair_base = DollCloth("hooch", ("head", "hair"), "hair", "base", [[125, 72, 42, 255]], unlocked=True)
default hoo_panties_sport = DollCloth("hooch", ("lower undergarment", "panties"), "panties", "sport", [[192, 65, 54, 255], [237, 225, 255, 255]], unlocked=True)
default hoo_bra_sport = DollCloth("hooch", ("upper undergarment", "bras"), "bra", "sport", [[192, 65, 54, 255], [237, 225, 255, 255]], unlocked=True)
default hoo_top_sport = DollCloth("hooch", ("upper body", "shirts"), "top", "sport_shirt", [[237, 225, 255, 255], [139, 104, 192, 255]], unlocked=True)
default hoo_bottom_sport = DollCloth("hooch", ("lower body", "skirts"), "bottom", "sport_trousers", [[139, 104, 192, 255], [237, 225, 255, 255]], unlocked=True)
default hoo_gloves_sport = DollCloth("hooch", ("upper body", "gloves"), "gloves", "sport_gloves", [[78, 72, 115, 255]], unlocked=True)
default hoo_robe_sport = DollCloth("hooch", ("upper body", "robes"), "robe", "sport_robe", [[59, 63, 88, 255], [112, 34, 111, 255], [198, 118, 198, 255]], unlocked=True)
default hoo_headgear_sport = DollCloth("hooch", ("head", "headgear"), "headgear", "sport_goggles", [[96, 134, 145, 255], [154, 98, 50, 255], [49, 60, 91, 255]], unlocked=True)
default hoo_accessory_broom = DollCloth("hooch", ("misc", "accessory"), "accessory", "broom", [[144, 83, 64, 255], [121, 87, 71, 255], [163, 159, 112, 255]], unlocked=True, zorder=300)
default hoo_accessory_broom_dildo = DollCloth("hooch", ("misc", "accessory"), "accessory", "broom_dildo", [[144, 83, 64, 255], [121, 87, 71, 255], [163, 159, 112, 255]], unlocked=True, zorder=300)
default hoo_hair_base = DollCloth("hooch", ("head", "hair"), "hair", "base", ["#7d482aff"], unlocked=True)
default hoo_panties_sport = DollCloth("hooch", ("lower undergarment", "panties"), "panties", "sport", ["#c04136ff", "#ede1ffff"], unlocked=True)
default hoo_bra_sport = DollCloth("hooch", ("upper undergarment", "bras"), "bra", "sport", ["#c04136ff", "#ede1ffff"], unlocked=True)
default hoo_top_sport = DollCloth("hooch", ("upper body", "shirts"), "top", "sport_shirt", ["#ede1ffff", "#8b68c0ff"], unlocked=True)
default hoo_bottom_sport = DollCloth("hooch", ("lower body", "skirts"), "bottom", "sport_trousers", ["#8b68c0ff", "#ede1ffff"], unlocked=True)
default hoo_gloves_sport = DollCloth("hooch", ("upper body", "gloves"), "gloves", "sport_gloves", ["#4e4873ff"], unlocked=True)
default hoo_robe_sport = DollCloth("hooch", ("upper body", "robes"), "robe", "sport_robe", ["#3b3f58ff", "#70226fff", "#c676c6ff"], unlocked=True)
default hoo_headgear_sport = DollCloth("hooch", ("head", "headgear"), "headgear", "sport_goggles", ["#608691ff", "#9a6232ff", "#313c5bff"], unlocked=True)
default hoo_accessory_broom = DollCloth("hooch", ("misc", "accessory"), "accessory", "broom", ["#905340ff", "#795747ff", "#a39f70ff"], unlocked=True, zorder=300)
default hoo_accessory_broom_dildo = DollCloth("hooch", ("misc", "accessory"), "accessory", "broom_dildo", ["#905340ff", "#795747ff", "#a39f70ff"], unlocked=True, zorder=300)
default hoo_outfit_default = DollOutfit([hoo_hair_base, hoo_panties_sport, hoo_bra_sport, hoo_top_sport, hoo_bottom_sport, hoo_gloves_sport, hoo_robe_sport, hoo_headgear_sport, hoo_accessory_broom], unlocked=True)
default hoo_outfit_last = DollOutfit([hoo_hair_base, hoo_panties_sport, hoo_bra_sport, hoo_top_sport, hoo_bottom_sport, hoo_gloves_sport, hoo_robe_sport, hoo_headgear_sport, hoo_accessory_broom], hidden=True)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@ init python:
self.categories = categories
self.type = type
self.id = id
self.color = color
self.color = [Color( (tuple(x) if isinstance(x, list) else x) ) for x in color] if color else None
self.unlocked = unlocked
self.level = level
self.blacklist = blacklist
@ -28,7 +28,7 @@ init python:
self.parent = parent
self.char = eval(name)
self.color_default = [x[:] for x in color] if color else None
self.color_default = [x for x in self.color] if self.color else None
self.zorder = zorder or self.char.states[type][1]
self.seen = self.unlocked
self._hash = self.generate_hash()
@ -197,14 +197,14 @@ init python:
def apply_color(self, img, n):
"""Takes image and int layer number. Used internally."""
c = TintMatrix(tuple(self.color[n]))
c = TintMatrix(self.color[n])
return Transform(img, matrixcolor=c)
def set_color(self, n):
"""Takes int layer number for manual color picking or a list to replace the cloth color in its entirety."""
if isinstance(n, int):
col = Color(tuple(self.color[n]))
dcol = Color(tuple(self.color_default[n]))
col = self.color[n]
dcol = self.color_default[n]
cp.live_replace(col)
cp.start_replace(col)
@ -213,21 +213,25 @@ init python:
renpy.show_screen("colorpickerscreen", self)
while True:
action, value = ui.interact()
try:
action, value = ui.interact()
except:
print(f"{ui.interact()}")
break
if action == "layer":
n = value
col = Color(tuple(self.color[value]))
dcol = Color(tuple(self.color_default[n]))
col = self.color[value]
dcol = self.color_default[value]
cp.live_replace(col)
cp.start_replace(col)
cp.default_replace(dcol)
elif action == "released":
self.color[n] = [int(255*x) for x in value.rgba]
self.color[n] = value
self.is_stale()
elif action == "replace":
self.color[n] = [int(255*x) for x in value.rgba]
self.color[n] = value
cp.live_replace(value)
self.is_stale()
elif action == "finish":
@ -235,22 +239,22 @@ init python:
renpy.hide_screen("colorpickerscreen")
elif isinstance(n, list):
self.color = [x[:] for x in n]
self.color = [Color( (tuple(x) if isinstance(x, list) else x) ) for x in n]
self.is_stale()
def reset_color(self, n=None):
"""Reset cloth color. Takes optional int layer number to reset only specific layer color."""
if n:
self.color[n] = [x for x in self.color_default]
self.color[n] = self.color_default[n]
else:
self.color = [x[:] for x in self.color_default]
self.color = [x for x in self.color_default]
self.is_stale()
def clone(self):
"""Creates a clone of this cloth object. Since it requires a parent object it should be used internally only to avoid object depth issue."""
if self.parent:
return self
return DollCloth(self.name, self.categories, self.type, self.id, [x[:] for x in self.color] if self.color else None, self.zorder, self.unlocked, self.level, self.blacklist, self.modpath, self)
return DollCloth(self.name, self.categories, self.type, self.id, [x for x in self.color] if self.color else None, self.zorder, self.unlocked, self.level, self.blacklist, self.modpath, self)
def is_modded(self):
"""Returns True if item comes from a mod."""

View File

@ -185,4 +185,4 @@ init python:
"""Creates a clone of this cloth object. Since it requires a parent object it should be used internally only to avoid object depth issue."""
if self.parent:
return self
return DollClothDynamic(self.name, self.categories, self.type, self.id, [x[:] for x in self.color] if self.color else None, self.zorder, self.unlocked, self.level, self.blacklist, self.modpath, self._tracking, self)
return DollClothDynamic(self.name, self.categories, self.type, self.id, [x for x in self.color] if self.color else None, self.zorder, self.unlocked, self.level, self.blacklist, self.modpath, self._tracking, self)

View File

@ -12,8 +12,8 @@ default currentpage = 0
# Rules(Shown Cards, Sudden Death, Reverse, Dobelt_number)
default standard_rules = [0, False, False, False]
default playercolor_rgb = (51, 92, 147, 255)
default enemycolor_rgb = (116, 0, 0, 255)
default playercolor_rgb = Color((51, 92, 147, 255))
default enemycolor_rgb = Color((116, 0, 0, 255))
default geniecard_level = 1
default tokens = 0

View File

@ -172,8 +172,8 @@ screen deck_builder_gallery():
label color_change:
python:
playercolor_rgb = tuple(color_picker(list(playercolor_rgb), False, "Player border"))
enemycolor_rgb = tuple(color_picker(list(enemycolor_rgb), False, "Enemy border"))
playercolor_rgb = tuple(color_picker(playercolor_rgb), False, "Player border")
enemycolor_rgb = tuple(color_picker(enemycolor_rgb), False, "Enemy border")
jump deck_builder

View File

@ -324,16 +324,13 @@ init python:
class ColorPicker(NoRollback):
def __init__(self, start_color=(255, 255, 0, 255), default_color=(255, 0, 0, 255)):
col = Color(tuple(start_color))
self.live_color = col
self.start_color = col
default_color = Color(tuple(default_color))
def __init__(self, start_color=Color("#fff"), default_color=Color("#fff")):
self.live_color = start_color
self.start_color = start_color
self.default_color = default_color
self.hue, self.saturation, self.value = col.hsv
self.alpha = col.alpha
self.hue, self.saturation, self.value = start_color.hsv
self.alpha = start_color.alpha
self.cph = ColorPickerHue(self)
self.cpsv = ColorPickerSatVal(self)
@ -341,8 +338,8 @@ init python:
self.cpa = ColorPickerAlpha(self)
self.focus = None
h, s, v = col.hsv
a = col.alpha
h, s, v = start_color.hsv
a = start_color.alpha
self.cph.pos = (0, 255 * h)
self.cpsv.pos = (255 * s, 255 * (1- v))
self.cpa.pos = (255 * (1 - a), 0)
@ -418,7 +415,7 @@ screen colorpickerscreen(item=None):
has vbox
if item:
$ layers = [Color(tuple(i)) for i in item.color]
$ layers = item.color
label "Layers" xalign 0.0