Create an extension
The .scrext format, API version 2: color themes, icon themes, code snippets, file types, abbreviations and file templates. For now only extensions by Les Arcanes de Cookie are listed in the catalog; you can still make your own for yourself.
Principle
A .scrext file is a JSON file (UTF-8). It never contains executable code: Scriptorium checks every field (colors as #rrggbb, file names without forbidden characters, limited sizes) and ignores anything it does not know.
Common fields
| Champ | Content |
|---|---|
format, api | 1, 1 (themes, icons) / 2 (everything else) |
id | Unique lowercase identifier: letters, digits, dots, dashes (e.g. com.example.theme.rose). |
version | Three numbers: 1.0.0. Raise it on every change (updates depend on it). |
category | appearance · languages · tools · universe |
name, description | A text, or {"fr":"…","en":"…"}. |
author, color | Author name; #rrggbb color of the badge. |
contributes | themes, iconTheme, snippets, fileTypes, emmet, templates |
Color theme
"contributes": { "themes": [{
"id": "rose-dark", "label": {"fr": "Rose sombre", "en": "Rose dark"}, "type": "dark",
"ui": { "bg": "#1a1018", "bg2": "#221620", "bg3": "#2c1c29", "panel": "#201420", "line": "#40283c",
"fg": "#f2e6ef", "dim": "#b399ad", "accent": "#f08cc0", "accent2": "#a8467e",
"hover": "#2f1f2c", "active": "#432a3e", "danger": "#e5646e", "shadow": "#00000073" },
"editor": { "bg": "#1a1018", "fg": "#f2e6ef", "line": "#221620", "sel": "#5a2f4c", "cursor": "#f08cc0",
"ln": "#6b4a62", "widget": "#221620",
"comment": "8c7084", "keyword": "f08cc0", "string": "f0c27f", "number": "f0a07f", "type": "9ec1f5" }
}]}
“type” is dark or light. “ui” colors are optional (the Arcanes theme is used by default); “editor” colors are required. In “editor”, token colors (comment, keyword, string, number, type) are written without the #. One file may hold up to 8 themes.
Icon theme
"contributes": { "iconTheme": {
"default": {"t": "", "c": "#8a7aa8"},
"files": {"js": {"t": "JS", "c": "#f0db4f"}, "php": {"t": "PHP", "c": "#8892bf"}},
"names": {"package.json": {"t": "NPM", "c": "#cb3837"}},
"folder": {"c": "#e6b85c"},
"folders": {"src": "#5fc8a0", "docs": "#6aa5f0"}
}}
“files”: by extension (no dot); “names”: by full file name (takes priority); “t”: 1 to 4 characters shown in the badge; “folders”: color by folder name.
Code snippets (API 2)
"contributes": { "snippets": [{ "language": "php", "items": [
{ "prefix": "foreachk", "label": "foreach clé => valeur",
"description": {"fr": "Boucle sur un tableau", "en": "Loop over an array"},
"body": ["foreach (\\$${1:liste} as \\$${2:cle} => \\$${3:valeur}) {", "\t$0", "}"] }
]}]}
“language” is the language id in Scriptorium (html, css, php, lua, java, python, dart, kotlin, swift, xml…). The body uses snippet syntax: ${1:default} (fill-in stops, in order), $0 (final cursor position). A literal $ is written \$. Snippets show up in suggestions (Ctrl+Space) and are accepted with Tab or Enter.
File types and abbreviations (API 2)
"contributes": {
"fileTypes": [{ "language": "ini", "extensions": [".cfg"], "filenames": ["server.cfg"] }],
"emmet": ["html", "php"]
}
“fileTypes” maps extensions or file names to a language. “emmet” turns on HTML abbreviations (ul>li*3, div.card#one>h2{Title}…) in the listed languages.
File templates (API 2)
"contributes": { "templates": [{
"id": "fivem-resource", "label": {"fr": "Ressource FiveM", "en": "FiveM resource"},
"files": [
{ "path": "{{name}}/fxmanifest.lua", "content": "fx_version 'cerulean'\ngame 'gta5'\n" },
{ "path": "{{name}}/client/main.lua", "content": "-- {{name}}\n" }
]
}]}
The user picks the template (File › New from Template) then a name; {{name}} and {{NAME}} are replaced in paths and contents. Paths are relative to the open folder (no “..”), at most 30 files, 100 KB each. Nothing is overwritten: if a file already exists, nothing is created.
Try it
Save the file as .scrext, then drag it into Scriptorium (see “Install an extension”). If the file is refused, nothing is installed.