Skip to content
fandhe-frontend
GitHub

Color Swatch

fandhe-frontend-pre-styled-uicolor_swatch mod が提供するスタイル済み Color Swatch 部品です。

検証済みの Color 型から色見本を表示する部品です。検証済み型経由でのみ色値を受け取るため、任意の CSS カラー文字列を直接渡すことはできません。SwatchShape(Square/Circle/Rounded)で外形を切り替えられます。

関連 API: fandhe-frontend-pre-styled-ui API

Demo

色見本の静的表示です。size / shape を組み合わせられます。アルファ付き色は下地のチェッカーボード模様で透過が視認できます。

Features

  • SwatchShape(Square/Circle/Rounded、crates/pre-styled-ui/src/color_swatch.rs:48-347)で外形を切り替える
  • 検証済み Color 型のみを受け取り、--fd-swatch-color custom property 経由で色を出力する(color_swatch.rs:317-336 モジュール冒頭「色値は検証済み型経由のみ」)
  • 呼び出し側の class/style/data-scope/data-part 偽装はすべて除去する(color_swatch.rs テスト caller_class_and_style_attrs_are_dropped_not_duplicated 等)

Anatomy

root

API Reference

Arguments

NameTypeDefaultDescription
valueColoropaque black表示する色(検証済み型のみ受け取る、color_swatch.rs:317-336)。
shapeSwatchShapeRounded外形(color_swatch.rs:339-347)。

Examples

Circle

円形の ColorSwatch の例です。

Accessibility

WAI-ARIA

AttributeDescription
(該当なし)純粋な色見本表示であり固有の role/aria-* を出力しない(color_swatch.rs 全文で role/aria-* を grep しても 0 件)。