Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 5x 5x 4x 4x 4x 1x 1x | import { EditorAPI } from '../types/CommonTypes'; import { getEditorResponseData } from '../utils/EditorResponseData'; import { Color, RGBColor } from '../types/ColorStyleTypes'; /** * The ColorConversionController is responsible for all communication regarding color coversion. * Methods inside this controller can be called by `window.SDK.colorConversion.{method-name}` */ export class ColorConversionController { /** * @ignore */ #editorAPI: EditorAPI; /** * @ignore */ constructor(editorAPI: EditorAPI) { this.#editorAPI = editorAPI; } /** * This method converts the given color to its rgb representation * @param color the color to convert * @returns the rgb representation of the given color */ convertToRgb = async (color: Color) => { const res = await this.#editorAPI; return res.colorToRgb(JSON.stringify(color)).then((result) => getEditorResponseData<RGBColor>(result)); }; } |