/** * Copyright 2023 Google LLC * * 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 type RGBAColor = [number, number, number, number]; export type RGBColor = [number, number, number]; export type LABColor = [number, number, number]; /** * Parses the given css color-value and returns it as `RGBAColor` (r/g/b in * range [0..255] a in range [0..1]). * * Color values are parsed using a fast-path for hex- and rgb-colors and a * hidden dom-element and `getComputedStyle()` to get the rgb-values for any * other valid css color-value including css custom-properties. Since computing * the color-values this way can be expensive, the values for those more complex * formats are cached. * * @param color */ export declare function parseCssColorValue(color: string): RGBAColor; /** * Converts a color-value in array-format into a rgb/rgba-string. * * @param rgb */ export declare function rgbaToString(rgb: RGBColor | RGBAColor): string; /** * Computes the relative luminance of the specified color-value (range [0..1]). * See http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef */ export declare function luminance(rgb: RGBColor | RGBAColor): number; /** * Darkens the given color by the amount specified. An amount of 1 is roughly * one step in the material design palette. * * @param rgb * @param amount */ export declare function darken(rgb: RGBColor, amount?: number): RGBColor; export declare function darken(rgba: RGBAColor, amount?: number): RGBAColor; /** * Brightens the given color by the amount specified. An amount of 1 is roughly * one step in the material design palette. * * @param rgb * @param amount */ export declare function brighten(rgb: RGBColor, amount?: number): RGBColor; export declare function brighten(rgba: RGBAColor, amount?: number): RGBAColor;