Saltar al contenido

Temas

shikiphp incluye el conjunto completo de temas de Shiki: los 65 temas VS Code de tm-themes 1.12.2, el conjunto que incluye Shiki 3.23.0. 44 son oscuros y 21 claros. Entre los identificadores más populares están github-dark, github-light, nord, dracula, vitesse-dark, vitesse-light, one-dark-pro, monokai, solarized-dark y las familias catppuccin-* y material-theme-*.

Use un solo tema con la opción theme, o dos (o más) con themes para generar variables CSS claras y oscuras. Consulte Primeros pasos.

PHP
use Shikiphp\Shikiphp;

echo Shikiphp::codeToHtml('const answer = 42', [
    'lang'   => 'js',
    'themes' => ['light' => 'github-light', 'dark' => 'github-dark'],
]);

Un ID de tema que el paquete no reconoce genera Shikiphp\Exceptions\Highlight con el mensaje Unknown theme "…".

Qué controla un tema

Un tema define el primer plano y el fondo del bloque (que se escriben en <pre>), así como el color y el estilo de fuente (cursiva, negrita, subrayado y tachado) de cada token, según la especificidad del selector de ámbito. Para lang: 'ansi', sus colores terminal.ansi* pasan a ser la paleta ANSI (consulte ANSI). Para ajustar colores individuales sin editar un tema, use colorReplacements.

Lista de temas incluidos

Desde PHP:

PHP
use Shikiphp\Shikiphp;

$highlighter = Shikiphp::highlighter();

$highlighter->bundledThemes(); // list<string> — ids shipped in the box
$highlighter->loadedThemes();  // list<string> — bundled plus any you registered

O desde la línea de comandos, un ID por línea y en orden alfabético:

Shell
vendor/bin/shikiphp themes

Catálogo

El tipo es el tipo light o dark que el paquete registra para cada tema; resulta útil al elegir un par para la opción themes.

Tema ID Tipo
Andromeeda andromeeda oscuro
Aurora X aurora-x oscuro
Ayu Dark ayu-dark oscuro
Ayu Light ayu-light claro
Ayu Mirage ayu-mirage oscuro
Catppuccin Frappé catppuccin-frappe oscuro
Catppuccin Latte catppuccin-latte claro
Catppuccin Macchiato catppuccin-macchiato oscuro
Catppuccin Mocha catppuccin-mocha oscuro
Dark Plus dark-plus oscuro
Dracula Theme dracula oscuro
Dracula Theme Soft dracula-soft oscuro
Everforest Dark everforest-dark oscuro
Everforest Light everforest-light claro
GitHub Dark github-dark oscuro
GitHub Dark Default github-dark-default oscuro
GitHub Dark Dimmed github-dark-dimmed oscuro
GitHub Dark High Contrast github-dark-high-contrast oscuro
GitHub Light github-light claro
GitHub Light Default github-light-default claro
GitHub Light High Contrast github-light-high-contrast claro
Gruvbox Dark Hard gruvbox-dark-hard oscuro
Gruvbox Dark Medium gruvbox-dark-medium oscuro
Gruvbox Dark Soft gruvbox-dark-soft oscuro
Gruvbox Light Hard gruvbox-light-hard claro
Gruvbox Light Medium gruvbox-light-medium claro
Gruvbox Light Soft gruvbox-light-soft claro
Horizon horizon oscuro
Horizon Bright horizon-bright claro
Houston houston oscuro
Kanagawa Dragon kanagawa-dragon oscuro
Kanagawa Lotus kanagawa-lotus claro
Kanagawa Wave kanagawa-wave oscuro
LaserWave laserwave oscuro
Light Plus light-plus claro
Material Theme material-theme oscuro
Material Theme Darker material-theme-darker oscuro
Material Theme Lighter material-theme-lighter claro
Material Theme Ocean material-theme-ocean oscuro
Material Theme Palenight material-theme-palenight oscuro
Min Dark min-dark oscuro
Min Light min-light claro
Monokai monokai oscuro
Night Owl night-owl oscuro
Night Owl Light night-owl-light claro
Nord nord oscuro
One Dark Pro one-dark-pro oscuro
One Light one-light claro
Plastic plastic oscuro
Poimandres poimandres oscuro
Red red oscuro
Rosé Pine rose-pine oscuro
Rosé Pine Dawn rose-pine-dawn claro
Rosé Pine Moon rose-pine-moon oscuro
Slack Dark slack-dark oscuro
Slack Ochin slack-ochin claro
Snazzy Light snazzy-light claro
Solarized Dark solarized-dark oscuro
Solarized Light solarized-light claro
Synthwave '84 synthwave-84 oscuro
Tokyo Night tokyo-night oscuro
Vesper vesper oscuro
Vitesse Black vitesse-black oscuro
Vitesse Dark vitesse-dark oscuro
Vitesse Light vitesse-light claro

Añadir idiomas propios

Registre un VS Code tema JSON personalizado con loadTheme. Consulte Idiomas y temas personalizados.