Lua

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

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

Lua は設定ファイルやゲームのスクリプトでよく使われ、そのコードはたいてい小さなテーブルか関数ひとつです。

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

local Snapshot = {}
Snapshot.__index = Snapshot

function Snapshot.new(code, theme)
  return setmetatable({ code = code, theme = theme or "xcode" }, Snapshot)
end

function Snapshot:export(path, scale)
  return render(self.code, self.theme):save(path, scale or 2)
end

return Snapshot
Atom One · ダーク
local Snapshot = {}
Snapshot.__index = Snapshot

function Snapshot.new(code, theme)
  return setmetatable({ code = code, theme = theme or "xcode" }, Snapshot)
end

function Snapshot:export(path, scale)
  return render(self.code, self.theme):save(path, scale or 2)
end

return Snapshot
Edge · ダーク
local Snapshot = {}
Snapshot.__index = Snapshot

function Snapshot.new(code, theme)
  return setmetatable({ code = code, theme = theme or "xcode" }, Snapshot)
end

function Snapshot:export(path, scale)
  return render(self.code, self.theme):save(path, scale or 2)
end

return Snapshot
GitHub · ダーク

Luaに合うテーマ選び

Lua のコードはもともと短いので、枠を埋めようとしないでください。余白をたっぷり取った短いコードのほうが、詰め込んだ長いコードより読みやすくなります。

サイズを正しく決める

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

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

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

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

macOS版をダウンロード