
Convert a Visual Studio Code or Positron theme file to TextMate
Source:R/convert-vs-to-tm.R
convert_vs_to_tm_theme.RdConvert a .json file representing a Visual Studio Code or Positron
theme and write the equivalent TextMate theme file (.tmTheme).
convert_positron_to_tm_theme() is an alias for
convert_vs_to_tm_theme().
Arguments
- path
Path or URL to a Visual Studio Code or Positron theme file in
.jsonformat.- 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 .tmTheme file to
outfile and returns the file path.
See also
read_vs_theme() to inspect the input theme and read_tm_theme()
to inspect the converted theme.
Theme file converters:
convert_tm_to_vs_theme(),
convert_to_rstudio_theme()
Examples
vstheme <- system.file("ext/test-simple-color-theme.json",
package = "rstudiothemes"
)
path <- convert_vs_to_tm_theme(vstheme)
#> ! The Visual Studio Code theme "Skeletor Syntax" does not list an author. Use the `author` argument.
#> ℹ Using default `author = "rstudiothemes R package"`.
readLines(path) |>
head(50) |>
cat(sep = "\n")
#> <?xml version="1.0" encoding="UTF-8"?>
#> <plist version="1.0">
#> <dict>
#> <key>name</key>
#> <string>Skeletor Syntax</string>
#> <key>author</key>
#> <string>rstudiothemes R package</string>
#> <key>colorSpaceName</key>
#> <string>sRGB</string>
#> <key>semanticClass</key>
#> <string>theme.dark.skeletor_syntax</string>
#> <key>comment</key>
#> <string>Generated with rstudiothemes R package</string>
#> <key>uuid</key>
#> <string>65623931-3630-4063-b063-653630303437</string>
#> <key>settings</key>
#> <array>
#> <dict>
#> <key>settings</key>
#> <dict>
#> <key>background</key>
#> <string>#2B2836</string>
#> <key>foreground</key>
#> <string>#DCE7FD</string>
#> <key>selection</key>
#> <string>#55535E</string>
#> <key>lineHighlight</key>
#> <string>#55535E</string>
#> <key>caret</key>
#> <string>#BD93F9</string>
#> <key>invisibles</key>
#> <string>#363340</string>
#> <key>gutterForeground</key>
#> <string>#655E7F</string>
#> </dict>
#> </dict>
#> <dict>
#> <key>name</key>
#> <string>comment</string>
#> <key>scope</key>
#> <string>comment</string>
#> <key>settings</key>
#> <dict>
#> <key>foreground</key>
#> <string>#655E7F</string>
#> </dict>
#> </dict>
#> <dict>
#> <key>name</key>
#> <string>doctype</string>