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