<% function getBadgeColor(level) { if (level <= 5) { return { color: 'bg-green-100…
- User
<% function getBadgeColor(level) { if (level <= 5) { return { color: 'bg-green-100 text-green-800 border-green-400 dark:bg-gray-700 dark:text-green-400', icon: 'fa-leaf' }; } else if (level <= 10) { return { color: 'bg-yellow-100 text-yellow-800 border-yellow-300 dark:bg-gray-700 dark:text-yellow-300', icon: 'fa-seedling' }; } else if (level <= 15) { return { color: 'bg-indigo-100 text-indigo-800 border-indigo-400 dark:bg-gray-700 dark:text-indigo-400', icon: 'fa-tree' }; } else if (level <= 20) { return { color: 'bg-purple-100 text-purple-800 border-purple-400 dark:bg-gray-700 dark:text-purple-400', icon: 'fa-mountain' }; } else if (level <= 25) { return { color: 'bg-red-100 text-red-800 border-red-400 dark:bg-gray-700 dark:text-red-400', icon: 'fa-globe-americas' }; } else if (level <= 30) { return { color: 'bg-yellow-200 text-yellow-800 border-yellow-400 dark:bg-gray-700 dark:text-yellow-400', icon: 'fa-moon' }; } else if (level <= 35) { return { color: 'bg-green-200 text-green-800 border-green-500 dark:bg-gray-700 dark:text-green-500', icon: 'fa-star' }; } else if (level <= 40) { return { color: 'bg-blue-200 text-blue-800 border-blue-500 dark:bg-gray-700 dark:text-blue-500', icon: 'fa-rocket' }; } else if (level <= 45) { return { color: 'bg-indigo-200 text-indigo-800 border-indigo-500 dark:bg-gray-700 dark:text-indigo-500', icon: 'fa-galactic-republic' }; } else if (level <= 50) { return { color: 'bg-pink-200 text-pink-800 border-pink-500 dark:bg-gray-700 dark:text-pink-500', icon: 'fa-dragon' }; } else { return { color: 'bg-gray-200 text-gray-800 border-gray-500 dark:bg-gray-700 dark:text-gray-500', icon: 'fa-crown' }; } } %>
Assistant
This is a function that takes a level as an argument and returns an object with three properties:
color,icon, anddark. Thecolorproperty is a CSS color string that represents the background color of the badge, and theiconproperty is a Font Awesome icon that represents the level. Thedarkproperty is a boolean that indicates whether the badge should use a dark or light background color.Here's a breakdown of the function:
- If the level is less than or equal to 5, the function returns an object with the following properties:
color:'bg-green-100 text-green-800 border-green-400 dark:bg-gray-700 dark:text-green-400', which is a green background color with a dark green text color and a green border. Thedarkproperty is set totrue.icon:'fa-leaf', which is a Font Awesome icon representing a leaf.
- If the level is greater than 5 and less than or equal to 10, the function returns an object with the following properties:
color:'bg-yellow-100 text-yellow-800 border-yellow-300 dark:bg-gray-700 dark:text-yellow-300', which is a yellow background color with a dark yellow text color and a yellow border. Thedarkproperty is set totrue.icon:'fa-seedling', which is a Font Awesome icon representing a seedling.
- If the level is greater than 10 and less than or equal to 15, the function returns an object with the following properties:
color:'bg-indigo-100 text-indigo-800 border-indigo-400 dark:bg-gray-700 dark:text-indigo-400', which is an indigo background color with a dark indigo text color and an indigo border. Thedarkproperty is set totrue.icon:'fa-tree', which is a Font Awesome icon representing a tree.
- If the level is greater than 15 and less than or equal to
- If the level is less than or equal to 5, the function returns an object with the following properties:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.