UNPKG

matterbridge

Version:
117 lines 3.84 kB
/** * This file contains the color utilities. * * @file colorUtils.ts * @author Luca Liguori * @created 2023-10-05 * @version 1.3.0 * @license Apache-2.0 * * Copyright 2023, 2024, 2025 Luca Liguori. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ export interface RGB { r: number; g: number; b: number; } export interface XY { x: number; y: number; } export interface HSL { h: number; s: number; l: number; } /** * Converts from HSL to RGB color space * * @param {number} hue - The hue value (0-360). * @param {number} saturation - The saturation value (0-100). * @param {number} luminance - The luminance value (0-100). * @returns {RGB} An object containing the RGB values. */ export declare function hslColorToRgbColor(hue: number, saturation: number, luminance: number): RGB; /** * Converts RGB color space to CIE 1931 XY color space * * @param {RGB} rgb - The RGB color object. * @returns {XY} An object containing the x and y values in CIE 1931 XY color space. */ export declare function rgbColorToXYColor(rgb: RGB): XY; /** * Converts CIE 1931 XY color space to RGB color space * * @param {number} x - The x value in CIE 1931 XY color space. * @param {number} y - The y value in CIE 1931 XY color space. * @param {number} [brightness] - The brightness value (1-254). Defaults to 254. * @returns {RGB} An object containing the RGB values. */ export declare function xyColorToRgbColor(x: number, y: number, brightness?: number): RGB; /** * Converts RGB color space to HSL color space * * @param {RGB} rgb - The RGB color object. * @returns {HSL} An object containing the HSL values. */ export declare function rgbColorToHslColor(rgb: RGB): HSL; /** * Converts CIE 1931 XY color space to HSL color space * * @param {number} x - The x value in CIE 1931 XY color space. * @param {number} y - The y value in CIE 1931 XY color space. * @returns {HSL} An object containing the HSL values. */ export declare function xyToHsl(x: number, y: number): HSL; /** * Converts mireds to kelvin. * * @param {number} mired - The mired value to convert. * @returns {number} The converted kelvin value. */ export declare function miredToKelvin(mired: number): number; /** * Converts kelvin to mireds. * * @param {number} kelvin - The kelvin value to convert. * @returns {number} The converted mired value. */ export declare function kelvinToMired(kelvin: number): number; /** * Converts kelvin to RGB color space. * * @param {number} kelvin - The kelvin value to convert (1000K to 40000K). * @returns {RGB} An object containing the RGB values. */ export declare function kelvinToRGB(kelvin: number): RGB; /** * Converts CIE color space to RGB color space * * @param {number} x * @param {number} y * @param {number} brightness - Ranges from 1 to 254 * @returns {Array} Array that contains the color values for red, green and blue * From: https://github.com/usolved/cie-rgb-converter/blob/master/cie_rgb_converter.js */ /** * Converts RGB color space to CIE color space * * @param {number} red * @param {number} green * @param {number} blue * @returns {Array} Array that contains the CIE color values for x and y * From: https://github.com/usolved/cie-rgb-converter/blob/master/cie_rgb_converter.js */ //# sourceMappingURL=colorUtils.d.ts.map