From 034489f2338d524e394d121e02f45f7f2f4c46b0 Mon Sep 17 00:00:00 2001
From: mat <github@matdoes.dev>
Date: Sun, 20 Mar 2022 23:52:49 -0500
Subject: Grayscale heads for members who left a coop

---
 src/lib/minecraft/Username.svelte | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

(limited to 'src/lib/minecraft/Username.svelte')

diff --git a/src/lib/minecraft/Username.svelte b/src/lib/minecraft/Username.svelte
index 54c803e..df9e093 100644
--- a/src/lib/minecraft/Username.svelte
+++ b/src/lib/minecraft/Username.svelte
@@ -9,8 +9,8 @@
 	export let hyperlinkToProfile = false
 	export let prefix = false
 
-	/** whether the username should be crossed out */
-	export let strikethrough = false
+	/** whether the username should be crossed out and the avatar grayscaled */
+	export let disabled = false
 </script>
 
 <!-- {%- macro username(player, headType=none, hyperlinkToProfile=false, prefix=false) -%}
@@ -25,15 +25,15 @@
 
 <ConditionalLink href="/player/{player.username}" isWrapped={hyperlinkToProfile}>
 	{#if headType == '3d'}
-		<Head3d {player} isPartOfUsername={true} />{:else if headType == '2d'}
-		<Head2d {player} isPartOfUsername={true} />
+		<span class="head" class:grayscale={disabled}><Head3d {player} isPartOfUsername={true} /></span
+		>{:else if headType == '2d'}
+		<span class="head" class:grayscale={disabled}><Head2d {player} isPartOfUsername={true} /></span>
 	{/if}{#if prefix}
 		<span class="username-rank-prefix">
 			{@html formattingCodeToHtml(player.rank.colored)}
 		</span>
 	{/if}<span class="username" style="color: {player.rank.color}">
-		{#if strikethrough}<span class="strikethrough" />{/if}
-		{player.username}
+		{#if disabled}<span class="strikethrough" />{/if}{player.username}
 	</span>
 </ConditionalLink>
 
@@ -58,6 +58,9 @@
 		width: auto;
 		border-bottom: 2px solid #fff;
 	}
+	.grayscale {
+		filter: grayscale(100%);
+	}
 
 	.username-rank-prefix {
 		font-family: Minecraft, 'Atkinson Hyperlegible', sans-serif;
-- 
cgit 

