modscode EN

modscode / 図鑑 / theme-studio

theme-studio

Recolor Claude Code's chat from 441 palettes or one you mix: prompts, replies, tool rows, spinner, footer and panes.

確かめやすいコードターミナル+デスクトップペイントーストBoxButtonClientInputSelectText

何をするか

  • 欄・トーストを描く
  • /theme を足す
  • config.set・prompt.submit・session.start・turn.complete ほか 1 個にフックする
  • ターンをまたいで自分の状態を持つ

良いところ

  • ネットワークに出ない
  • プロセスを起こさない
  • TypeScript で書かれている
  • デスクトップ専用の分岐がある

作り始めるためのコード

2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。

雛形(register.tsx)

register.tsx
import type { Register } from 'claude-code'

// Drawn like theme-studio by Alliance Optima (pane, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/allianceoptima-theme-studio/
// Written by modscode from that reading, not copied from the mod: use it as you like.
// Each value below stands for one the mod works out at run time; put in your own.
export const register: Register = on => {
  // the pane: open it with $.ui.open({ id: 'my-pane', title: "Theme Studio" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Input, Button, Client } = $.ui.resolve(e)
    const name = '…'
    const group = '…'
    const search = '…'
    const length = '…'
    const label = '…'
    const STYLE_LABEL = '…'
    const mode = '…'
    const canvas = '…'
    const said = '…'
    return (
      <Box flexDirection="column" gap={1}>
        <Box flexDirection="column">
          <Text bold>
            🎨 THEME STUDIO
          </Text>
          <Box gap={1}>
            <Text>
              Active:
            </Text>
            <Text>
              <Text>
                ██
              </Text>
              <Text>
                ██
              </Text>
              <Text>
                ██
              </Text>
              <Text>
                ██
              </Text>
              <Text>
                ██
              </Text>
            </Text>
            <Text bold>
              {`${name} · ${group}`}
            </Text>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Input label="Search" value={`${search}`} placeholder={`${length} themes: try "hockey", "neon", "gryffindor"`} submitLabel="search" />
          <Box gap={1}>
            <Text>
              40+ match
            </Text>
            <Button label="Clear" plain dimColor />
          </Box>
          <Text>
            No theme matches that.
          </Text>
          <Box gap={1}>
            <Text>
              <Text>
                ██
              </Text>
              <Text>
                ██
              </Text>
              <Text>
                ██
              </Text>
              <Text>
                ██
              </Text>
              <Text>
                ██
              </Text>
            </Text>
            <Button label={`${name} · ${group}`} variant="primary" />
            <Text>
              ◆ on
            </Text>
          </Box>
          <Box gap={1}>
            <Text>
              <Text>
                ██
              </Text>
              <Text>
                ██
              </Text>
              <Text>
                ██
              </Text>
              <Text>
                ██
              </Text>
              <Text>
                ██
              </Text>
            </Text>
            <Button label={`${name} · ${group}`} variant="primary" />
            <Text>
              ◆ on
            </Text>
          </Box>
          <Box gap={1}>
            <Text>
              <Text>
                ██
              </Text>
              <Text>
                ██
              </Text>
              <Text>
                ██
              </Text>
              <Text>
                ██
              </Text>
              <Text>
                ██
              </Text>
            </Text>
            <Button label={`${name} · ${group}`} variant="primary" />
            <Text>
              ◆ on
            </Text>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Text bold>
            MIX YOUR OWN
          </Text>
          <Client module="./picker.tsx" />
          <Text>
            Or type exact hex codes:
          </Text>
          <Box gap={1}>
            <Text>
              ██
            </Text>
            <Input label={`${label}`} value="" placeholder="auto (tinted from the accent)" submitLabel="set" />
          </Box>
          <Box gap={1}>
            <Text>
              ██
            </Text>
            <Input label={`${label}`} value="" placeholder="auto (tinted from the accent)" submitLabel="set" />
          </Box>
          <Box gap={1}>
            <Text>
              ██
            </Text>
            <Input label={`${label}`} value="" placeholder="auto (tinted from the accent)" submitLabel="set" />
          </Box>
          <Box gap={1} flexWrap="wrap">
            <Text>
              <Text>
                ██
              </Text>
              <Text>
                ██
              </Text>
              <Text>
                ██
              </Text>
              <Text>
                ██
              </Text>
              <Text>
                ██
              </Text>
            </Text>
            <Button label="Apply custom" variant="primary" />
            <Button label={`🎲 Random theme (${length})`} />
            <Button label="🎨 Random mix" />
          </Box>
          <Input label="Save as" placeholder="name your theme, Enter to save" submitLabel="save" />
        </Box>
        <Box flexDirection="column">
          <Text bold>
            LOOK
          </Text>
          <Box gap={1} flexWrap="wrap">
            <Button label={`Messages: ${STYLE_LABEL}`} />
            <Button label="Tools, spinner & panes: on" />
            <Button label={`Canvas: ${mode} (${canvas})`} />
          </Box>
          <Box gap={1}>
            <Text>
              ██
            </Text>
            <Input label="Background for every theme" value="" placeholder="auto — or a hex like #1a1a2e" submitLabel="set" />
          </Box>
          <Box gap={1} flexWrap="wrap">
            <Button label="Clear my themes" dimColor />
            <Button label="Theme off" dimColor />
          </Box>
        </Box>
        <Text>
          {said}
        </Text>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const name = '…'
    await $.ui.toast(`🎨 ${name}`)
    return next(e)
  })
}

