@inweb/markup
Version:
JavaScript 2D markups
40 lines (39 loc) • 1.24 kB
TypeScript
/**
* Defines the markup color helper object.
*/
export declare class MarkupColor {
R: number;
G: number;
B: number;
HEX: string;
/**
* Creates an instance of the color.
*
* @param r - The `red` component of the color, as a number between 0 and 255.
* @param g - The `green` component of the color, as a number between 0 and 255.
* @param b - The `blue` component of the color, as a number between 0 and 255.
*/
constructor(r: number, g: number, b: number);
/**
* Returns the color as a string in hexadecimal color syntax `#RGB` using its primary color components
* (red, green, blue) written as hexadecimal numbers.
*/
asHex(): string;
/**
* Returns the color as an {r, g, b} object.
*/
asRGB(): {
r: number;
g: number;
b: number;
};
/**
* Sets the color.
*
* @param r - The `red` component of the color, as a number between 0 and 255.
* @param g - The `green` component of the color, as a number between 0 and 255.
* @param b - The `blue` component of the color, as a number between 0 and 255.
*/
setColor(r: number, g: number, b: number): void;
private rgbToHex;
}