I am working on a JavaScript exercise where I want to create a function that produces an icon output using FontAwesome. While I have managed to display the icon and message, I am struggling to incorporate my custom styles for titles, emphasis, etc., using a function. I have attempted to use Switch, but it simply copies CSS as a string without applying it.
function generateIcon(ico_name, text, style ){
switch(ico_name) {
case 'user':
ico_name = '%c '
font = 'font-family: "Font Awesome 5 Free"; font-weight: 900; font-size: 20px; content: "\f434";'
break
}
switch(style) {
case 'title':
text = 'color: red'
break
}
console.log(ico_name, font, text)
}
generateIcon('user', 'player', 'title')