Mod 自身のコード

Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。

theme-studio/hooks/register.tsx 541〜700 行 · ペイン
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const els = $.ui.resolve(e)
    const { Box, Text, Button } = els
    // Mobile draws no fields: collections become buttons and the mixer is hidden.
    const Input = 'Input' in els ? els.Input : undefined
    const Select = 'Select' in els ? els.Select : undefined
    // The color picker needs a Client region: the terminal and the desktop app.
    const Client = 'Client' in els ? els.Client : undefined

    const pal = await read($, active)
    const shown = await read($, group)
    const search = await read($, query)
    const mixer = await read($, custom)
    const mine = await read($, saved)
    const style = await read($, messageStyle)
    const isChrome = await read($, themeChrome)
    const mode = await read($, base)
    const canvas = (await read($, resolvedBase)) as Base
    const bg = await read($, bgOverride)
    const said = await read($, notice)
    const ui = lookOf(pal ?? DEFAULT_CUSTOM, canvas, bg)

    const results = search ? searchPresets(search, mine, 40) : inGroup(shown, mine)
    const swatch = (one: Palette) => (
      <Text>
        <Text color={one.accent}>██</Text>
        <Text color={one.secondary}>██</Text>
        <Text color={one.highlight}>██</Text>
        <Text color={one.text}>██</Text>
        <Text color={lookOf(one, canvas, bg).replyBg}>██</Text>
      </Text>
    )
    const heading = (label: string) => (
      <Text bold color={ui.accent}>
        {label}
      </Text>
    )

    return (
      <Box flexDirection="column" gap={1}>
        <Box flexDirection="column">
          {heading('🎨 THEME STUDIO')}
          <Box gap={1}>
            <Text color={ui.text}>Active:</Text>
            {pal ? swatch(pal) : null}
            <Text bold color={ui.secondary}>
              {pal ? `${pal.name} · ${pal.group}` : "Claude Code's own look"}
            </Text>
          </Box>
        </Box>

        <Box flexDirection="column">
          {Input ? (
            <Input
              key="search"
              label="Search"
              value={search}
              placeholder={`${PRESETS.length} themes: try "hockey", "neon", "gryffindor"`}
              submitLabel="search"
              onInput={value => void update($, query, () => value)}
              onSubmit={value => void update($, query, () => value)}
            />
          ) : null}
          {search ? (
            <Box gap={1}>
              <Text color={ui.muted}>{`${results.length === 40 ? '40+' : results.length} match${results.length === 1 ? '' : 'es'}`}</Text>
              <Button key="clear-search" label="Clear" plain dimColor onPress={() => update($, query, () => '')} />
            </Box>
          ) : Select ? (
            <Select
              key="group"
              label="Collection"
              value={shown}
              options={GROUPS.map(g => ({ value: g, label: g === MINE ? `${g} (${mine.length})` : g }))}
              onSelect={value => update($, group, () => value)}
            />
          ) : (
            <Box flexWrap="wrap" gap={1}>
              {GROUPS.map(g => (
                <Button key={`g-${slug(g)}`} label={g} dimColor={g !== shown} onPress={() => update($, group, () => g)} />
              ))}
            </Box>
          )}
          {results.length === 0 ? (
            <Text color={ui.muted}>{search ? 'No theme matches that.' : 'No saved themes yet. Mix one below and press Enter on "Save as".'}</Text>
          ) : null}
          {results.map(one => (
            <Box key={`row-${one.id}`} gap={1}>
              {swatch(one)}
              <Button
                key={`apply-${one.id}`}
                label={search ? `${one.name} · ${one.group}` : one.name}
                variant={pal?.id === one.id ? 'primary' : undefined}
                onPress={() => apply($, one)}
              />
              {pal?.id === one.id ? <Text color={ui.highlight}>◆ on</Text> : null}
            </Box>
          ))}
        </Box>

        {Input ? (
          <Box flexDirection="column">
            {heading('MIX YOUR OWN')}
            {Client ? (
              <Client
                key={MIXER}
                module="./picker.tsx"
                width={Math.min(48, Math.max(12, e.props.bodyColumns - 2))}
                props={{
                  colors: {
                    accent: mixer.accent,
                    secondary: mixer.secondary,
                    highlight: mixer.highlight,
                    text: mixer.text,
                    background: mixer.background ?? null,
                  },
                  autoBackground: lookOf(mixer, canvas).replyBg,
                }}
              />
            ) : null}
            {Client ? <Text color={ui.muted}>Or type exact hex codes:</Text> : null}
            {SLOTS.map(({ slot, label }) => (
              <Box key={`slot-${slot}`} gap={1}>
                <Text color={mixer[slot] ?? lookOf(mixer, canvas).replyBg}>██</Text>
                <Input
                  key={`hex-${slot}`}
                  label={label}
                  value={mixer[slot] ?? ''}
                  placeholder={slot === 'background' ? 'auto (tinted from the accent)' : '#ff2bd6'}
                  submitLabel="set"
                  onSubmit={async value => {
                    if (slot === 'background' && value.trim() === '') {
                      const next = await update($, custom, c => ({ ...c, background: undefined }))
                      await persist($, 'custom', next)
                      await update($, notice, () => 'Mixer background back to auto')
                      return
                    }
                    const hex = normalizeHex(value)
                    if (!hex) {
                      await update($, notice, () => `"${value}" isn't a hex color. Try #ff2bd6 or f0f.`)
                      return
                    }
                    const next = await update($, custom, c => ({ ...c, [slot]: hex }))
                    await persist($, 'custom', next)
                    await update($, notice, () => `${slot} set to ${hex}`)
                  }}
                />
              </Box>
            ))}
            <Box gap={1} flexWrap="wrap">
              {swatch(mixer)}
              <Button
                key="apply-custom"
                label="Apply custom"
                variant="primary"
                onPress={async () => apply($, { ...(await read($, custom)), id: 'custom', name: 'Custom', group: MINE })}
              />
              <Button
                key="random-theme"
                label={`🎲 Random theme (${PRESETS.length})`}
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 Alliance Optima

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

コードが呼ぶもの

保存

コードから読み取ったデザイン

読み取ったコミットのソースから描いたもので、動かした結果ではありません。一覧は 3 回描き、条件はデスクトップアプリで描く最初の分岐を取り、動かしたときにだけ決まる値は仮の例(点線の下線)にするか省きます。色と書体はこのサイトのものです。

コードから読めること

2026-10-06 に読んだコミット e20a49169fe1 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。theme-studio/hooks/register.tsx
解析できるすべてのファイルが TypeScript か JavaScript として解析できる。7 ファイルを解析
コードが Mod の中で完結import は Mod 自身のファイルかエンジンのモジュールだけ。パッケージも require もない。コードはすべて Mod の中
読める圧縮した行・eval・new Function・計算した道の import()・符号化した塊がない。圧縮・eval・符号化した塊なし
呼び出しが見える通信とプログラム起動はその場で $.http.fetch・$.process.run と書き、他へ渡さない。外への呼び出しはすべてその場の $ で
入れる前に自分で判断する材料
描く場所コードから読んだ、描く先。ターミナル・デスクトップアプリ・両方・何も描かない(フックだけ: 見張りやプロンプトの書き換え)のどれか。出すだけで、外す理由にはしない。ターミナルとデスクトップアプリに同じように描く
入れる手順リポジトリ自身の .claude-plugin/marketplace.json にこの Mod が載っていて、ページに書いた手順でそのマーケットプレイスから入れられるか。リポジトリの .claude-plugin/marketplace.json に載っており、そこから入れられる
Windows のプログラム$.process で起動するプログラムが Windows にあるか(tail・date・open・osascript・/usr/… などは無い)。Windows にないプログラムを使わない
通信fetch の送り先(https のホスト)がコードに書いてあるか。通信なし
プログラム起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。プログラムを起動しない
読んで送るファイルや環境変数を読み、かつ通信するか。通信しない
ソースの鍵ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし
ライセンスオープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT

コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件

入れる

入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。

リポジトリがそのままマーケットプレイスです。このマーケットプレイスを足し(ターミナルでは次のコマンド、デスクトップアプリではプラグインの設定)、そこから Mod を入れます。

/plugin marketplace add allianceoptima/claude-theme-studio
/plugin install theme-studio@claude-theme-studio

入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(e20a49169fe1)と違うことがあります。入れる前に見比べてください。

Claude に聞く

modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:

modscode のデザイン「allianceoptima-theme-studio」をコードごと読んで、同じようなペインを作って

Claude から探す: MCP コネクタ

似たデザイン