Mathematica

Mathematicaコードスクリーンショット生成

Mathematicaのスニペットを、Macから離れることなく共有したくなる画像に。

Wolfram Language is verbose in a way that reads well once coloured, and badly when pasted as plain text into anything.

Codeshotは貼り付けたコードからMathematicaを判別するので、言語の選び間違いは起きません。付属する30種類のうち3つのテーマで同じスニペットを、アプリ自身のスタイルシートで表示しています。

exportSnapshot[code_String, OptionsPattern[]] :=
  Module[{img, theme = OptionValue["Theme"]},
    img = render[code, theme];
    Export["snapshot.png", img, ImageResolution -> 144]
  ]
GitHub · ダーク
exportSnapshot[code_String, OptionsPattern[]] :=
  Module[{img, theme = OptionValue["Theme"]},
    img = render[code, theme];
    Export["snapshot.png", img, ImageResolution -> 144]
  ]
iA · ダーク
exportSnapshot[code_String, OptionsPattern[]] :=
  Module[{img, theme = OptionValue["Theme"]},
    img = render[code, theme];
    Export["snapshot.png", img, ImageResolution -> 144]
  ]
Solarized · ダーク

Mathematicaに合うテーマ選び

Bracket types carry meaning here — square, curly and double square all differ. Choose a theme that does not flatten them into one colour.

サイズを正しく決める

画像サイズを内容に合わせるか、比率で固定します(1:1、4:3、3:2、16:9、9:16、2:3、3:4)。そのうえで1×・2×・3×から選んで書き出せば、Retinaディスプレイでも鮮明なままです。Cでクリップボードに直接コピー、またはSで保存できます。

30種類のテーマを見比べるか、全体の流れをご覧ください。

Mathematicaと、ほかの59言語のために

すべてMac上で動作します。コードが外に出ることはありません。

macOS版をダウンロード