import iwanthue from "iwanthue";

//#region src/utils/colors.ts
/**
* Color generation utilities using iwanthue library.
*/
const DEFAULT_OPTIONS = {
	seed: "inkeep-context-breakdown",
	quality: 50
};
/**
* Generates N visually distinct colors using iwanthue.
*
* @param count - Number of colors to generate
* @param options - Optional generation settings
* @returns Array of hex color strings
*
* @example
* ```ts
* const colors = generateDistinctColors(5);
* // ['#4a8fd9', '#d94a7a', '#5ad94a', '#d9a14a', '#9a4ad9']
* ```
*/
function generateDistinctColors(count, options) {
	const opts = {
		...DEFAULT_OPTIONS,
		...options
	};
	return iwanthue(count, {
		seed: opts.seed,
		quality: opts.quality
	});
}
/**
* Creates a color map from an array of keys.
*
* @param keys - Array of unique string keys
* @param options - Optional generation settings
* @returns Map of key to hex color
*/
function createColorMap(keys, options) {
	const colors = generateDistinctColors(keys.length, options);
	const colorMap = {};
	for (let i = 0; i < keys.length; i++) colorMap[keys[i]] = colors[i];
	return colorMap;
}

//#endregion
export { createColorMap, generateDistinctColors };