コンテンツにスキップ

トークン

実サービスへ通信しない見本です。モデルの描画は静止した代替表示です。

元 commit: d204666f04a0ee7b6f18543f8aec414b4128874e · shadcn build 4.23.1

Noto Sans JP · @fontsource/noto-sans-jp 5.3.1 · OFL-1.1

操作を試す

全画面で開く

取り込む(公開予定)

以下の URL は公開予定です。公開前は取り込めません。既存ファイルとの差分を確認してから実行し、--overwrite を既定にしないでください。

npx shadcn@latest add https://spritestack.dev/r/spst-theme.json

components.json の registries に追加

{"registries":{"@spritestack":"https://spritestack.dev/r/{name}.json"}}
npx shadcn@latest add @spritestack/spst-theme

React 19・Tailwind v4・shadcn の src/ を持つ構成が対象です。src/ の無い構成は未検証です。取り込みはソースのコピーで、自動更新されません。

import "./styles/spritestack/theme.css";

<div className="spst-theme" data-theme="light">
  {/* Render components here. */}
</div>

Portal の container / portalContainer は .spst-theme 内の要素を渡してください。Noto Sans JP の 400・600・700 は利用先が自己ホストしてください。未導入時は system-ui です。

依存

    外部依存なし

    Props / API

    以下は実際のソースを構文解析して生成しています。… の行は継承する React / Radix の公開型です。既定欄の — は、この関数の引数で既定を指定していないことを表します。union の必須条件は型宣言も確認してください。

    CSS の変数を提供します。React の props とイベントはありません。

    アクセシビリティの利用条件

    • 入力には Label または読み上げ名を与え、エラーを aria-describedby で関連づけます。色だけで状態を伝えません。
    • 画像にはモデル名と代替表示を与えます。単独アイコンのボタンにも名前が必要です。
    • Dialog / Sheet に題名と説明を与え、Portal をテーマ内に置きます。Tab・矢印・Escape と閉じた後のフォーカスを利用先でも確認します。
    • Slider は名前と有限の min < max、ToggleGroup は空でない single の値が必要です。pending は親が制御します。

    対応画像: 01–11 · 暗色とエラーは設計による補完です。

    測った値と採用した値

    採取値と座標は承認済み設計 §3.3、採用値は tokens.css から毎回読みます。

    Token画像・座標採取値明暗
    --spst-background01: 600,70,650,90#f0f6fe#f0f6fe#151e30
    --spst-card01: 1100,650,1150,675#fafbfe#fafbfe#1a263c
    --spst-foreground01: 58,110,510,140#1a263c#1a263c#f0f6fe
    --spst-muted-foreground04: 1000,321,1435,341#384b67#384b67#bbc2ce
    --spst-primary01: 1100,765,1150,785#255ab1#255ab1#b3c5e4
    --spst-primary-foreground01: 1225,766,1360,785#ffffff#ffffff#1a263c
    --spst-border01: 1063,200,1064,400#d2dcea#d2dcea#384b67
    --spst-input07: 241,305,242,322#9cacca#6d7c97#9aa3b0
    --spst-ring01: 29,290,31,450#1c4db0#1c4db0#b0c1e3
    --spst-selected10: 140,280,460,300#ccdffd#ccdffd#384b67
    --spst-attention-foreground06: 460,498,540,520#080b28#080b28#ccdffd
    --spst-attention10: 140,280,460,300#ccdffd#ccdffd#080b28
    --spst-success07: 370,506,378,520#d6f2dd#d6f2dd#093115
    --spst-success-foreground07: 382,505,455,526#093115#093115#d6f2dd
    --spst-stage03: 90,200,160,260#f2f7fd#f2f7fd#1a263c
    --spst-grid03: 205,380,260,420#c4d3ef#c4d3ef#384b67
    --spst-radius-card設計 §3.6 の近似・設計値—14px14px
    --spst-radius-button設計 §3.6 の近似・設計値—12px12px
    --spst-radius-input設計 §3.6 の近似・設計値—12px12px
    --spst-radius-badge設計 §3.6 の近似・設計値—999px999px
    --spst-shadow-card設計 §3.6 の近似・設計値—0 1px 3px rgb(26 38 60 / 0.06)0 1px 3px rgb(26 38 60 / 0.06)
    --spst-shadow-popover設計 §3.6 の近似・設計値—0 4px 12px rgb(26 38 60 / 0.12)0 4px 12px rgb(26 38 60 / 0.12)
    --spst-overlay設計 §3.6 の近似・設計値—rgb(26 38 60 / 0.4)rgb(26 38 60 / 0.4)
    --spst-font-sans設計 §3.6 の近似・設計値—"Noto Sans JP", system-ui, sans-serif"Noto Sans JP", system-ui, sans-serif
    --spst-font-mono設計 §3.6 の近似・設計値—ui-monospace, SFMono-Regular, Menlo, Consolas, monospaceui-monospace, SFMono-Regular, Menlo, Consolas, monospace
    --spst-text-sm設計 §3.6 の近似・設計値—0.875rem0.875rem
    --spst-text-sm-line-height設計 §3.6 の近似・設計値—1.51.5
    --spst-text-base設計 §3.6 の近似・設計値—1rem1rem
    --spst-text-base-line-height設計 §3.6 の近似・設計値—1.71.7
    --spst-text-lg設計 §3.6 の近似・設計値—1.25rem1.25rem
    --spst-text-lg-line-height設計 §3.6 の近似・設計値—1.51.5
    --spst-text-xl設計 §3.6 の近似・設計値—1.75rem1.75rem
    --spst-text-xl-line-height設計 §3.6 の近似・設計値—1.41.4
    --spst-text-display設計 §3.6 の近似・設計値—2.25rem2.25rem
    --spst-text-display-line-height設計 §3.6 の近似・設計値—1.251.25
    --spst-text-display-narrow設計 §3.6 の近似・設計値—1.75rem1.75rem
    --spst-font-weight-body設計 §3.6 の近似・設計値—400400
    --spst-font-weight-control設計 §3.6 の近似・設計値—600600
    --spst-font-weight-heading設計 §3.6 の近似・設計値—700700
    --spst-focus-width設計 §3.6 の近似・設計値—2px2px
    --spst-focus-offset設計 §3.6 の近似・設計値—2px2px
    --spst-space-1設計 §3.6 の近似・設計値—0.25rem0.25rem
    --spst-space-2設計 §3.6 の近似・設計値—0.5rem0.5rem
    --spst-space-3設計 §3.6 の近似・設計値—0.75rem0.75rem
    --spst-space-4設計 §3.6 の近似・設計値—1rem1rem
    --spst-space-5設計 §3.6 の近似・設計値—1.5rem1.5rem
    --spst-space-6設計 §3.6 の近似・設計値—2rem2rem
    --spst-space-7設計 §3.6 の近似・設計値—3rem3rem
    --spst-space-8設計 §3.6 の近似・設計値—4rem4rem

    コントラスト比

    前景 / 背景明暗基準
    foreground / background13.93:115.33:14.5:1
    foreground / card14.64:113.93:14.5:1
    foreground / selected11.21:18.15:14.5:1
    foreground / stage14.06:113.93:14.5:1
    muted-foreground / background8.15:19.30:14.5:1
    muted-foreground / card8.56:18.45:14.5:1
    muted-foreground / selected6.56:14.94:14.5:1
    primary / background6.08:19.54:14.5:1
    primary / card6.39:18.67:14.5:1
    primary / selected4.89:15.07:14.5:1
    primary-foreground / primary6.61:18.67:14.5:1
    attention-foreground / attention14.27:114.27:14.5:1
    success-foreground / success12.04:112.04:14.5:1
    input / background3.88:16.54:13:1
    input / card4.08:15.94:13:1
    input / selected3.12:13.48:13:1
    ring / background7.06:19.19:13:1
    ring / card7.41:18.35:13:1
    ring / selected5.68:14.89:13:1
    primary / background6.08:19.54:13:1
    primary / card6.39:18.67:13:1

    暗い表示の作り方

    暗い画像の測定値ではありません。明の地と文字の役割を交換し、主色とフォーカスは白へ65%、地は明の文字を黒へ20%、控えめな文字は明の地を文字へ25%、入力境界は40%混ぜた設計値です。sRGB の各成分を線形補間して整数へ丸めます。角・余白・影・文字サイズは共通です。