视频会议上传文件

This commit is contained in:
gyj
2024-04-08 16:23:29 +08:00
parent c098116879
commit a551f33a6e
1272 changed files with 84366 additions and 63430 deletions
+103 -103
View File
@@ -1,103 +1,103 @@
import { AnyColor, RgbaColor, HslaColor, HsvaColor } from "./types";
export declare class Colord {
private readonly parsed;
readonly rgba: RgbaColor;
constructor(input: AnyColor);
/**
* Returns a boolean indicating whether or not an input has been parsed successfully.
* Note: If parsing is unsuccessful, Colord defaults to black (does not throws an error).
*/
isValid(): boolean;
/**
* Returns the brightness of a color (from 0 to 1).
* The calculation logic is modified from WCAG.
* https://www.w3.org/TR/AERT/#color-contrast
*/
brightness(): number;
/**
* Same as calling `brightness() < 0.5`.
*/
isDark(): boolean;
/**
* Same as calling `brightness() >= 0.5`.
* */
isLight(): boolean;
/**
* Returns the hexadecimal representation of a color.
* When the alpha channel value of the color is less than 1,
* it outputs #rrggbbaa format instead of #rrggbb.
*/
toHex(): string;
/**
* Converts a color to RGB color space and returns an object.
* Always includes an alpha value from 0 to 1.
*/
toRgb(): RgbaColor;
/**
* Converts a color to RGB color space and returns a string representation.
* Outputs an alpha value only if it is less than 1.
*/
toRgbString(): string;
/**
* Converts a color to HSL color space and returns an object.
* Always includes an alpha value from 0 to 1.
*/
toHsl(): HslaColor;
/**
* Converts a color to HSL color space and returns a string representation.
* Always includes an alpha value from 0 to 1.
*/
toHslString(): string;
/**
* Converts a color to HSV color space and returns an object.
* Always includes an alpha value from 0 to 1.
*/
toHsv(): HsvaColor;
/**
* Creates a new instance containing an inverted (opposite) version of the color.
*/
invert(): Colord;
/**
* Increases the HSL saturation of a color by the given amount.
*/
saturate(amount?: number): Colord;
/**
* Decreases the HSL saturation of a color by the given amount.
*/
desaturate(amount?: number): Colord;
/**
* Makes a gray color with the same lightness as a source color.
*/
grayscale(): Colord;
/**
* Increases the HSL lightness of a color by the given amount.
*/
lighten(amount?: number): Colord;
/**
* Increases the HSL lightness of a color by the given amount.
*/
darken(amount?: number): Colord;
/**
* Changes the HSL hue of a color by the given amount.
*/
rotate(amount?: number): Colord;
/**
* Allows to get or change an alpha channel value.
*/
alpha(): number;
alpha(value: number): Colord;
/**
* Allows to get or change a hue value.
*/
hue(): number;
hue(value: number): Colord;
/**
* Determines whether two values are the same color.
*/
isEqual(color: AnyColor | Colord): boolean;
}
/**
* Parses the given input color and creates a new `Colord` instance.
* See accepted input formats: https://github.com/omgovich/colord#color-parsing
*/
export declare const colord: (input: AnyColor | Colord) => Colord;
import { AnyColor, RgbaColor, HslaColor, HsvaColor } from "./types";
export declare class Colord {
private readonly parsed;
readonly rgba: RgbaColor;
constructor(input: AnyColor);
/**
* Returns a boolean indicating whether or not an input has been parsed successfully.
* Note: If parsing is unsuccessful, Colord defaults to black (does not throws an error).
*/
isValid(): boolean;
/**
* Returns the brightness of a color (from 0 to 1).
* The calculation logic is modified from WCAG.
* https://www.w3.org/TR/AERT/#color-contrast
*/
brightness(): number;
/**
* Same as calling `brightness() < 0.5`.
*/
isDark(): boolean;
/**
* Same as calling `brightness() >= 0.5`.
* */
isLight(): boolean;
/**
* Returns the hexadecimal representation of a color.
* When the alpha channel value of the color is less than 1,
* it outputs #rrggbbaa format instead of #rrggbb.
*/
toHex(): string;
/**
* Converts a color to RGB color space and returns an object.
* Always includes an alpha value from 0 to 1.
*/
toRgb(): RgbaColor;
/**
* Converts a color to RGB color space and returns a string representation.
* Outputs an alpha value only if it is less than 1.
*/
toRgbString(): string;
/**
* Converts a color to HSL color space and returns an object.
* Always includes an alpha value from 0 to 1.
*/
toHsl(): HslaColor;
/**
* Converts a color to HSL color space and returns a string representation.
* Always includes an alpha value from 0 to 1.
*/
toHslString(): string;
/**
* Converts a color to HSV color space and returns an object.
* Always includes an alpha value from 0 to 1.
*/
toHsv(): HsvaColor;
/**
* Creates a new instance containing an inverted (opposite) version of the color.
*/
invert(): Colord;
/**
* Increases the HSL saturation of a color by the given amount.
*/
saturate(amount?: number): Colord;
/**
* Decreases the HSL saturation of a color by the given amount.
*/
desaturate(amount?: number): Colord;
/**
* Makes a gray color with the same lightness as a source color.
*/
grayscale(): Colord;
/**
* Increases the HSL lightness of a color by the given amount.
*/
lighten(amount?: number): Colord;
/**
* Increases the HSL lightness of a color by the given amount.
*/
darken(amount?: number): Colord;
/**
* Changes the HSL hue of a color by the given amount.
*/
rotate(amount?: number): Colord;
/**
* Allows to get or change an alpha channel value.
*/
alpha(): number;
alpha(value: number): Colord;
/**
* Allows to get or change a hue value.
*/
hue(): number;
hue(value: number): Colord;
/**
* Determines whether two values are the same color.
*/
isEqual(color: AnyColor | Colord): boolean;
}
/**
* Parses the given input color and creates a new `Colord` instance.
* See accepted input formats: https://github.com/omgovich/colord#color-parsing
*/
export declare const colord: (input: AnyColor | Colord) => Colord;
+10 -10
View File
@@ -1,10 +1,10 @@
/**
* We used to work with 2 digits after the decimal point, but it wasn't accurate enough,
* so the library produced colors that were perceived differently.
*/
export declare const ALPHA_PRECISION = 3;
/**
* Valid CSS <angle> units.
* https://developer.mozilla.org/en-US/docs/Web/CSS/angle
*/
export declare const ANGLE_UNITS: Record<string, number>;
/**
* We used to work with 2 digits after the decimal point, but it wasn't accurate enough,
* so the library produced colors that were perceived differently.
*/
export declare const ALPHA_PRECISION = 3;
/**
* Valid CSS <angle> units.
* https://developer.mozilla.org/en-US/docs/Web/CSS/angle
*/
export declare const ANGLE_UNITS: Record<string, number>;
+4 -4
View File
@@ -1,4 +1,4 @@
import { Colord } from "./colord";
import { Parsers } from "./types";
export declare type Plugin = (ColordClass: typeof Colord, parsers: Parsers) => void;
export declare const extend: (plugins: Plugin[]) => void;
import { Colord } from "./colord";
import { Parsers } from "./types";
export declare type Plugin = (ColordClass: typeof Colord, parsers: Parsers) => void;
export declare const extend: (plugins: Plugin[]) => void;
+20 -20
View File
@@ -1,20 +1,20 @@
export declare const isPresent: (value: unknown) => boolean;
export declare const round: (number: number, digits?: number, base?: number) => number;
export declare const floor: (number: number, digits?: number, base?: number) => number;
/**
* Clamps a value between an upper and lower bound.
* We use ternary operators because it makes the minified code
* is 2 times shorter then `Math.min(Math.max(a,b),c)`
* NaN is clamped to the lower bound
*/
export declare const clamp: (number: number, min?: number, max?: number) => number;
/**
* Processes and clamps a degree (angle) value properly.
* Any `NaN` or `Infinity` will be converted to `0`.
* Examples: -1 => 359, 361 => 1
*/
export declare const clampHue: (degrees: number) => number;
/**
* Converts a hue value to degrees from 0 to 360 inclusive.
*/
export declare const parseHue: (value: string, unit?: string) => number;
export declare const isPresent: (value: unknown) => boolean;
export declare const round: (number: number, digits?: number, base?: number) => number;
export declare const floor: (number: number, digits?: number, base?: number) => number;
/**
* Clamps a value between an upper and lower bound.
* We use ternary operators because it makes the minified code
* is 2 times shorter then `Math.min(Math.max(a,b),c)`
* NaN is clamped to the lower bound
*/
export declare const clamp: (number: number, min?: number, max?: number) => number;
/**
* Processes and clamps a degree (angle) value properly.
* Any `NaN` or `Infinity` will be converted to `0`.
* Examples: -1 => 359, 361 => 1
*/
export declare const clampHue: (degrees: number) => number;
/**
* Converts a hue value to degrees from 0 to 360 inclusive.
*/
export declare const parseHue: (value: string, unit?: string) => number;
+5 -5
View File
@@ -1,5 +1,5 @@
export { colord, Colord } from "./colord";
export { extend, Plugin } from "./extend";
export { getFormat } from "./parse";
export { random } from "./random";
export { HslColor, HslaColor, HsvColor, HsvaColor, HwbColor, HwbaColor, LabColor, LabaColor, LchColor, LchaColor, RgbColor, RgbaColor, XyzColor, XyzaColor, AnyColor, } from "./types";
export { colord, Colord } from "./colord";
export { extend, Plugin } from "./extend";
export { getFormat } from "./parse";
export { random } from "./random";
export { HslColor, HslaColor, HsvColor, HsvaColor, HwbColor, HwbaColor, LabColor, LabaColor, LchColor, LchaColor, RgbColor, RgbaColor, XyzColor, XyzaColor, AnyColor, } from "./types";
+119 -79
View File
@@ -1,34 +1,80 @@
{
"name": "colord",
"version": "2.9.3",
"description": "👑 A tiny yet powerful tool for high-performance color manipulations and conversions",
"keywords": [
"color",
"parser",
"convert",
"tiny",
"hex",
"rgb",
"hsl",
"hsv",
"hwb",
"lab",
"lch",
"xyz",
"css",
"color-names",
"a11y",
"cmyk",
"mix",
"minify",
"harmonies"
"_args": [
[
"colord@2.9.3",
"D:\\韩超勃\\视频会议\\Arbitrate-FrontendH5"
]
],
"repository": "omgovich/colord",
"author": "Vlad Shilov <omgovich@ya.ru>",
"license": "MIT",
"sideEffects": false,
"main": "./index.js",
"module": "./index.mjs",
"_development": true,
"_from": "colord@2.9.3",
"_id": "colord@2.9.3",
"_inBundle": false,
"_integrity": "sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==",
"_location": "/colord",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "colord@2.9.3",
"name": "colord",
"escapedName": "colord",
"rawSpec": "2.9.3",
"saveSpec": null,
"fetchSpec": "2.9.3"
},
"_requiredBy": [
"/postcss-colormin",
"/postcss-minify-gradients"
],
"_resolved": "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz",
"_spec": "2.9.3",
"_where": "D:\\韩超勃\\视频会议\\Arbitrate-FrontendH5",
"author": {
"name": "Vlad Shilov",
"email": "omgovich@ya.ru"
},
"bugs": {
"url": "https://github.com/omgovich/colord/issues"
},
"dependencies": {},
"description": "👑 A tiny yet powerful tool for high-performance color manipulations and conversions",
"devDependencies": {
"@size-limit/preset-small-lib": "^4.10.1",
"@types/jest": "^26.0.22",
"@typescript-eslint/eslint-plugin": "^4.19.0",
"@typescript-eslint/parser": "^4.19.0",
"ac-colors": "^1.4.2",
"benny": "^3.6.15",
"chroma-js": "^2.1.1",
"color": "^3.1.3",
"eslint": "^7.14.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-prettier": "^3.1.4",
"glob": "^7.1.6",
"jest": "^26.6.3",
"prettier": "^2.2.0",
"rollup": "^2.43.1",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"size-limit": "^4.10.1",
"tinycolor2": "^1.4.2",
"ts-jest": "^26.5.4",
"ts-node": "^9.1.1",
"tslib": "^2.1.0",
"typescript": "^4.2.3"
},
"eslintConfig": {
"plugins": [
"prettier"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"prettier/@typescript-eslint"
]
},
"exports": {
".": {
"types": "./index.d.ts",
@@ -102,64 +148,56 @@
"*.{js,mjs,ts,map}",
"plugins/*.{js,mjs,ts,map}"
],
"types": "index.d.ts",
"scripts": {
"lint": "eslint src/**/*.ts",
"size": "npm run build && size-limit",
"check-types": "tsc --noEmit true",
"test": "jest tests --coverage",
"benchmark": "tsc --outDir bench --skipLibCheck --esModuleInterop ./tests/benchmark.ts && node ./bench/tests/benchmark.js && rm -rf ./bench",
"build": "rm -rf ./dist/* && rollup --config",
"release": "npm run build && cp *.json dist && cp *.md dist && npm publish dist",
"check-release": "npm run release -- --dry-run"
},
"dependencies": {},
"devDependencies": {
"@size-limit/preset-small-lib": "^4.10.1",
"@types/jest": "^26.0.22",
"@typescript-eslint/eslint-plugin": "^4.19.0",
"@typescript-eslint/parser": "^4.19.0",
"ac-colors": "^1.4.2",
"benny": "^3.6.15",
"chroma-js": "^2.1.1",
"color": "^3.1.3",
"eslint": "^7.14.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-prettier": "^3.1.4",
"glob": "^7.1.6",
"jest": "^26.6.3",
"prettier": "^2.2.0",
"rollup": "^2.43.1",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"size-limit": "^4.10.1",
"tinycolor2": "^1.4.2",
"ts-jest": "^26.5.4",
"ts-node": "^9.1.1",
"tslib": "^2.1.0",
"typescript": "^4.2.3"
},
"homepage": "https://github.com/omgovich/colord#readme",
"jest": {
"verbose": true,
"transform": {
"^.+\\.ts$": "ts-jest"
}
},
"eslintConfig": {
"plugins": [
"prettier"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"prettier/@typescript-eslint"
]
},
"keywords": [
"color",
"parser",
"convert",
"tiny",
"hex",
"rgb",
"hsl",
"hsv",
"hwb",
"lab",
"lch",
"xyz",
"css",
"color-names",
"a11y",
"cmyk",
"mix",
"minify",
"harmonies"
],
"license": "MIT",
"main": "./index.js",
"module": "./index.mjs",
"name": "colord",
"prettier": {
"printWidth": 100
},
"repository": {
"type": "git",
"url": "git+https://github.com/omgovich/colord.git"
},
"scripts": {
"benchmark": "tsc --outDir bench --skipLibCheck --esModuleInterop ./tests/benchmark.ts && node ./bench/tests/benchmark.js && rm -rf ./bench",
"build": "rm -rf ./dist/* && rollup --config",
"check-release": "npm run release -- --dry-run",
"check-types": "tsc --noEmit true",
"lint": "eslint src/**/*.ts",
"release": "npm run build && cp *.json dist && cp *.md dist && npm publish dist",
"size": "npm run build && size-limit",
"test": "jest tests --coverage"
},
"sideEffects": false,
"size-limit": [
{
"path": "dist/index.mjs",
@@ -206,5 +244,7 @@
"path": "dist/plugins/xyz.mjs",
"limit": "1 KB"
}
]
],
"types": "index.d.ts",
"version": "2.9.3"
}
+8 -8
View File
@@ -1,8 +1,8 @@
import { Parsers, ParseResult, Input, Format } from "./types";
export declare const parsers: Parsers;
/** Tries to convert an incoming value into RGBA color by going through all color model parsers */
export declare const parse: (input: Input) => ParseResult | [null, undefined];
/**
* Returns a color model name for the input passed to the function.
*/
export declare const getFormat: (input: Input) => Format | undefined;
import { Parsers, ParseResult, Input, Format } from "./types";
export declare const parsers: Parsers;
/** Tries to convert an incoming value into RGBA color by going through all color model parsers */
export declare const parse: (input: Input) => ParseResult | [null, undefined];
/**
* Returns a color model name for the input passed to the function.
*/
export declare const getFormat: (input: Input) => Format | undefined;
+38 -38
View File
@@ -1,38 +1,38 @@
import { AnyColor } from "../types";
import { Plugin } from "../extend";
interface ReadabilityOptions {
level?: "AA" | "AAA";
size?: "normal" | "large";
}
declare module "../colord" {
interface Colord {
/**
* Returns the relative luminance of a color,
* normalized to 0 for darkest black and 1 for lightest white.
* https://www.w3.org/TR/WCAG20/#relativeluminancedef
* https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_Colors_and_Luminance
*/
luminance(): number;
/**
* Calculates a contrast ratio for a color pair.
* This luminance difference is expressed as a ratio ranging
* from 1 (e.g. white on white) to 21 (e.g., black on a white).
* WCAG requires a ratio of at least 4.5 for normal text and 3 for large text.
* https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html
* https://webaim.org/articles/contrast/
*/
contrast(color2?: AnyColor | Colord): number;
/**
* Checks that a background and text color pair conforms to WCAG 2.0 requirements.
* https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html
*/
isReadable(color2?: AnyColor | Colord, options?: ReadabilityOptions): boolean;
}
}
/**
* A plugin adding accessibility and color contrast utilities.
* Follows Web Content Accessibility Guidelines 2.0.
* https://www.w3.org/TR/WCAG20/
*/
declare const a11yPlugin: Plugin;
export default a11yPlugin;
import { AnyColor } from "../types";
import { Plugin } from "../extend";
interface ReadabilityOptions {
level?: "AA" | "AAA";
size?: "normal" | "large";
}
declare module "../colord" {
interface Colord {
/**
* Returns the relative luminance of a color,
* normalized to 0 for darkest black and 1 for lightest white.
* https://www.w3.org/TR/WCAG20/#relativeluminancedef
* https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_Colors_and_Luminance
*/
luminance(): number;
/**
* Calculates a contrast ratio for a color pair.
* This luminance difference is expressed as a ratio ranging
* from 1 (e.g. white on white) to 21 (e.g., black on a white).
* WCAG requires a ratio of at least 4.5 for normal text and 3 for large text.
* https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html
* https://webaim.org/articles/contrast/
*/
contrast(color2?: AnyColor | Colord): number;
/**
* Checks that a background and text color pair conforms to WCAG 2.0 requirements.
* https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html
*/
isReadable(color2?: AnyColor | Colord, options?: ReadabilityOptions): boolean;
}
}
/**
* A plugin adding accessibility and color contrast utilities.
* Follows Web Content Accessibility Guidelines 2.0.
* https://www.w3.org/TR/WCAG20/
*/
declare const a11yPlugin: Plugin;
export default a11yPlugin;
+24 -24
View File
@@ -1,24 +1,24 @@
import { CmykaColor } from "../types";
import { Plugin } from "../extend";
declare module "../colord" {
interface Colord {
/**
* Converts a color to CMYK color space and returns an object.
* https://drafts.csswg.org/css-color/#cmyk-colors
* https://lea.verou.me/2009/03/cmyk-colors-in-css-useful-or-useless/
*/
toCmyk(): CmykaColor;
/**
* Converts a color to CMYK color space and returns a string.
* https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/device-cmyk()
*/
toCmykString(): string;
}
}
/**
* A plugin adding support for CMYK color space.
* https://lea.verou.me/2009/03/cmyk-colors-in-css-useful-or-useless/
* https://en.wikipedia.org/wiki/CMYK_color_model
*/
declare const cmykPlugin: Plugin;
export default cmykPlugin;
import { CmykaColor } from "../types";
import { Plugin } from "../extend";
declare module "../colord" {
interface Colord {
/**
* Converts a color to CMYK color space and returns an object.
* https://drafts.csswg.org/css-color/#cmyk-colors
* https://lea.verou.me/2009/03/cmyk-colors-in-css-useful-or-useless/
*/
toCmyk(): CmykaColor;
/**
* Converts a color to CMYK color space and returns a string.
* https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/device-cmyk()
*/
toCmykString(): string;
}
}
/**
* A plugin adding support for CMYK color space.
* https://lea.verou.me/2009/03/cmyk-colors-in-css-useful-or-useless/
* https://en.wikipedia.org/wiki/CMYK_color_model
*/
declare const cmykPlugin: Plugin;
export default cmykPlugin;
+16 -16
View File
@@ -1,16 +1,16 @@
import { Plugin } from "../extend";
export declare type HarmonyType = "analogous" | "complementary" | "double-split-complementary" | "rectangle" | "split-complementary" | "tetradic" | "triadic";
declare module "../colord" {
interface Colord {
/**
* Returns an array of harmony colors as `Colord` instances.
*/
harmonies(type?: HarmonyType): Colord[];
}
}
/**
* A plugin adding functionality to generate harmony colors.
* https://en.wikipedia.org/wiki/Harmony_(color)
*/
declare const harmoniesPlugin: Plugin;
export default harmoniesPlugin;
import { Plugin } from "../extend";
export declare type HarmonyType = "analogous" | "complementary" | "double-split-complementary" | "rectangle" | "split-complementary" | "tetradic" | "triadic";
declare module "../colord" {
interface Colord {
/**
* Returns an array of harmony colors as `Colord` instances.
*/
harmonies(type?: HarmonyType): Colord[];
}
}
/**
* A plugin adding functionality to generate harmony colors.
* https://en.wikipedia.org/wiki/Harmony_(color)
*/
declare const harmoniesPlugin: Plugin;
export default harmoniesPlugin;
+23 -23
View File
@@ -1,23 +1,23 @@
import { HwbaColor } from "../types";
import { Plugin } from "../extend";
declare module "../colord" {
interface Colord {
/**
* Converts a color to HWB (Hue-Whiteness-Blackness) color space and returns an object.
* https://en.wikipedia.org/wiki/HWB_color_model
*/
toHwb(): HwbaColor;
/**
* Converts a color to HWB (Hue-Whiteness-Blackness) color space and returns a string.
* https://www.w3.org/TR/css-color-4/#the-hwb-notation
*/
toHwbString(): string;
}
}
/**
* A plugin adding support for HWB (Hue-Whiteness-Blackness) color model.
* https://en.wikipedia.org/wiki/HWB_color_model
* https://www.w3.org/TR/css-color-4/#the-hwb-notation
*/
declare const hwbPlugin: Plugin;
export default hwbPlugin;
import { HwbaColor } from "../types";
import { Plugin } from "../extend";
declare module "../colord" {
interface Colord {
/**
* Converts a color to HWB (Hue-Whiteness-Blackness) color space and returns an object.
* https://en.wikipedia.org/wiki/HWB_color_model
*/
toHwb(): HwbaColor;
/**
* Converts a color to HWB (Hue-Whiteness-Blackness) color space and returns a string.
* https://www.w3.org/TR/css-color-4/#the-hwb-notation
*/
toHwbString(): string;
}
}
/**
* A plugin adding support for HWB (Hue-Whiteness-Blackness) color model.
* https://en.wikipedia.org/wiki/HWB_color_model
* https://www.w3.org/TR/css-color-4/#the-hwb-notation
*/
declare const hwbPlugin: Plugin;
export default hwbPlugin;
+23 -23
View File
@@ -1,23 +1,23 @@
import { LabaColor, AnyColor } from "../types";
import { Plugin } from "../extend";
declare module "../colord" {
interface Colord {
/**
* Converts a color to CIELAB color space and returns an object.
* The object always includes `alpha` value [0, 1].
*/
toLab(): LabaColor;
/**
* Calculates the perceived color difference for two colors according to
* [Delta E2000](https://en.wikipedia.org/wiki/Color_difference#CIEDE2000).
* Returns a value in [0, 1] range.
*/
delta(color?: AnyColor | Colord): number;
}
}
/**
* A plugin adding support for CIELAB color space.
* https://en.wikipedia.org/wiki/CIELAB_color_space
*/
declare const labPlugin: Plugin;
export default labPlugin;
import { LabaColor, AnyColor } from "../types";
import { Plugin } from "../extend";
declare module "../colord" {
interface Colord {
/**
* Converts a color to CIELAB color space and returns an object.
* The object always includes `alpha` value [0, 1].
*/
toLab(): LabaColor;
/**
* Calculates the perceived color difference for two colors according to
* [Delta E2000](https://en.wikipedia.org/wiki/Color_difference#CIEDE2000).
* Returns a value in [0, 1] range.
*/
delta(color?: AnyColor | Colord): number;
}
}
/**
* A plugin adding support for CIELAB color space.
* https://en.wikipedia.org/wiki/CIELAB_color_space
*/
declare const labPlugin: Plugin;
export default labPlugin;
+24 -24
View File
@@ -1,24 +1,24 @@
import { LchaColor } from "../types";
import { Plugin } from "../extend";
declare module "../colord" {
interface Colord {
/**
* Converts a color to CIELCH (Lightness-Chroma-Hue) color space and returns an object.
* https://lea.verou.me/2020/04/lch-colors-in-css-what-why-and-how/
* https://en.wikipedia.org/wiki/CIELAB_color_space#Cylindrical_model
*/
toLch(): LchaColor;
/**
* Converts a color to CIELCH (Lightness-Chroma-Hue) color space and returns a string.
* https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/lch()
*/
toLchString(): string;
}
}
/**
* A plugin adding support for CIELCH color space.
* https://lea.verou.me/2020/04/lch-colors-in-css-what-why-and-how/
* https://en.wikipedia.org/wiki/CIELAB_color_space#Cylindrical_model
*/
declare const lchPlugin: Plugin;
export default lchPlugin;
import { LchaColor } from "../types";
import { Plugin } from "../extend";
declare module "../colord" {
interface Colord {
/**
* Converts a color to CIELCH (Lightness-Chroma-Hue) color space and returns an object.
* https://lea.verou.me/2020/04/lch-colors-in-css-what-why-and-how/
* https://en.wikipedia.org/wiki/CIELAB_color_space#Cylindrical_model
*/
toLch(): LchaColor;
/**
* Converts a color to CIELCH (Lightness-Chroma-Hue) color space and returns a string.
* https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/lch()
*/
toLchString(): string;
}
}
/**
* A plugin adding support for CIELCH color space.
* https://lea.verou.me/2020/04/lch-colors-in-css-what-why-and-how/
* https://en.wikipedia.org/wiki/CIELAB_color_space#Cylindrical_model
*/
declare const lchPlugin: Plugin;
export default lchPlugin;
+20 -20
View File
@@ -1,20 +1,20 @@
import { Plugin } from "../extend";
interface MinificationOptions {
hex?: boolean;
alphaHex?: boolean;
rgb?: boolean;
hsl?: boolean;
name?: boolean;
transparent?: boolean;
}
declare module "../colord" {
interface Colord {
/** Returns the shortest string representation of the color */
minify(options?: MinificationOptions): string;
}
}
/**
* A plugin adding a color minification utilities.
*/
declare const minifyPlugin: Plugin;
export default minifyPlugin;
import { Plugin } from "../extend";
interface MinificationOptions {
hex?: boolean;
alphaHex?: boolean;
rgb?: boolean;
hsl?: boolean;
name?: boolean;
transparent?: boolean;
}
declare module "../colord" {
interface Colord {
/** Returns the shortest string representation of the color */
minify(options?: MinificationOptions): string;
}
}
/**
* A plugin adding a color minification utilities.
*/
declare const minifyPlugin: Plugin;
export default minifyPlugin;
+27 -27
View File
@@ -1,27 +1,27 @@
import { AnyColor } from "../types";
import { Plugin } from "../extend";
declare module "../colord" {
interface Colord {
/**
* Produces a mixture of two colors through CIE LAB color space and returns a new Colord instance.
*/
mix(color2: AnyColor | Colord, ratio?: number): Colord;
/**
* Generates a tints palette based on original color.
*/
tints(count?: number): Colord[];
/**
* Generates a shades palette based on original color.
*/
shades(count?: number): Colord[];
/**
* Generates a tones palette based on original color.
*/
tones(count?: number): Colord[];
}
}
/**
* A plugin adding a color mixing utilities.
*/
declare const mixPlugin: Plugin;
export default mixPlugin;
import { AnyColor } from "../types";
import { Plugin } from "../extend";
declare module "../colord" {
interface Colord {
/**
* Produces a mixture of two colors through CIE LAB color space and returns a new Colord instance.
*/
mix(color2: AnyColor | Colord, ratio?: number): Colord;
/**
* Generates a tints palette based on original color.
*/
tints(count?: number): Colord[];
/**
* Generates a shades palette based on original color.
*/
shades(count?: number): Colord[];
/**
* Generates a tones palette based on original color.
*/
tones(count?: number): Colord[];
}
}
/**
* A plugin adding a color mixing utilities.
*/
declare const mixPlugin: Plugin;
export default mixPlugin;
+19 -19
View File
@@ -1,19 +1,19 @@
import { Plugin } from "../extend";
interface ConvertOptions {
closest?: boolean;
}
declare module "../colord" {
interface Colord {
/** Finds CSS color keyword that matches with the color value */
toName(options?: ConvertOptions): string | undefined;
}
}
/**
* Plugin to work with named colors.
* Adds a parser to read CSS color names and `toName` method.
* See https://www.w3.org/TR/css-color-4/#named-colors
* Supports 'transparent' string as defined in
* https://drafts.csswg.org/css-color/#transparent-color
*/
declare const namesPlugin: Plugin;
export default namesPlugin;
import { Plugin } from "../extend";
interface ConvertOptions {
closest?: boolean;
}
declare module "../colord" {
interface Colord {
/** Finds CSS color keyword that matches with the color value */
toName(options?: ConvertOptions): string | undefined;
}
}
/**
* Plugin to work with named colors.
* Adds a parser to read CSS color names and `toName` method.
* See https://www.w3.org/TR/css-color-4/#named-colors
* Supports 'transparent' string as defined in
* https://drafts.csswg.org/css-color/#transparent-color
*/
declare const namesPlugin: Plugin;
export default namesPlugin;
+14 -14
View File
@@ -1,14 +1,14 @@
import { XyzaColor } from "../types";
import { Plugin } from "../extend";
declare module "../colord" {
interface Colord {
toXyz(): XyzaColor;
}
}
/**
* A plugin adding support for CIE XYZ colorspace.
* Wikipedia: https://en.wikipedia.org/wiki/CIE_1931_color_space
* Helpful article: https://www.sttmedia.com/colormodel-xyz
*/
declare const xyzPlugin: Plugin;
export default xyzPlugin;
import { XyzaColor } from "../types";
import { Plugin } from "../extend";
declare module "../colord" {
interface Colord {
toXyz(): XyzaColor;
}
}
/**
* A plugin adding support for CIE XYZ colorspace.
* Wikipedia: https://en.wikipedia.org/wiki/CIE_1931_color_space
* Helpful article: https://www.sttmedia.com/colormodel-xyz
*/
declare const xyzPlugin: Plugin;
export default xyzPlugin;
+2 -2
View File
@@ -1,2 +1,2 @@
import { Colord } from "./colord";
export declare const random: () => Colord;
import { Colord } from "./colord";
export declare const random: () => Colord;
+67 -67
View File
@@ -1,67 +1,67 @@
export declare type RgbColor = {
r: number;
g: number;
b: number;
};
export declare type HslColor = {
h: number;
s: number;
l: number;
};
export declare type HsvColor = {
h: number;
s: number;
v: number;
};
export declare type HwbColor = {
h: number;
w: number;
b: number;
};
export interface XyzColor {
x: number;
y: number;
z: number;
}
export interface LabColor {
l: number;
a: number;
b: number;
}
export interface LchColor {
l: number;
c: number;
h: number;
}
export interface CmykColor {
c: number;
m: number;
y: number;
k: number;
}
declare type WithAlpha<O> = O & {
a: number;
};
export declare type RgbaColor = WithAlpha<RgbColor>;
export declare type HslaColor = WithAlpha<HslColor>;
export declare type HsvaColor = WithAlpha<HsvColor>;
export declare type HwbaColor = WithAlpha<HwbColor>;
export declare type XyzaColor = WithAlpha<XyzColor>;
export declare type LabaColor = LabColor & {
alpha: number;
};
export declare type LchaColor = WithAlpha<LchColor>;
export declare type CmykaColor = WithAlpha<CmykColor>;
export declare type ObjectColor = RgbColor | RgbaColor | HslColor | HslaColor | HsvColor | HsvaColor | HwbColor | HwbaColor | XyzColor | XyzaColor | LabColor | LabaColor | LchColor | LchaColor | CmykColor | CmykaColor;
export declare type AnyColor = string | ObjectColor;
export declare type InputObject = Record<string, unknown>;
export declare type Format = "name" | "hex" | "rgb" | "hsl" | "hsv" | "hwb" | "xyz" | "lab" | "lch" | "cmyk";
export declare type Input = string | InputObject;
export declare type ParseResult = [RgbaColor, Format];
export declare type ParseFunction<I extends Input> = (input: I) => RgbaColor | null;
export declare type Parser<I extends Input> = [ParseFunction<I>, Format];
export declare type Parsers = {
string: Array<Parser<string>>;
object: Array<Parser<InputObject>>;
};
export {};
export declare type RgbColor = {
r: number;
g: number;
b: number;
};
export declare type HslColor = {
h: number;
s: number;
l: number;
};
export declare type HsvColor = {
h: number;
s: number;
v: number;
};
export declare type HwbColor = {
h: number;
w: number;
b: number;
};
export interface XyzColor {
x: number;
y: number;
z: number;
}
export interface LabColor {
l: number;
a: number;
b: number;
}
export interface LchColor {
l: number;
c: number;
h: number;
}
export interface CmykColor {
c: number;
m: number;
y: number;
k: number;
}
declare type WithAlpha<O> = O & {
a: number;
};
export declare type RgbaColor = WithAlpha<RgbColor>;
export declare type HslaColor = WithAlpha<HslColor>;
export declare type HsvaColor = WithAlpha<HsvColor>;
export declare type HwbaColor = WithAlpha<HwbColor>;
export declare type XyzaColor = WithAlpha<XyzColor>;
export declare type LabaColor = LabColor & {
alpha: number;
};
export declare type LchaColor = WithAlpha<LchColor>;
export declare type CmykaColor = WithAlpha<CmykColor>;
export declare type ObjectColor = RgbColor | RgbaColor | HslColor | HslaColor | HsvColor | HsvaColor | HwbColor | HwbaColor | XyzColor | XyzaColor | LabColor | LabaColor | LchColor | LchaColor | CmykColor | CmykaColor;
export declare type AnyColor = string | ObjectColor;
export declare type InputObject = Record<string, unknown>;
export declare type Format = "name" | "hex" | "rgb" | "hsl" | "hsv" | "hwb" | "xyz" | "lab" | "lch" | "cmyk";
export declare type Input = string | InputObject;
export declare type ParseResult = [RgbaColor, Format];
export declare type ParseFunction<I extends Input> = (input: I) => RgbaColor | null;
export declare type Parser<I extends Input> = [ParseFunction<I>, Format];
export declare type Parsers = {
string: Array<Parser<string>>;
object: Array<Parser<InputObject>>;
};
export {};