xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
<root> / src / ui / color_manager.h (3f778d51291fc49cdd43cb9f2bba113c12bb6f64) (2,367B) (mode 100644) [raw]
/* vifm
 * Copyright (C) 2013 xaizek.
 *
 * This program 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 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 */

#ifndef VIFM__UI__COLOR_MANAGER_H__
#define VIFM__UI__COLOR_MANAGER_H__

/* Initialization data for colmgr_init(). */
typedef struct
{
	/* Maximum number of color pairs. */
	int max_color_pairs;

	/* Maximum number of colors. */
	int max_colors;

	/* Function to set value of a color pair.  Should return zero on success and
	 * anything else otherwise. */
	int (*init_pair)(int pair, int fg, int bg);

	/* Function to get value of a color pair.  Should return zero on success and
	 * anything else otherwise. */
	int (*pair_content)(int pair, int *fg, int *bg);

	/* Checks whether pair is being used at the moment.  Should return non-zero if
	 * so and zero otherwise. */
	int (*pair_in_use)(int pair);

	/* Informs the client about pair number rename so that it can update all uses
	 * of old number with the new one. */
	void (*pair_moved)(int from, int to);
}
colmgr_conf_t;

/* Initializes color manager unit.  Creates and prepares internal variables. */
void colmgr_init(const colmgr_conf_t *conf_init);

/* Resets all color pairs that are available for dynamic allocation. */
void colmgr_reset(void);

/* Gets (might dynamically allocate) color pair number for specified
 * foreground (fg) and background (bg) colors.  Returns the number.  On failure
 * falls back to color pair 0. */
int colmgr_get_pair(int fg, int bg);

/* Retrieves number of color pairs currently in use.  Returns the number. */
int colmgr_used_pairs(void);

#endif /* VIFM__UI__COLOR_MANAGER_H__ */

/* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */
/* vim: set cinoptions+=t0 filetype=c : */
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master