mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
fset: contribute "light" theme overrides
Add fset-theme.{c,h} with the fset plugin contribution to the built-in
"light" theme: 47 overrides on fset.color.* options (line backgrounds,
selected-row tuning, title and value colors) tuned for a
light-background terminal.
The table is a NULL-terminated 2-column array of strings (no struct
wrapper, matching the pattern adopted for the irc contribution).
fset_theme_register builds a hashtable from the table and calls
weechat_theme_register; fset_theme_init() is called once from
weechat_plugin_init after fset_config_init / fset_config_read.
Default option values are NOT changed.
This commit is contained in:
@@ -29,6 +29,7 @@ add_library(fset MODULE
|
||||
fset-info.c fset-info.h
|
||||
fset-mouse.c fset-mouse.h
|
||||
fset-option.c fset-option.h
|
||||
fset-theme.c fset-theme.h
|
||||
)
|
||||
set_target_properties(fset PROPERTIES PREFIX "")
|
||||
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* fset contribution to built-in themes. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "../weechat-plugin.h"
|
||||
#include "fset.h"
|
||||
#include "fset-theme.h"
|
||||
|
||||
|
||||
/*
|
||||
* fset contribution to the "light" theme: option values tuned for a
|
||||
* light-background terminal. Each row is { option_full_name, value };
|
||||
* the table is NULL-terminated.
|
||||
*/
|
||||
|
||||
const char *fset_theme_light[][2] =
|
||||
{
|
||||
{ "fset.color.allowed_values_selected", "default" },
|
||||
{ "fset.color.color_name", "darkgray" },
|
||||
{ "fset.color.color_name_selected", "darkgray" },
|
||||
{ "fset.color.default_value_selected", "default" },
|
||||
{ "fset.color.description_selected", "242" },
|
||||
{ "fset.color.file_changed", "94" },
|
||||
{ "fset.color.file_changed_selected", "94" },
|
||||
{ "fset.color.file_selected", "default" },
|
||||
{ "fset.color.help_default_value", "default" },
|
||||
{ "fset.color.help_name", "default" },
|
||||
{ "fset.color.index", "24" },
|
||||
{ "fset.color.index_selected", "24" },
|
||||
{ "fset.color.line_marked_bg1", "193" },
|
||||
{ "fset.color.line_marked_bg2", "193" },
|
||||
{ "fset.color.line_selected_bg1", "117" },
|
||||
{ "fset.color.line_selected_bg2", "117" },
|
||||
{ "fset.color.marked", "94" },
|
||||
{ "fset.color.marked_selected", "94" },
|
||||
{ "fset.color.max_selected", "default" },
|
||||
{ "fset.color.min_selected", "default" },
|
||||
{ "fset.color.name_changed", "red" },
|
||||
{ "fset.color.name_changed_selected", "red" },
|
||||
{ "fset.color.name_selected", "default" },
|
||||
{ "fset.color.option_changed", "94" },
|
||||
{ "fset.color.option_changed_selected", "94" },
|
||||
{ "fset.color.option_selected", "default" },
|
||||
{ "fset.color.parent_name_selected", "default" },
|
||||
{ "fset.color.parent_value", "24" },
|
||||
{ "fset.color.parent_value_selected", "24" },
|
||||
{ "fset.color.quotes_changed_selected", "default" },
|
||||
{ "fset.color.section_changed", "94" },
|
||||
{ "fset.color.section_changed_selected", "94" },
|
||||
{ "fset.color.section_selected", "default" },
|
||||
{ "fset.color.string_values_selected", "default" },
|
||||
{ "fset.color.title_count_options", "30" },
|
||||
{ "fset.color.title_current_option", "30" },
|
||||
{ "fset.color.title_filter", "18" },
|
||||
{ "fset.color.title_marked_options", "94" },
|
||||
{ "fset.color.title_sort", "darkgray" },
|
||||
{ "fset.color.type", "58" },
|
||||
{ "fset.color.type_selected", "58" },
|
||||
{ "fset.color.unmarked_selected", "default" },
|
||||
{ "fset.color.value", "20" },
|
||||
{ "fset.color.value_changed", "red" },
|
||||
{ "fset.color.value_changed_selected", "red" },
|
||||
{ "fset.color.value_selected", "20" },
|
||||
{ "fset.color.value_undef_selected", "magenta" },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
/*
|
||||
* Registers fset's contribution to one theme from a NULL-terminated
|
||||
* table of {option, value} rows.
|
||||
*/
|
||||
|
||||
void
|
||||
fset_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);
|
||||
}
|
||||
|
||||
/*
|
||||
* Registers all built-in theme contributions from fset.
|
||||
*/
|
||||
|
||||
void
|
||||
fset_theme_init (void)
|
||||
{
|
||||
fset_theme_register ("light", fset_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_FSET_THEME_H
|
||||
#define WEECHAT_PLUGIN_FSET_THEME_H
|
||||
|
||||
extern void fset_theme_init (void);
|
||||
|
||||
#endif /* WEECHAT_PLUGIN_FSET_THEME_H */
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "fset-info.h"
|
||||
#include "fset-mouse.h"
|
||||
#include "fset-option.h"
|
||||
#include "fset-theme.h"
|
||||
|
||||
|
||||
WEECHAT_PLUGIN_NAME(FSET_PLUGIN_NAME);
|
||||
@@ -126,6 +127,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
|
||||
fset_config_read ();
|
||||
|
||||
fset_theme_init ();
|
||||
|
||||
if (!fset_bar_item_init ())
|
||||
return WEECHAT_RC_ERROR;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user