
Convert a TextMate theme file to Visual Studio Code or Positron
Source:R/convert-tm-to-vs.R
convert_tm_to_vs_theme.RdConvert a .tmTheme file representing a TextMate theme and write the
equivalent Visual Studio Code theme file (.json).
convert_tm_to_positron_theme() is an alias for
convert_tm_to_vs_theme().
Arguments
- path
Path or URL to a TextMate theme file in
.tmThemeformat.- outfile
Path where the resulting file will be written. Defaults to a temporary file created with
tempfile().- name
Theme name. If
NULL, the name from the input file is used.Theme author. If
NULL, the author is extracted from the input file, otherwise it defaults to "rstudiothemes R package".
Value
This function is called for its side effects. It writes a .json theme file
to outfile and returns the path.
See also
read_tm_theme() to inspect the input theme and read_vs_theme()
to inspect the converted theme.
Theme file converters:
convert_to_rstudio_theme(),
convert_vs_to_tm_theme()
Examples
tmtheme <- system.file("ext/test.tmTheme",
package = "rstudiothemes"
)
path <- convert_tm_to_vs_theme(tmtheme)
readLines(path) |>
head(50) |>
cat(sep = "\n")
#> {
#> // Created with the rstudiothemes R package (c) dieghernan.
#> // https://github.com/dieghernan/rstudiothemes
#> "$schema": "vscode://schemas/color-theme",
#> "name": "Testing RStudioTheme",
#> "author": "rstudiothemes",
#> "semanticHighlighting": true,
#> "type": "dark",
#> "tokenColors": [
#> {
#> "settings": {
#> "foreground": "#DCE7FD"
#> }
#> },
#> {
#> "name": "comment",
#> "scope": "comment",
#> "settings": {
#> "foreground": "#655E7F"
#> }
#> },
#> {
#> "name": "doctype",
#> "scope": ["meta.tag.metadata.doctype", "meta.tag.sgml.doctype.html", "meta.tag.sgml.html"],
#> "settings": {
#> "foreground": "#655E7F"
#> }
#> },
#> {
#> "name": "punctuation",
#> "scope": ["punctuation.definition.tag", "punctuation.separator"],
#> "settings": {
#> "foreground": "#DCE7FD"
#> }
#> },
#> {
#> "name": "namespace,",
#> "scope": ["entity.name.type.namespace", "storage.modifier.import"],
#> "settings": {
#> "foreground": "#6A6872"
#> }
#> },
#> {
#> "name": "string",
#> "scope": "string",
#> "settings": {
#> "foreground": "#93B4FF"
#> }
#> },
#> {