"use strict";
/* Socket Lib - Built with rolldown */
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_primordials_array = require('../primordials/array.js');
const require_colors_palette = require('./palette.js');

//#region src/colors/convert.ts
/**
* @file Color conversion helpers — `isRgbTuple()` narrows a `ColorValue` to the
*   RGB-tuple branch, and `toRgb()` resolves a named color or passes through an
*   existing tuple.
*/
/**
* Type guard to check if a color value is an RGB tuple.
*
* @example
*   ;```typescript
*   isRgbTuple([255, 0, 0]) // true
*   isRgbTuple('red') // false
*   ```
*
* @param value - Color value to check.
*
* @returns `true` if value is an RGB tuple, `false` if it's a color name
*/
function isRgbTuple(value) {
	return require_primordials_array.ArrayIsArray(value);
}
/**
* Convert a color value to RGB tuple format. Named colors are looked up in the
* `colorToRgb` map, RGB tuples are returned as-is.
*
* @example
*   ;```typescript
*   toRgb('red') // [255, 0, 0]
*   toRgb([0, 128, 0]) // [0, 128, 0]
*   ```
*
* @param color - Color name or RGB tuple.
*
* @returns RGB tuple with values 0-255
*/
function toRgb(color) {
	if (isRgbTuple(color)) return color;
	return require_colors_palette.colorToRgb[color];
}

//#endregion
exports.isRgbTuple = isRgbTuple;
exports.toRgb = toRgb;