@w3h/material-color-utilities
Version:
Algorithms and utilities that power the Material Design 3 (M3) color system, including choosing theme colors from images and creating tones of colors; all in a new color space.
56 lines (55 loc) • 1.76 kB
TypeScript
/**
* @license
* Copyright 2021 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.
*/
import { Hct } from '../hct/hct.js';
/**
* A convenience class for retrieving colors that are constant in hue and
* chroma, but vary in tone.
*/
export declare class TonalPalette {
readonly hue: number;
readonly chroma: number;
readonly keyColor: Hct;
private readonly cache;
/**
* @param argb ARGB representation of a color
* @return Tones matching that color's hue and chroma.
*/
static fromInt(argb: number): TonalPalette;
/**
* @param hct Hct
* @return Tones matching that color's hue and chroma.
*/
static fromHct(hct: Hct): TonalPalette;
/**
* @param hue HCT hue
* @param chroma HCT chroma
* @return Tones matching hue and chroma.
*/
static fromHueAndChroma(hue: number, chroma: number): TonalPalette;
private constructor();
/**
* @param tone HCT tone, measured from 0 to 100.
* @return ARGB representation of a color with that tone.
*/
tone(tone: number): number;
/**
* @param tone HCT tone.
* @return HCT representation of a color with that tone.
*/
getHct(tone: number): Hct;
private averageArgb;
}