Skip to content

Commit

Permalink
remove random color from profile icon
Browse files Browse the repository at this point in the history
  • Loading branch information
vinit717 committed Nov 9, 2023
1 parent 31fa381 commit feb851b
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/components/ProfileIcon/ProfileIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,16 @@ import React from 'react';

const ProfileIcon: React.FC<ProfileIconProps> = ({ firstName, lastName, size }) => {
const initials = (firstName[0] + lastName[0]).toUpperCase();
const randomColor = Math.floor(Math.random() * 16777215).toString(16);
const r = parseInt(randomColor.substr(0, 2), 16);
const g = parseInt(randomColor.substr(2, 2), 16);
const b = parseInt(randomColor.substr(4, 2), 16);
const textColor = r * 0.299 + g * 0.587 + b * 0.114 > 186 ? 'black' : 'white';

const styles = {
width: size,
height: size,
borderRadius: '50%',
backgroundColor: '#' + randomColor,
backgroundColor: '#384B6B',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
color: textColor,
color: '#FFFFFF',
fontSize: size / 2,
};

Expand Down

0 comments on commit feb851b

Please sign in to comment.