source: trip-planner-front/node_modules/colord/colord.d.ts@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 3.2 KB
Line 
1import { AnyColor, RgbaColor, HslaColor, HsvaColor } from "./types";
2export declare class Colord {
3 private readonly parsed;
4 readonly rgba: RgbaColor;
5 constructor(input: AnyColor);
6 /**
7 * Returns a boolean indicating whether or not an input has been parsed successfully.
8 * Note: If parsing is unsuccessful, Colord defaults to black (does not throws an error).
9 */
10 isValid(): boolean;
11 /**
12 * Returns the brightness of a color (from 0 to 1).
13 * The calculation logic is modified from WCAG.
14 * https://www.w3.org/TR/AERT/#color-contrast
15 */
16 brightness(): number;
17 /**
18 * Same as calling `brightness() < 0.5`.
19 */
20 isDark(): boolean;
21 /**
22 * Same as calling `brightness() >= 0.5`.
23 * */
24 isLight(): boolean;
25 /**
26 * Returns the hexadecimal representation of a color.
27 * When the alpha channel value of the color is less than 1,
28 * it outputs #rrggbbaa format instead of #rrggbb.
29 */
30 toHex(): string;
31 /**
32 * Converts a color to RGB color space and returns an object.
33 * Always includes an alpha value from 0 to 1.
34 */
35 toRgb(): RgbaColor;
36 /**
37 * Converts a color to RGB color space and returns a string representation.
38 * Outputs an alpha value only if it is less than 1.
39 */
40 toRgbString(): string;
41 /**
42 * Converts a color to HSL color space and returns an object.
43 * Always includes an alpha value from 0 to 1.
44 */
45 toHsl(): HslaColor;
46 /**
47 * Converts a color to HSL color space and returns a string representation.
48 * Always includes an alpha value from 0 to 1.
49 */
50 toHslString(): string;
51 /**
52 * Converts a color to HSV color space and returns an object.
53 * Always includes an alpha value from 0 to 1.
54 */
55 toHsv(): HsvaColor;
56 /**
57 * Creates a new instance containing an inverted (opposite) version of the color.
58 */
59 invert(): Colord;
60 /**
61 * Increases the HSL saturation of a color by the given amount.
62 */
63 saturate(amount?: number): Colord;
64 /**
65 * Decreases the HSL saturation of a color by the given amount.
66 */
67 desaturate(amount?: number): Colord;
68 /**
69 * Makes a gray color with the same lightness as a source color.
70 */
71 grayscale(): Colord;
72 /**
73 * Increases the HSL lightness of a color by the given amount.
74 */
75 lighten(amount?: number): Colord;
76 /**
77 * Increases the HSL lightness of a color by the given amount.
78 */
79 darken(amount?: number): Colord;
80 /**
81 * Changes the HSL hue of a color by the given amount.
82 */
83 rotate(amount?: number): Colord;
84 /**
85 * Allows to get or change an alpha channel value.
86 */
87 alpha(): number;
88 alpha(value: number): Colord;
89 /**
90 * Allows to get or change a hue value.
91 */
92 hue(): number;
93 hue(value: number): Colord;
94 /**
95 * Determines whether two values are the same color.
96 */
97 isEqual(color: AnyColor | Colord): boolean;
98}
99/**
100 * Parses the given input color and creates a new `Colord` instance.
101 * See accepted input formats: https://github.com/omgovich/colord#color-parsing
102 */
103export declare const colord: (input: AnyColor | Colord) => Colord;
Note: See TracBrowser for help on using the repository browser.