1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

doc: document /theme command and theme file format

Add the "Themes" section to user guides and plugin API references in
every language where the corresponding adoc exists.

User guide (10 files): English (the new prose) and French (a full
translation, with section title "Thèmes"). For the other languages —
German, Italian, Japanese, Polish, Serbian — the body is the English
text with only the section title localized where the existing Colors
section is localized (Themen / Motywy / Теме); Italian and Japanese
keep the English "Themes" title to match their existing English-only
section titles. Coverage by file:

  - doc/en/weechat_user.en.adoc       (new English section)
  - doc/fr/weechat_user.fr.adoc       (full French translation)
  - doc/de/weechat_user.de.adoc       (English body, "Themen" title)
  - doc/it/weechat_user.it.adoc       (English body and title)
  - doc/ja/weechat_user.ja.adoc       (English body and title)
  - doc/pl/weechat_user.pl.adoc       (English body, "Motywy" title)
  - doc/sr/weechat_user.sr.adoc       (English body, "Теме" title)

Plugin API reference (5 files): same approach — English plus full
French translation; Italian, Japanese and Serbian keep the English
body with their conventional section title:

  - doc/en/weechat_plugin_api.en.adoc (new English section)
  - doc/fr/weechat_plugin_api.fr.adoc (full French translation)
  - doc/it/weechat_plugin_api.it.adoc (English body and title)
  - doc/ja/weechat_plugin_api.ja.adoc (English body and title)
  - doc/sr/weechat_plugin_api.sr.adoc (English body, "Теме" title)

User-guide content covers themable options, /theme apply with the
automatic backup mechanism, /theme save and /theme delete with the
reserved-name rules, the .theme file format with a sample, and the
user-file-shadows-built-in resolution order. The API-reference content
documents weechat_theme_register (prototype, arguments, return value,
C example, Python example) with notes on the themable flag and
per-script auto-cleanup on script unload.

