blockly > utils > colour > parse
utils.colour.parse() 函式
從字串剖析色彩。.parse('red') = '#ff0000' .parse('#f00') = '#ff0000' .parse('#ff0000') = '#ff0000' .parse('0xff0000') = '#ff0000' .parse(250)
Signature:
export declare function parse(str: string | number): string | null;
參數
參數 | 類型 | 說明 |
---|---|---|
str | 字串 | 數字 | 採用某些 CSS 格式的色彩。 |
傳回:
字串 | 空值
包含以十六進位表示顏色的字串;如果無法剖析,則為空值。