From 95bed34fb568dc00d5e4177d85d0afcf3388a86b Mon Sep 17 00:00:00 2001 From: kitt Date: Wed, 22 Nov 2023 03:45:19 -0500 Subject: [PATCH] better random color things --- splatnet_assets/templatetags/mask_id.py | 11 +++++++++++ users/templates/users/includes/battle-card.html | 2 ++ 2 files changed, 13 insertions(+) diff --git a/splatnet_assets/templatetags/mask_id.py b/splatnet_assets/templatetags/mask_id.py index a165157c..381679a0 100644 --- a/splatnet_assets/templatetags/mask_id.py +++ b/splatnet_assets/templatetags/mask_id.py @@ -18,11 +18,22 @@ def mask_id(weapon_object: SubWeapon | SpecialWeapon): random_color_options = [ Color.from_hex("cd43a6"), + Color.from_hex("e1820d"), + Color.from_hex("31c4a9"), + Color.from_hex("cdcd34"), + Color.from_hex("94c921"), + Color.from_hex("3a28c4"), + Color.from_hex("4e4edd"), + Color.from_hex("0d0ddc"), + Color.from_hex("b62ea7"), + Color.from_hex("5dab21"), ] @register.simple_tag(takes_context=True) def get_color(context, uploader: User, use_random_color: bool): + if context.get('color'): + return '' user = context.get('user') if uploader.sponsor_tiers[SponsorshipTiers.SPONSOR]: context['color'] = uploader.favorite_color diff --git a/users/templates/users/includes/battle-card.html b/users/templates/users/includes/battle-card.html index 12487b9d..2c96ad62 100644 --- a/users/templates/users/includes/battle-card.html +++ b/users/templates/users/includes/battle-card.html @@ -1,3 +1,4 @@ +{% load mask_id %} {% load static %} @@ -39,6 +40,7 @@ {% with player=battle.player %} {{ player.weapon.name.string }} + {% get_color uploader use_random_color %} {% include "splatnet_assets/mask_image.html" with object=player.weapon.sub class="inline h-6 w-6" uploader=battle.uploader image_params="height=48&width=48" %} {% include "splatnet_assets/mask_image.html" with object=player.weapon.special class="inline h-6 w-6" uploader=battle.uploader image_params="height=48&width=48" %} {% endwith %}