Files
NapCatQQ/.pnpm-store/v3/files/7d/754bd19a4872d1ae58035112a8ee6b27bcacc57c4d894adf2f5ac025a5be635ee544a947cbba78d1b968a7220a4bd7dc6edb0d4a5bdd0a85e464c5a03b0755
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

27 lines
882 B
Plaintext

/**
* Given a series colors, this function will return a `scale(x)` function that
* accepts a percentage as a decimal between 0 and 1 and returns the color at
* that percentage in the scale.
*
* ```js
* const scale = getScale('red', 'yellow', 'green');
* console.log(scale(0)); // rgba(255, 0, 0, 1)
* console.log(scale(0.5)); // rgba(255, 255, 0, 1)
* console.log(scale(1)); // rgba(0, 128, 0, 1)
* ```
*
* If you'd like to limit the domain and range like chroma-js, we recommend
* wrapping scale again.
*
* ```js
* const _scale = getScale('red', 'yellow', 'green');
* const scale = x => _scale(x / 100);
*
* console.log(scale(0)); // rgba(255, 0, 0, 1)
* console.log(scale(50)); // rgba(255, 255, 0, 1)
* console.log(scale(100)); // rgba(0, 128, 0, 1)
* ```
*/
declare function getScale(...colors: string[]): (n: number) => string;
export default getScale;