The /theme command's CMD_ARGS_DESC help text and the cmdline option
descriptions are picked up automatically by the doc generator
(doc-autogen), so no manual entries are needed there.
This commit is contained in:
Sébastien Helleu
2026-05-27 21:22:18 +02:00
parent d56e46908f
commit b970962bdb
12 changed files with 1296 additions and 0 deletions
+123
View File
@@ -2197,6 +2197,129 @@ Um der Vordergrundfarbe des Terminals das Attribut "fett" zuzuordnen:
/set weechat.color.status_time *99999
----
// TRANSLATION MISSING
[[themes]]
=== Themen
A theme is a named bundle of option overrides that can be applied with
the <<command_weechat_theme,/theme>> command. WeeChat ships a built-in
`"light"` theme tuned for light-background terminals and supports
user-defined themes loaded transiently from files.
[[themes_themable_options]]
==== Themable options
Themes can only set options marked as _themable_. All `*.color.*`
options are themable by default; a few string options that hold format
expressions with `+${color:...}+` references (such as
`+weechat.color.chat_nick_colors+`, `+weechat.look.prefix_error+` or the
`+buflist.format.*+` formats) are explicitly opted in.
You can list the full themable surface area from the
<<command_fset_fset,/fset>> buffer with the `+t:themable+` filter.
[[themes_apply]]
==== Applying a theme
To switch to the built-in light-background theme:
----
/theme apply light
----
The current state of every themable option is saved beforehand to a
backup theme file named like `+backup-YYYYMMDD-HHMMSS-uuuuuu+` in
directory `+themes+` inside the WeeChat configuration directory, so the
previous look can be restored at any time with:
----
/theme apply backup-YYYYMMDD-HHMMSS-uuuuuu
----
Backup creation can be disabled (not recommended):
----
/set weechat.look.theme_backup off
----
If backup is enabled and the backup file cannot be written, the apply
is aborted before any option is changed.
The name of the last applied theme is stored in
`+weechat.look.theme+` (informational only; not re-applied at startup).
[[themes_save_delete]]
==== Saving and deleting user themes
Save the current themable options as a new user theme file:
----
/theme save mytheme
----
By default only options whose value differs from their hardcoded
default are written, keeping the file small and focused. To capture
every themable option:
----
/theme save mytheme -full
----
Reserved names (built-in theme names like `+light+` and any name
starting with `+backup-+`) are refused. Files live at
`+${weechat_config_dir}/themes/<name>.theme+`.
Delete a user theme:
----
/theme delete mytheme
----
This removes the file on disk; built-in themes cannot be deleted.
[[themes_file_format]]
==== Theme file format
A theme file is INI-like with two sections:
----
[info]
name = "solarized_light"
description = "Light-background theme inspired by Solarized"
date = "2026-05-25 09:42:10"
weechat = "4.10.0-dev"
[options]
weechat.color.chat = "darkgray"
weechat.color.separator = "blue"
irc.color.input_nick = "magenta"
buflist.format.number = "${color:28}${number}${if:${number_displayed}?.: }"
----
`+[info]+` is informational metadata shown by `/theme info`. `+[options]+`
holds the actual overrides; keys are the full option names that would
appear in `/set`. String values can be enclosed in double or single
quotes; quotes are stripped at parse time. Non-themable options listed
in a theme file are refused at apply time and logged to the core
buffer (so a `.theme` file imported from an untrusted source cannot
overwrite passwords, autoload lists, or startup commands).
User theme files are never cached: on every `/theme apply <name>` the
file is parsed, applied, and freed.
[[themes_resolution]]
==== Resolution order
When `+/theme apply <name>+` is run:
* If `+${weechat_config_dir}/themes/<name>.theme+` exists, the file
is parsed and used (it shadows any built-in with the same name).
* Otherwise the built-in theme registry is consulted; built-ins are
registered programmatically by core, plugins and scripts (see the
plugin and scripting documentation for `+weechat_theme_register+`).
If neither source provides the name, the apply is refused.
[[charset]]
=== Charset
+83
View File
@@ -9627,6 +9627,89 @@ elif rc == weechat.WEECHAT_CONFIG_OPTION_UNSET_ERROR:
# ...
----
[[themes]]
=== Themes
Functions to contribute color (and other themable option) overrides to
built-in themes. See the
link:weechat_user.en.html#themes[user's guide / Themes] section for the
end-user side and the `+/theme+` command.
==== theme_register
_WeeChat ≥ 4.10.0._
Register a contribution of option overrides under a named theme. The
caller's plugin is the owner of the contribution; subsequent calls
with the same theme name from the same plugin merge into the existing
contribution (later keys win for duplicates).
When the calling plugin is unloaded, all its contributions are
automatically dropped from every theme.
Prototype:
[source,c]
----
struct t_theme *weechat_theme_register (const char *name,
struct t_hashtable *overrides);
----
Arguments:
* _name_: theme name (for example `+light+` or a custom name)
* _overrides_: hashtable mapping full option names
(e.g. `+irc.color.input_nick+`) to their string values; the caller
retains ownership and may free the hashtable right after the call
Return value:
* pointer to the registered theme (existing or newly created), NULL on
error
C example:
[source,c]
----
struct t_hashtable *overrides = weechat_hashtable_new (
8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL, NULL);
if (overrides)
{
weechat_hashtable_set (overrides, "irc.color.input_nick", "cyan");
weechat_hashtable_set (overrides, "irc.color.topic_old", "darkgray");
weechat_theme_register ("light", overrides);
weechat_hashtable_free (overrides);
}
----
Script (Python):
[source,python]
----
# prototype
def theme_register(name: str, overrides: Dict[str, str]) -> str: ...
# example
weechat.theme_register("light", {
"irc.color.input_nick": "cyan",
"irc.color.topic_old": "darkgray",
})
----
[NOTE]
Only options that have the _themable_ flag will be set by `/theme apply`.
All `*.color.*` options are themable by default; string options that
hold `+${color:...}+` references are explicitly opted in. Entries
targeting non-themable options are silently skipped at apply-time with
a warning logged to the _core_ buffer.
[NOTE]
When called from a script, the contribution is automatically dropped
when the script unloads (no manual cleanup is needed).
[[key_bindings]]
=== Key bindings
+122
View File
@@ -2185,6 +2185,128 @@ Example of bold with terminal foreground color:
/set weechat.color.status_time *99999
----
[[themes]]
=== Themes
A theme is a named bundle of option overrides that can be applied with
the <<command_weechat_theme,/theme>> command. WeeChat ships a built-in
`"light"` theme tuned for light-background terminals and supports
user-defined themes loaded transiently from files.
[[themes_themable_options]]
==== Themable options
Themes can only set options marked as _themable_. All `*.color.*`
options are themable by default; a few string options that hold format
expressions with `+${color:...}+` references (such as
`+weechat.color.chat_nick_colors+`, `+weechat.look.prefix_error+` or the
`+buflist.format.*+` formats) are explicitly opted in.
You can list the full themable surface area from the
<<command_fset_fset,/fset>> buffer with the `+t:themable+` filter.
[[themes_apply]]
==== Applying a theme
To switch to the built-in light-background theme:
----
/theme apply light
----
The current state of every themable option is saved beforehand to a
backup theme file named like `+backup-YYYYMMDD-HHMMSS-uuuuuu+` in
directory `+themes+` inside the WeeChat configuration directory, so the
previous look can be restored at any time with:
----
/theme apply backup-YYYYMMDD-HHMMSS-uuuuuu
----
Backup creation can be disabled (not recommended):
----
/set weechat.look.theme_backup off
----
If backup is enabled and the backup file cannot be written, the apply
is aborted before any option is changed.
The name of the last applied theme is stored in
`+weechat.look.theme+` (informational only; not re-applied at startup).
[[themes_save_delete]]
==== Saving and deleting user themes
Save the current themable options as a new user theme file:
----
/theme save mytheme
----
By default only options whose value differs from their hardcoded
default are written, keeping the file small and focused. To capture
every themable option:
----
/theme save mytheme -full
----
Reserved names (built-in theme names like `+light+` and any name
starting with `+backup-+`) are refused. Files live at
`+${weechat_config_dir}/themes/<name>.theme+`.
Delete a user theme:
----
/theme delete mytheme
----
This removes the file on disk; built-in themes cannot be deleted.
[[themes_file_format]]
==== Theme file format
A theme file is INI-like with two sections:
----
[info]
name = "solarized_light"
description = "Light-background theme inspired by Solarized"
date = "2026-05-25 09:42:10"
weechat = "4.10.0-dev"
[options]
weechat.color.chat = "darkgray"
weechat.color.separator = "blue"
irc.color.input_nick = "magenta"
buflist.format.number = "${color:28}${number}${if:${number_displayed}?.: }"
----
`+[info]+` is informational metadata shown by `/theme info`. `+[options]+`
holds the actual overrides; keys are the full option names that would
appear in `/set`. String values can be enclosed in double or single
quotes; quotes are stripped at parse time. Non-themable options listed
in a theme file are refused at apply time and logged to the core
buffer (so a `.theme` file imported from an untrusted source cannot
overwrite passwords, autoload lists, or startup commands).
User theme files are never cached: on every `/theme apply <name>` the
file is parsed, applied, and freed.
[[themes_resolution]]
==== Resolution order
When `+/theme apply <name>+` is run:
* If `+${weechat_config_dir}/themes/<name>.theme+` exists, the file
is parsed and used (it shadows any built-in with the same name).
* Otherwise the built-in theme registry is consulted; built-ins are
registered programmatically by core, plugins and scripts (see the
plugin and scripting documentation for `+weechat_theme_register+`).
If neither source provides the name, the apply is refused.
[[charset]]
=== Charset
+89
View File
@@ -9771,6 +9771,95 @@ elif rc == weechat.WEECHAT_CONFIG_OPTION_UNSET_ERROR:
# ...
----
[[themes]]
=== Thèmes
Fonctions permettant de contribuer des surcharges d'options de couleur
(et autres options modifiables par un thème) à des thèmes intégrés.
Voir la section
link:weechat_user.fr.html#themes[guide utilisateur / Thèmes] pour le
côté utilisateur final et la commande `+/theme+`.
==== theme_register
_WeeChat ≥ 4.10.0._
Enregistrer une contribution de surcharges d'options sous un thème
nommé. L'extension appelante est le propriétaire de la contribution ;
les appels suivants avec le même nom de thème depuis la même extension
sont fusionnés dans la contribution existante (en cas de doublons, les
dernières clés gagnent).
Lorsque l'extension appelante est déchargée, toutes ses contributions
sont automatiquement retirées de tous les thèmes.
Prototype :
[source,c]
----
struct t_theme *weechat_theme_register (const char *name,
struct t_hashtable *overrides);
----
Paramètres :
* _name_ : nom du thème (par exemple `+light+` ou un nom personnalisé)
* _overrides_ : table de hachage associant des noms d'options complets
(par exemple `+irc.color.input_nick+`) à leurs valeurs chaîne ;
l'appelant en conserve la propriété et peut la libérer juste après
l'appel
Valeur de retour :
* pointeur vers le thème enregistré (existant ou nouvellement créé),
NULL en cas d'erreur
Exemple en C :
[source,c]
----
struct t_hashtable *overrides = weechat_hashtable_new (
8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL, NULL);
if (overrides)
{
weechat_hashtable_set (overrides, "irc.color.input_nick", "cyan");
weechat_hashtable_set (overrides, "irc.color.topic_old", "darkgray");
weechat_theme_register ("light", overrides);
weechat_hashtable_free (overrides);
}
----
Script (Python) :
[source,python]
----
# prototype
def theme_register(name: str, overrides: Dict[str, str]) -> str: ...
# exemple
weechat.theme_register("light", {
"irc.color.input_nick": "cyan",
"irc.color.topic_old": "darkgray",
})
----
[NOTE]
Seules les options possédant le flag _themable_ seront modifiées par
`/theme apply`. Toutes les options `*.color.*` sont modifiables par
défaut ; les options de type chaîne contenant des références
`+${color:...}+` sont explicitement déclarées comme modifiables. Les
entrées ciblant des options non modifiables sont silencieusement
ignorées au moment de l'application avec un avertissement écrit sur
le tampon _core_.
[NOTE]
Lorsqu'elle est appelée depuis un script, la contribution est
automatiquement retirée lorsque le script est déchargé (aucun nettoyage
manuel n'est nécessaire).
[[key_bindings]]
=== Associations de touches
+135
View File
@@ -2227,6 +2227,141 @@ Exemple de gras avec la couleur de texte du terminal :
/set weechat.color.status_time *99999
----
[[themes]]
=== Thèmes
Un thème est un ensemble nommé de surcharges d'options qui peut être
appliqué par la commande <<command_weechat_theme,/theme>>. WeeChat est
livré avec un thème intégré `"light"` adapté aux terminaux à fond clair
et permet de charger temporairement des thèmes utilisateur depuis des
fichiers.
[[themes_themable_options]]
==== Options modifiables par un thème
Les thèmes ne peuvent modifier que les options marquées comme
_themable_ (modifiables par un thème). Toutes les options `*.color.*`
le sont par défaut ; certaines options de type chaîne contenant des
références `+${color:...}+` (par exemple
`+weechat.color.chat_nick_colors+`, `+weechat.look.prefix_error+` ou les
formats `+buflist.format.*+`) sont explicitement déclarées comme
modifiables.
La liste complète des options modifiables peut être affichée depuis le
tampon <<command_fset_fset,/fset>> avec le filtre `+t:themable+`.
[[themes_apply]]
==== Appliquer un thème
Pour basculer vers le thème intégré pour fond clair :
----
/theme apply light
----
L'état actuel de toutes les options modifiables est sauvegardé au
préalable dans un fichier de sauvegarde nommé
`+backup-AAAAMMJJ-HHMMSS-uuuuuu+` dans le répertoire `+themes+` du
répertoire de configuration de WeeChat. L'apparence précédente peut
ainsi être restaurée à tout moment avec :
----
/theme apply backup-AAAAMMJJ-HHMMSS-uuuuuu
----
La création de la sauvegarde peut être désactivée (déconseillé) :
----
/set weechat.look.theme_backup off
----
Si la sauvegarde est activée et que le fichier ne peut pas être écrit,
l'application est annulée avant qu'aucune option ne soit modifiée.
Le nom du dernier thème appliqué est conservé dans
`+weechat.look.theme+` (à titre informatif uniquement ; il n'est pas
ré-appliqué au démarrage).
[[themes_save_delete]]
==== Sauvegarder et supprimer des thèmes utilisateur
Sauvegarder l'état actuel des options modifiables en tant que nouveau
thème utilisateur :
----
/theme save monTheme
----
Par défaut, seules les options dont la valeur diffère de la valeur par
défaut codée en dur sont écrites, ce qui garde le fichier compact et
ciblé. Pour capturer toutes les options modifiables :
----
/theme save monTheme -full
----
Les noms réservés (noms de thèmes intégrés comme `+light+` et tout nom
commençant par `+backup-+`) sont refusés. Les fichiers sont placés
dans `+${weechat_config_dir}/themes/<nom>.theme+`.
Supprimer un thème utilisateur :
----
/theme delete monTheme
----
Cela supprime le fichier sur le disque ; les thèmes intégrés ne
peuvent pas être supprimés.
[[themes_file_format]]
==== Format du fichier de thème
Un fichier de thème est de type INI avec deux sections :
----
[info]
name = "solarized_light"
description = "Thème fond clair inspiré de Solarized"
date = "2026-05-25 09:42:10"
weechat = "4.10.0-dev"
[options]
weechat.color.chat = "darkgray"
weechat.color.separator = "blue"
irc.color.input_nick = "magenta"
buflist.format.number = "${color:28}${number}${if:${number_displayed}?.: }"
----
`+[info]+` est une section de métadonnées informatives affichées par
`/theme info`. `+[options]+` contient les surcharges réelles ; les clés
sont les noms complets d'options tels qu'affichés par `/set`. Les
valeurs de type chaîne peuvent être encadrées par des guillemets
simples ou doubles ; les guillemets sont retirés à l'analyse. Les
options non modifiables par un thème listées dans un fichier sont
refusées au moment de l'application et signalées sur le tampon _core_
(ainsi, un fichier `.theme` importé depuis une source non fiable ne
peut pas écraser des mots de passe, des listes d'auto-chargement ou
des commandes de démarrage).
Les fichiers de thème utilisateur ne sont jamais mis en cache : à
chaque `/theme apply <nom>`, le fichier est analysé, appliqué, puis
libéré.
[[themes_resolution]]
==== Ordre de résolution
Lors de l'exécution de `+/theme apply <nom>+` :
* Si `+${weechat_config_dir}/themes/<nom>.theme+` existe, le fichier
est analysé et utilisé (il masque tout thème intégré du même nom).
* Sinon, le registre des thèmes intégrés est consulté ; les thèmes
intégrés sont enregistrés par programmation par le cœur, les
extensions et les scripts (voir la documentation des extensions et
des scripts pour `+weechat_theme_register+`).
Si aucune des deux sources ne fournit le nom, l'application est
refusée.
[[charset]]
=== Charset
+84
View File
@@ -9967,6 +9967,90 @@ elif rc == weechat.WEECHAT_CONFIG_OPTION_UNSET_ERROR:
# ...
----
// TRANSLATION MISSING
[[themes]]
=== Themes
Functions to contribute color (and other themable option) overrides to
built-in themes. See the
link:weechat_user.it.html#themes[user's guide / Themes] section for the
end-user side and the `+/theme+` command.
==== theme_register
_WeeChat ≥ 4.10.0._
Register a contribution of option overrides under a named theme. The
caller's plugin is the owner of the contribution; subsequent calls
with the same theme name from the same plugin merge into the existing
contribution (later keys win for duplicates).
When the calling plugin is unloaded, all its contributions are
automatically dropped from every theme.
Prototype:
[source,c]
----
struct t_theme *weechat_theme_register (const char *name,
struct t_hashtable *overrides);
----
Arguments:
* _name_: theme name (for example `+light+` or a custom name)
* _overrides_: hashtable mapping full option names
(e.g. `+irc.color.input_nick+`) to their string values; the caller
retains ownership and may free the hashtable right after the call
Return value:
* pointer to the registered theme (existing or newly created), NULL on
error
C example:
[source,c]
----
struct t_hashtable *overrides = weechat_hashtable_new (
8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL, NULL);
if (overrides)
{
weechat_hashtable_set (overrides, "irc.color.input_nick", "cyan");
weechat_hashtable_set (overrides, "irc.color.topic_old", "darkgray");
weechat_theme_register ("light", overrides);
weechat_hashtable_free (overrides);
}
----
Script (Python):
[source,python]
----
# prototype
def theme_register(name: str, overrides: Dict[str, str]) -> str: ...
# example
weechat.theme_register("light", {
"irc.color.input_nick": "cyan",
"irc.color.topic_old": "darkgray",
})
----
[NOTE]
Only options that have the _themable_ flag will be set by `/theme apply`.
All `*.color.*` options are themable by default; string options that
hold `+${color:...}+` references are explicitly opted in. Entries
targeting non-themable options are silently skipped at apply-time with
a warning logged to the _core_ buffer.
[NOTE]
When called from a script, the contribution is automatically dropped
when the script unloads (no manual cleanup is needed).
[[key_bindings]]
=== Combinazione tasti
+123
View File
@@ -2439,6 +2439,129 @@ Esempio di grassetto con il colore di primo piano del terminale:
/set weechat.color.status_time *99999
----
// TRANSLATION MISSING
[[themes]]
=== Themes
A theme is a named bundle of option overrides that can be applied with
the <<command_weechat_theme,/theme>> command. WeeChat ships a built-in
`"light"` theme tuned for light-background terminals and supports
user-defined themes loaded transiently from files.
[[themes_themable_options]]
==== Themable options
Themes can only set options marked as _themable_. All `*.color.*`
options are themable by default; a few string options that hold format
expressions with `+${color:...}+` references (such as
`+weechat.color.chat_nick_colors+`, `+weechat.look.prefix_error+` or the
`+buflist.format.*+` formats) are explicitly opted in.
You can list the full themable surface area from the
<<command_fset_fset,/fset>> buffer with the `+t:themable+` filter.
[[themes_apply]]
==== Applying a theme
To switch to the built-in light-background theme:
----
/theme apply light
----
The current state of every themable option is saved beforehand to a
backup theme file named like `+backup-YYYYMMDD-HHMMSS-uuuuuu+` in
directory `+themes+` inside the WeeChat configuration directory, so the
previous look can be restored at any time with:
----
/theme apply backup-YYYYMMDD-HHMMSS-uuuuuu
----
Backup creation can be disabled (not recommended):
----
/set weechat.look.theme_backup off
----
If backup is enabled and the backup file cannot be written, the apply
is aborted before any option is changed.
The name of the last applied theme is stored in
`+weechat.look.theme+` (informational only; not re-applied at startup).
[[themes_save_delete]]
==== Saving and deleting user themes
Save the current themable options as a new user theme file:
----
/theme save mytheme
----
By default only options whose value differs from their hardcoded
default are written, keeping the file small and focused. To capture
every themable option:
----
/theme save mytheme -full
----
Reserved names (built-in theme names like `+light+` and any name
starting with `+backup-+`) are refused. Files live at
`+${weechat_config_dir}/themes/<name>.theme+`.
Delete a user theme:
----
/theme delete mytheme
----
This removes the file on disk; built-in themes cannot be deleted.
[[themes_file_format]]
==== Theme file format
A theme file is INI-like with two sections:
----
[info]
name = "solarized_light"
description = "Light-background theme inspired by Solarized"
date = "2026-05-25 09:42:10"
weechat = "4.10.0-dev"
[options]
weechat.color.chat = "darkgray"
weechat.color.separator = "blue"
irc.color.input_nick = "magenta"
buflist.format.number = "${color:28}${number}${if:${number_displayed}?.: }"
----
`+[info]+` is informational metadata shown by `/theme info`. `+[options]+`
holds the actual overrides; keys are the full option names that would
appear in `/set`. String values can be enclosed in double or single
quotes; quotes are stripped at parse time. Non-themable options listed
in a theme file are refused at apply time and logged to the core
buffer (so a `.theme` file imported from an untrusted source cannot
overwrite passwords, autoload lists, or startup commands).
User theme files are never cached: on every `/theme apply <name>` the
file is parsed, applied, and freed.
[[themes_resolution]]
==== Resolution order
When `+/theme apply <name>+` is run:
* If `+${weechat_config_dir}/themes/<name>.theme+` exists, the file
is parsed and used (it shadows any built-in with the same name).
* Otherwise the built-in theme registry is consulted; built-ins are
registered programmatically by core, plugins and scripts (see the
plugin and scripting documentation for `+weechat_theme_register+`).
If neither source provides the name, the apply is refused.
[[charset]]
=== Charset
+84
View File
@@ -9746,6 +9746,90 @@ elif rc == weechat.WEECHAT_CONFIG_OPTION_UNSET_ERROR:
# ...
----
// TRANSLATION MISSING
[[themes]]
=== Themes
Functions to contribute color (and other themable option) overrides to
built-in themes. See the
link:weechat_user.ja.html#themes[user's guide / Themes] section for the
end-user side and the `+/theme+` command.
==== theme_register
_WeeChat ≥ 4.10.0._
Register a contribution of option overrides under a named theme. The
caller's plugin is the owner of the contribution; subsequent calls
with the same theme name from the same plugin merge into the existing
contribution (later keys win for duplicates).
When the calling plugin is unloaded, all its contributions are
automatically dropped from every theme.
Prototype:
[source,c]
----
struct t_theme *weechat_theme_register (const char *name,
struct t_hashtable *overrides);
----
Arguments:
* _name_: theme name (for example `+light+` or a custom name)
* _overrides_: hashtable mapping full option names
(e.g. `+irc.color.input_nick+`) to their string values; the caller
retains ownership and may free the hashtable right after the call
Return value:
* pointer to the registered theme (existing or newly created), NULL on
error
C example:
[source,c]
----
struct t_hashtable *overrides = weechat_hashtable_new (
8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL, NULL);
if (overrides)
{
weechat_hashtable_set (overrides, "irc.color.input_nick", "cyan");
weechat_hashtable_set (overrides, "irc.color.topic_old", "darkgray");
weechat_theme_register ("light", overrides);
weechat_hashtable_free (overrides);
}
----
Script (Python):
[source,python]
----
# prototype
def theme_register(name: str, overrides: Dict[str, str]) -> str: ...
# example
weechat.theme_register("light", {
"irc.color.input_nick": "cyan",
"irc.color.topic_old": "darkgray",
})
----
[NOTE]
Only options that have the _themable_ flag will be set by `/theme apply`.
All `*.color.*` options are themable by default; string options that
hold `+${color:...}+` references are explicitly opted in. Entries
targeting non-themable options are silently skipped at apply-time with
a warning logged to the _core_ buffer.
[NOTE]
When called from a script, the contribution is automatically dropped
when the script unloads (no manual cleanup is needed).
[[key_bindings]]
=== キー割り当て
+123
View File
@@ -2375,6 +2375,129 @@ WeeChat は画面に色が表示された時点で色ペアを動的に割り当
/set weechat.color.status_time *99999
----
// TRANSLATION MISSING
[[themes]]
=== Themes
A theme is a named bundle of option overrides that can be applied with
the <<command_weechat_theme,/theme>> command. WeeChat ships a built-in
`"light"` theme tuned for light-background terminals and supports
user-defined themes loaded transiently from files.
[[themes_themable_options]]
==== Themable options
Themes can only set options marked as _themable_. All `*.color.*`
options are themable by default; a few string options that hold format
expressions with `+${color:...}+` references (such as
`+weechat.color.chat_nick_colors+`, `+weechat.look.prefix_error+` or the
`+buflist.format.*+` formats) are explicitly opted in.
You can list the full themable surface area from the
<<command_fset_fset,/fset>> buffer with the `+t:themable+` filter.
[[themes_apply]]
==== Applying a theme
To switch to the built-in light-background theme:
----
/theme apply light
----
The current state of every themable option is saved beforehand to a
backup theme file named like `+backup-YYYYMMDD-HHMMSS-uuuuuu+` in
directory `+themes+` inside the WeeChat configuration directory, so the
previous look can be restored at any time with:
----
/theme apply backup-YYYYMMDD-HHMMSS-uuuuuu
----
Backup creation can be disabled (not recommended):
----
/set weechat.look.theme_backup off
----
If backup is enabled and the backup file cannot be written, the apply
is aborted before any option is changed.
The name of the last applied theme is stored in
`+weechat.look.theme+` (informational only; not re-applied at startup).
[[themes_save_delete]]
==== Saving and deleting user themes
Save the current themable options as a new user theme file:
----
/theme save mytheme
----
By default only options whose value differs from their hardcoded
default are written, keeping the file small and focused. To capture
every themable option:
----
/theme save mytheme -full
----
Reserved names (built-in theme names like `+light+` and any name
starting with `+backup-+`) are refused. Files live at
`+${weechat_config_dir}/themes/<name>.theme+`.
Delete a user theme:
----
/theme delete mytheme
----
This removes the file on disk; built-in themes cannot be deleted.
[[themes_file_format]]
==== Theme file format
A theme file is INI-like with two sections:
----
[info]
name = "solarized_light"
description = "Light-background theme inspired by Solarized"
date = "2026-05-25 09:42:10"
weechat = "4.10.0-dev"
[options]
weechat.color.chat = "darkgray"
weechat.color.separator = "blue"
irc.color.input_nick = "magenta"
buflist.format.number = "${color:28}${number}${if:${number_displayed}?.: }"
----
`+[info]+` is informational metadata shown by `/theme info`. `+[options]+`
holds the actual overrides; keys are the full option names that would
appear in `/set`. String values can be enclosed in double or single
quotes; quotes are stripped at parse time. Non-themable options listed
in a theme file are refused at apply time and logged to the core
buffer (so a `.theme` file imported from an untrusted source cannot
overwrite passwords, autoload lists, or startup commands).
User theme files are never cached: on every `/theme apply <name>` the
file is parsed, applied, and freed.
[[themes_resolution]]
==== Resolution order
When `+/theme apply <name>+` is run:
* If `+${weechat_config_dir}/themes/<name>.theme+` exists, the file
is parsed and used (it shadows any built-in with the same name).
* Otherwise the built-in theme registry is consulted; built-ins are
registered programmatically by core, plugins and scripts (see the
plugin and scripting documentation for `+weechat_theme_register+`).
If neither source provides the name, the apply is refused.
[[charset]]
=== Charset
+123
View File
@@ -2191,6 +2191,129 @@ Przykład pogrubienia z domyślnym kolorem terminala:
/set weechat.color.status_time *99999
----
// TRANSLATION MISSING
[[themes]]
=== Motywy
A theme is a named bundle of option overrides that can be applied with
the <<command_weechat_theme,/theme>> command. WeeChat ships a built-in
`"light"` theme tuned for light-background terminals and supports
user-defined themes loaded transiently from files.
[[themes_themable_options]]
==== Themable options
Themes can only set options marked as _themable_. All `*.color.*`
options are themable by default; a few string options that hold format
expressions with `+${color:...}+` references (such as
`+weechat.color.chat_nick_colors+`, `+weechat.look.prefix_error+` or the
`+buflist.format.*+` formats) are explicitly opted in.
You can list the full themable surface area from the
<<command_fset_fset,/fset>> buffer with the `+t:themable+` filter.
[[themes_apply]]
==== Applying a theme
To switch to the built-in light-background theme:
----
/theme apply light
----
The current state of every themable option is saved beforehand to a
backup theme file named like `+backup-YYYYMMDD-HHMMSS-uuuuuu+` in
directory `+themes+` inside the WeeChat configuration directory, so the
previous look can be restored at any time with:
----
/theme apply backup-YYYYMMDD-HHMMSS-uuuuuu
----
Backup creation can be disabled (not recommended):
----
/set weechat.look.theme_backup off
----
If backup is enabled and the backup file cannot be written, the apply
is aborted before any option is changed.
The name of the last applied theme is stored in
`+weechat.look.theme+` (informational only; not re-applied at startup).
[[themes_save_delete]]
==== Saving and deleting user themes
Save the current themable options as a new user theme file:
----
/theme save mytheme
----
By default only options whose value differs from their hardcoded
default are written, keeping the file small and focused. To capture
every themable option:
----
/theme save mytheme -full
----
Reserved names (built-in theme names like `+light+` and any name
starting with `+backup-+`) are refused. Files live at
`+${weechat_config_dir}/themes/<name>.theme+`.
Delete a user theme:
----
/theme delete mytheme
----
This removes the file on disk; built-in themes cannot be deleted.
[[themes_file_format]]
==== Theme file format
A theme file is INI-like with two sections:
----
[info]
name = "solarized_light"
description = "Light-background theme inspired by Solarized"
date = "2026-05-25 09:42:10"
weechat = "4.10.0-dev"
[options]
weechat.color.chat = "darkgray"
weechat.color.separator = "blue"
irc.color.input_nick = "magenta"
buflist.format.number = "${color:28}${number}${if:${number_displayed}?.: }"
----
`+[info]+` is informational metadata shown by `/theme info`. `+[options]+`
holds the actual overrides; keys are the full option names that would
appear in `/set`. String values can be enclosed in double or single
quotes; quotes are stripped at parse time. Non-themable options listed
in a theme file are refused at apply time and logged to the core
buffer (so a `.theme` file imported from an untrusted source cannot
overwrite passwords, autoload lists, or startup commands).
User theme files are never cached: on every `/theme apply <name>` the
file is parsed, applied, and freed.
[[themes_resolution]]
==== Resolution order
When `+/theme apply <name>+` is run:
* If `+${weechat_config_dir}/themes/<name>.theme+` exists, the file
is parsed and used (it shadows any built-in with the same name).
* Otherwise the built-in theme registry is consulted; built-ins are
registered programmatically by core, plugins and scripts (see the
plugin and scripting documentation for `+weechat_theme_register+`).
If neither source provides the name, the apply is refused.
[[charset]]
=== Charset
+84
View File
@@ -9436,6 +9436,90 @@ elif rc == weechat.WEECHAT_CONFIG_OPTION_UNSET_ERROR:
# ...
----
// TRANSLATION MISSING
[[themes]]
=== Теме
Functions to contribute color (and other themable option) overrides to
built-in themes. See the
link:weechat_user.sr.html#themes[user's guide / Themes] section for the
end-user side and the `+/theme+` command.
==== theme_register
_WeeChat ≥ 4.10.0._
Register a contribution of option overrides under a named theme. The
caller's plugin is the owner of the contribution; subsequent calls
with the same theme name from the same plugin merge into the existing
contribution (later keys win for duplicates).
When the calling plugin is unloaded, all its contributions are
automatically dropped from every theme.
Prototype:
[source,c]
----
struct t_theme *weechat_theme_register (const char *name,
struct t_hashtable *overrides);
----
Arguments:
* _name_: theme name (for example `+light+` or a custom name)
* _overrides_: hashtable mapping full option names
(e.g. `+irc.color.input_nick+`) to their string values; the caller
retains ownership and may free the hashtable right after the call
Return value:
* pointer to the registered theme (existing or newly created), NULL on
error
C example:
[source,c]
----
struct t_hashtable *overrides = weechat_hashtable_new (
8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL, NULL);
if (overrides)
{
weechat_hashtable_set (overrides, "irc.color.input_nick", "cyan");
weechat_hashtable_set (overrides, "irc.color.topic_old", "darkgray");
weechat_theme_register ("light", overrides);
weechat_hashtable_free (overrides);
}
----
Script (Python):
[source,python]
----
# prototype
def theme_register(name: str, overrides: Dict[str, str]) -> str: ...
# example
weechat.theme_register("light", {
"irc.color.input_nick": "cyan",
"irc.color.topic_old": "darkgray",
})
----
[NOTE]
Only options that have the _themable_ flag will be set by `/theme apply`.
All `*.color.*` options are themable by default; string options that
hold `+${color:...}+` references are explicitly opted in. Entries
targeting non-themable options are silently skipped at apply-time with
a warning logged to the _core_ buffer.
[NOTE]
When called from a script, the contribution is automatically dropped
when the script unloads (no manual cleanup is needed).
[[key_bindings]]
=== Тастерске пречице
+123
View File
@@ -2093,6 +2093,129 @@ include::{autogendir}/autogen_user_options.sr.adoc[tag=fset_options]
/set weechat.color.status_time *99999
----
// TRANSLATION MISSING
[[themes]]
=== Теме
A theme is a named bundle of option overrides that can be applied with
the <<command_weechat_theme,/theme>> command. WeeChat ships a built-in
`"light"` theme tuned for light-background terminals and supports
user-defined themes loaded transiently from files.
[[themes_themable_options]]
==== Themable options
Themes can only set options marked as _themable_. All `*.color.*`
options are themable by default; a few string options that hold format
expressions with `+${color:...}+` references (such as
`+weechat.color.chat_nick_colors+`, `+weechat.look.prefix_error+` or the
`+buflist.format.*+` formats) are explicitly opted in.
You can list the full themable surface area from the
<<command_fset_fset,/fset>> buffer with the `+t:themable+` filter.
[[themes_apply]]
==== Applying a theme
To switch to the built-in light-background theme:
----
/theme apply light
----
The current state of every themable option is saved beforehand to a
backup theme file named like `+backup-YYYYMMDD-HHMMSS-uuuuuu+` in
directory `+themes+` inside the WeeChat configuration directory, so the
previous look can be restored at any time with:
----
/theme apply backup-YYYYMMDD-HHMMSS-uuuuuu
----
Backup creation can be disabled (not recommended):
----
/set weechat.look.theme_backup off
----
If backup is enabled and the backup file cannot be written, the apply
is aborted before any option is changed.
The name of the last applied theme is stored in
`+weechat.look.theme+` (informational only; not re-applied at startup).
[[themes_save_delete]]
==== Saving and deleting user themes
Save the current themable options as a new user theme file:
----
/theme save mytheme
----
By default only options whose value differs from their hardcoded
default are written, keeping the file small and focused. To capture
every themable option:
----
/theme save mytheme -full
----
Reserved names (built-in theme names like `+light+` and any name
starting with `+backup-+`) are refused. Files live at
`+${weechat_config_dir}/themes/<name>.theme+`.
Delete a user theme:
----
/theme delete mytheme
----
This removes the file on disk; built-in themes cannot be deleted.
[[themes_file_format]]
==== Theme file format
A theme file is INI-like with two sections:
----
[info]
name = "solarized_light"
description = "Light-background theme inspired by Solarized"
date = "2026-05-25 09:42:10"
weechat = "4.10.0-dev"
[options]
weechat.color.chat = "darkgray"
weechat.color.separator = "blue"
irc.color.input_nick = "magenta"
buflist.format.number = "${color:28}${number}${if:${number_displayed}?.: }"
----
`+[info]+` is informational metadata shown by `/theme info`. `+[options]+`
holds the actual overrides; keys are the full option names that would
appear in `/set`. String values can be enclosed in double or single
quotes; quotes are stripped at parse time. Non-themable options listed
in a theme file are refused at apply time and logged to the core
buffer (so a `.theme` file imported from an untrusted source cannot
overwrite passwords, autoload lists, or startup commands).
User theme files are never cached: on every `/theme apply <name>` the
file is parsed, applied, and freed.
[[themes_resolution]]
==== Resolution order
When `+/theme apply <name>+` is run:
* If `+${weechat_config_dir}/themes/<name>.theme+` exists, the file
is parsed and used (it shadows any built-in with the same name).
* Otherwise the built-in theme registry is consulted; built-ins are
registered programmatically by core, plugins and scripts (see the
plugin and scripting documentation for `+weechat_theme_register+`).
If neither source provides the name, the apply is refused.
[[charset]]
=== Charset