Skip to content

Instantly share code, notes, and snippets.

@quincynyan
Last active April 12, 2023 15:38
Show Gist options
  • Save quincynyan/eb80fb416462be5ddcc1d7865aba62c4 to your computer and use it in GitHub Desktop.
Save quincynyan/eb80fb416462be5ddcc1d7865aba62c4 to your computer and use it in GitHub Desktop.
CSS for Discord mention/tag
/* Use
<span
class="mention wrapper-1ZcZW- interactive"
aria-expanded="false"
role="button"
>
@ExampleUsername
</span>
*/
.mention {
border-radius: 3px;
padding: 0 2px;
}
.interactive {
-webkit-transition: background-color 50ms ease-out, color 50ms ease-out;
transition: background-color 50ms ease-out, color 50ms ease-out;
cursor: pointer;
}
.wrapper-1ZcZW- {
border-radius: 3px;
padding: 0 2px;
font-weight: 500;
unicode-bidi: -moz-plaintext;
unicode-bidi: plaintext;
color: 235 calc(1 * 86.2%) 88.6%;
background: hsl(235 calc(1 * 85.6%) 64.7%/0.3);
}
.mention.interactive:hover {
text-decoration: underline;
}
.interactive:hover {
color: hsl(0 calc(1 * 0%) 100%/1);
background-color: hsl(235 calc(1 * 85.6%) 64.7%/1);
}
.mention {
border-radius: 3px;
padding: 0 2px;
}
.interactive {
-webkit-transition: background-color 50ms ease-out, color 50ms ease-out;
transition: background-color 50ms ease-out, color 50ms ease-out;
cursor: pointer;
}
.wrapper-1ZcZW- {
font-weight: 500;
unicode-bidi: plaintext;
background: hsl(235 calc(1 * 85.6%) 64.7%/0.3);
}
@quincynyan
Copy link
Author

quincynyan commented Apr 12, 2023

Better version:

<span class="discord-tag" aria-expanded="false" role="button">@username</span>
.discord-tag {
	border-radius: 3px;
	padding: 0 2px;
	-webkit-transition: background-color 50ms ease-out, color 50ms ease-out;
	transition: background-color 50ms ease-out, color 50ms ease-out;
	cursor: pointer;
	font-weight: 500;
	unicode-bidi: -moz-plaintext;
	unicode-bidi: plaintext;
	color: 235 calc(1 * 86.2%) 88.6%;
	background: hsl(235 calc(1 * 85.6%) 64.7%/0.3);
}

.discord-tag:hover {
	text-decoration: underline;
	color: hsl(0 calc(1 * 0%) 100%/1);
	background-color: hsl(235 calc(1 * 85.6%) 64.7%/1);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment