調査アンケート: Blockly のご利用体験についてお聞かせください
アンケートを開始
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
ブロックする >utils >色 >解析
utils.colour.parse() 関数
文字列から色を解析します。.parse('red') = '#ff0000'
.parse('#f00') = '#ff0000'
.parse('#ff0000') = '#ff0000'
.parse('0xff0000') = '#ff0000'
.parse('rgb(255, 0, 0)') = '#ff0000'
署名:
export declare function parse(str: string | number): string | null;
パラメータ
パラメータ |
型 |
説明 |
str |
文字列 |数値 |
一部の CSS フォーマットでの色。 |
戻り値:
文字列 |null
色の 16 進表現を含む文字列。解析できない場合は null。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2024-09-11 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2024-09-11 UTC。"],[[["The `utils.colour.parse()` function converts various color formats (like 'red', '#f00', 'rgb(255, 0, 0)') into a standardized hexadecimal representation (e.g., '#ff0000')."],["If the input color format is invalid or unparsable, the function will return `null`."],["This function accepts color input as either a string or a number."],["The primary purpose of this function is to provide a consistent color format for use within Blockly."]]],[]]