Looking to dynamically change the text color of employee names based on their assigned department in an uploaded roster. The goal is to color-code employees within the same department. Department names are unknown until the spreadsheet upload, but as long as colors are distinct and consistent between departments, any color will do. Colors have been defined as classes but are not currently utilized.
.kelly-vivid-yellow { color: #FFB300; }
.kelly-strong-purple { color: #803E75; }
.kelly-vivid-orange { color: #FF6800; }
.kelly-very-light-blue { color: #A6BDD7; }
.kelly-vivid-red { color: #C10020; }
.kelly-grayish-yellow { color: #CEA262; }
.kelly-medium-gray { color: #817066; }
plus others.
Possible Department Names:
Admin
Grounds
Management
Staff
etc
or
Department One
Department Two
Department Three
etc
Or any other variations.
Considering adding colors to an array like:
kellyColors = ["#FFB300;","#803E75;","#FF6800;","#A6BDD7;" etc]
Then assign colors to departments using arrays and positions:
departments = ["Admin","Grounds","Management","Staff"]
let Admin = kellyColor[0];
let Grounds = kellyColor[1];
etc
Struggling with changing color attributes in a span element used for regex replacement in a JavaScript function>
this.pubmedData[index]["publication"] = this.pubmedData[index]
["publication"].replace(new RegExp(Employee_Name), match => {
return '<span style="color:#803E75;"><b>' + match + '</b></span>';
});
All suggestions welcome!
FYI-- `this.pubmedData[index]["publication"]` holds information where employee names need to be colored. Example:
John Smith and Bob Jones had Friday off.
The task is to color code employee names based on their department affiliation.