// icon_utils - Utility for loading SVG icons
import { app } from "../../../scripts/app.js";
const SVG_ICONS = {
search: ``,
locate: ``,
eye: ``,
eyeOff: ``,
civitai: ``
};
/**
* Generates HTML string for an icon with standardized styling
* @param {Image} icon - The icon Image object (or null)
* @param {string} fallback - Fallback text/emoji if icon is not available (default: '')
* @param {number} size - Size of the icon in pixels (default: 14)
* @param {string} extraStyles - Additional CSS styles (default: 'vertical-align: middle;')
* @returns {string} HTML string for the icon or fallback
*/
export function getIconHtml(icon, fallback = '', size = 14, extraStyles = 'vertical-align: middle;') {
if (!icon) return fallback;
return `
`;
}
/**
* Returns inline SVG markup by icon name.
* @param {string} name - Icon identifier
* @param {string} color - Stroke color placeholder value
* @param {string} className - Optional class name for the svg element
* @returns {string} SVG markup or empty string
*/
export function getSvgIcon(name, color = 'currentColor', className = '') {
const template = SVG_ICONS[name];
if (!template) return '';
let svg = template.replaceAll('{color}', color);
if (className) {
svg = svg.replace('