Skip to content

Add support for displayName formatting#144

Merged
creesch merged 2 commits intomainfrom
support-name-formatting
Jul 28, 2025
Merged

Add support for displayName formatting#144
creesch merged 2 commits intomainfrom
support-name-formatting

Conversation

@danthedaniel
Copy link
Copy Markdown
Member

@danthedaniel danthedaniel commented Jul 26, 2025

Fixes: #143

Screenshot 2025-07-26 at 3 14 16 PM

@danthedaniel danthedaniel requested a review from creesch July 26, 2025 22:13
@danthedaniel danthedaniel force-pushed the support-name-formatting branch from f989ff0 to 51029a7 Compare July 26, 2025 22:29
@danthedaniel
Copy link
Copy Markdown
Member Author

One issue is that the name could be a dark gray and then it would be hard to read.

@creesch
Copy link
Copy Markdown
Collaborator

creesch commented Jul 27, 2025

One issue is that the name could be a dark gray and then it would be hard to read.

The simplest solution would be to have a subtle text-shadow or stroke around nicknames that prevents this. See the examples below. Might need a bit of tweaking but at least it would make usernames legible.

If we want to get a bit more involved, we'd need to calculate the luminance of the color when adding the username to the list and only apply stroke or text shadow to those nicknames that would be too dark.
Not a big fan of this, but it is an option.

Personally I am leaning towards the text-shadow.

css examples

without anything

image

shadow

.player-name {
    text-shadow: -1px -1px 0 rgb(198 198 198 / 10%),
     1px -1px 0 rgb(198 198 198 / 10%),
    -1px  1px 0 rgb(198 198 198 / 10%),
     1px  1px 0 rgb(198 198 198 / 10%);
}
image

stroke

.player-name {
    -webkit-text-stroke: 2px rgb(198 198 198 / 10%);
}
image

@danthedaniel
Copy link
Copy Markdown
Member Author

I'm not sure if it is something we need to address universally. We could have a preference to disable name colors in the sidebar. We already have this problem in the main chat window. I think it will generally be uncommon to see a black or dark gray name in Minecraft as it would be harder to read in game as well.

if (nameSpan) {
nameSpan.textContent = player.playerDisplayName;
nameSpan.replaceChildren(
formatChatMessage(player.playerDisplayName, {}),
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatChatMessage should probably get a new name. It's tough to pick a name because we have formatComponent already as an internal function name.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatMinecraftText I guess, or we just leave it because it mostly does chat messages anyway.

@creesch
Copy link
Copy Markdown
Collaborator

creesch commented Jul 27, 2025

I'm not sure if it is something we need to address universally.

It is okay to say you simply don't like how my mockups look ;)

We already have this problem in the main chat window

There is no reason why we couldn't apply it to all rendered minecraft text. But sure, nothing I am too hung up on.

@danthedaniel danthedaniel force-pushed the support-name-formatting branch from 51029a7 to 4460faa Compare July 27, 2025 19:02
@creesch creesch merged commit 54a6fe4 into main Jul 28, 2025
6 checks passed
@danthedaniel danthedaniel deleted the support-name-formatting branch July 28, 2025 17:08
danthedaniel added a commit that referenced this pull request Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display colors for player names in player list

2 participants