mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
script: contribute "light" theme overrides
Add script-theme.{c,h} with the script plugin contribution to the
built-in "light" theme: 24 entries on script.color.* (status_* and
text_*) tuned for a light-background terminal.
Same 2D-array pattern as the other plugin contributions.
Default option values are NOT changed.
This commit is contained in:
@@ -29,6 +29,7 @@ add_library(script MODULE
|
||||
script-info.c script-info.h
|
||||
script-mouse.c script-mouse.h
|
||||
script-repo.c script-repo.h
|
||||
script-theme.c script-theme.h
|
||||
)
|
||||
set_target_properties(script PROPERTIES PREFIX "")
|
||||
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 Sébastien Helleu <flashcode@flashtux.org>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* This file is part of WeeChat, the extensible chat client.
|
||||
*
|
||||
* WeeChat is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* WeeChat is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* script contribution to built-in themes. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "../weechat-plugin.h"
|
||||
#include "script.h"
|
||||
#include "script-theme.h"
|
||||
|
||||
|
||||
const char *script_theme_light[][2] =
|
||||
{
|
||||
{ "script.color.status_autoloaded", "default" },
|
||||
{ "script.color.status_held", "202" },
|
||||
{ "script.color.status_installed", "21" },
|
||||
{ "script.color.status_obsolete", "magenta" },
|
||||
{ "script.color.status_popular", "94" },
|
||||
{ "script.color.status_running", "23" },
|
||||
{ "script.color.status_unknown", "red" },
|
||||
{ "script.color.text_bg_selected", "117" },
|
||||
{ "script.color.text_date", "darkgray" },
|
||||
{ "script.color.text_date_selected", "darkgray" },
|
||||
{ "script.color.text_delimiters", "251" },
|
||||
{ "script.color.text_description", "default" },
|
||||
{ "script.color.text_description_selected", "default" },
|
||||
{ "script.color.text_extension", "lightblue" },
|
||||
{ "script.color.text_extension_selected", "lightblue" },
|
||||
{ "script.color.text_name", "18" },
|
||||
{ "script.color.text_name_selected", "18" },
|
||||
{ "script.color.text_selected", "default" },
|
||||
{ "script.color.text_tags", "94" },
|
||||
{ "script.color.text_tags_selected", "94" },
|
||||
{ "script.color.text_version", "58" },
|
||||
{ "script.color.text_version_loaded", "default" },
|
||||
{ "script.color.text_version_loaded_selected", "default" },
|
||||
{ "script.color.text_version_selected", "58" },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
void
|
||||
script_theme_register (const char *name, const char *entries[][2])
|
||||
{
|
||||
struct t_hashtable *overrides;
|
||||
int i;
|
||||
|
||||
if (!name || !entries)
|
||||
return;
|
||||
|
||||
overrides = weechat_hashtable_new (32,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
NULL, NULL);
|
||||
if (!overrides)
|
||||
return;
|
||||
|
||||
for (i = 0; entries[i][0]; i++)
|
||||
weechat_hashtable_set (overrides, entries[i][0], entries[i][1]);
|
||||
|
||||
weechat_theme_register (name, overrides);
|
||||
|
||||
weechat_hashtable_free (overrides);
|
||||
}
|
||||
|
||||
void
|
||||
script_theme_init (void)
|
||||
{
|
||||
script_theme_register ("light", script_theme_light);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 Sébastien Helleu <flashcode@flashtux.org>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* This file is part of WeeChat, the extensible chat client.
|
||||
*
|
||||
* WeeChat is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* WeeChat is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef WEECHAT_PLUGIN_SCRIPT_THEME_H
|
||||
#define WEECHAT_PLUGIN_SCRIPT_THEME_H
|
||||
|
||||
extern void script_theme_init (void);
|
||||
|
||||
#endif /* WEECHAT_PLUGIN_SCRIPT_THEME_H */
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "script-info.h"
|
||||
#include "script-mouse.h"
|
||||
#include "script-repo.h"
|
||||
#include "script-theme.h"
|
||||
|
||||
|
||||
WEECHAT_PLUGIN_NAME(SCRIPT_PLUGIN_NAME);
|
||||
@@ -352,6 +353,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
|
||||
script_config_read ();
|
||||
|
||||
script_theme_init ();
|
||||
|
||||
weechat_mkdir_home ("${weechat_cache_dir}/" SCRIPT_PLUGIN_NAME, 0755);
|
||||
|
||||
script_command_init ();
|
||||
|
||||
Reference in New Issue
Block a user