mirror of
https://github.com/weechat/weechat.git
synced 2026-06-25 12:26:40 +02:00
44b7f8ffd0
Add a small core-theme-builtin.c module containing the core
contribution to the "light" theme: 33 overrides for
"weechat.bar.{status,title}.color_*" and "weechat.color.*" tuned for
light-background terminals.
theme_builtin_init() builds a hashtable from the static entry table and
calls theme_register("light", overrides), then frees the temporary
hashtable. It is called once from weechat_init right after theme_init.
Calling it twice is a no-op (the registry merges identical keys).
Default option values are NOT changed. Existing configs render exactly
as before; users opt in with "/theme apply light".
Add TEST(CoreTheme, BuiltinInit) covering:
- the "light" theme is absent before theme_builtin_init();
- it is present after, with >= 30 overrides;
- three spot-checked values match the source table;
- calling theme_builtin_init() a second time does not change the
override count.
Plugins contribute their own "light" overrides via weechat_theme_register
in subsequent commits.
62 lines
2.3 KiB
C
62 lines
2.3 KiB
C
/*
|
|
* 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_THEME_H
|
|
#define WEECHAT_THEME_H
|
|
|
|
struct t_hashtable;
|
|
struct t_arraylist;
|
|
|
|
struct t_theme
|
|
{
|
|
char *name; /* "dark", "solarized", ... */
|
|
char *description; /* free-form text */
|
|
char *date; /* "YYYY-MM-DD HH:MM:SS" */
|
|
char *weechat_version; /* version at registration time */
|
|
struct t_hashtable *overrides; /* full_option_name -> value */
|
|
struct t_theme *prev_theme; /* link to previous theme */
|
|
struct t_theme *next_theme; /* link to next theme */
|
|
};
|
|
|
|
extern struct t_theme *themes;
|
|
extern struct t_theme *last_theme;
|
|
extern int theme_applying; /* gate for config_change_color */
|
|
|
|
extern struct t_theme *theme_search (const char *name);
|
|
extern struct t_theme *theme_register (const char *name,
|
|
struct t_hashtable *overrides);
|
|
extern struct t_arraylist *theme_list (void);
|
|
extern int theme_apply (const char *name);
|
|
extern int theme_save (const char *name, int full);
|
|
extern int theme_delete (const char *name);
|
|
extern char *theme_make_backup (void);
|
|
extern char *theme_user_file_path (const char *name);
|
|
extern struct t_theme *theme_file_parse (const char *path);
|
|
extern void theme_free (struct t_theme *theme);
|
|
|
|
extern void theme_init (void);
|
|
extern void theme_end (void);
|
|
|
|
/* implemented in core-theme-builtin.c */
|
|
extern void theme_builtin_init (void);
|
|
|
|
#endif /* WEECHAT_THEME_H */
|