Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the nickname color #205

Merged
merged 1 commit into from
Sep 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions js/addMemberList.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function addMemberList(guild) {
// name = `${name.substring(0, 15)}...`
// }
username.innerText = name;
username.style.color = m.displayHexColor || '#8E9297';
username.style.color = m.roles.color && m.roles.color.hexColor || '#8E9297';
userDiv.appendChild(username);
});
}
Expand Down Expand Up @@ -139,8 +139,7 @@ function addMemberList(guild) {
let username = document.createElement('p');
username.classList.add('mLUsername');
username.innerText = m.nickname || m.user.username;
username.style.color =
m.displayColor == 0 ? '#8E9297' : m.displayHexColor;
username.style.color = m.roles.color && m.roles.color.hexColor || '#8E9297';
userDiv.appendChild(username);
});
}
Expand Down Expand Up @@ -193,8 +192,7 @@ function addMemberList(guild) {
let username = document.createElement('p');
username.classList.add('mLUsername');
username.innerText = m.displayName || m.user.username;
username.style.color =
m.displayColor == 0 ? '#8E9297' : m.displayHexColor;
username.style.color = m.roles.color && m.roles.color.hexColor || '#8E9297';
userDiv.appendChild(username);
});
}
Expand Down Expand Up @@ -255,8 +253,7 @@ function addMemberList(guild) {
let username = document.createElement('p');
username.classList.add('mLUsername');
username.innerText = m.displayName || m.user.username;
username.style.color =
m.displayColor == 0 ? '#8E9297' : m.displayHexColor;
username.style.color = m.roles.color && m.roles.color.hexColor || '#8E9297';
userDiv.appendChild(username);
});
}
Expand Down
15 changes: 4 additions & 11 deletions js/messageGeneration.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,10 @@ function generateMsgHTML(
name.classList.add('messageUsername');

// Find the colour of their name
if (m.member && m.member.roles._roles.size > 1) {
let color;

// Use the heighest role for their color (Since the hoist role is just the one that displays, not the one that determines the color)
// Display the role as white if it's black
color = m.member.displayHexColor;

name.style.color = color;
} else {
name.style.color = '#fff';
}
// Use the highest role for their color
name.style.color =
m.member && (m.member.roles.color && m.member.roles.color.hexColor) ||
'#fff';

darkBG.appendChild(name);

Expand Down