Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:lnussel:branches:Base:System
dialog
dialog-1.3-Use-bright-colors.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File dialog-1.3-Use-bright-colors.diff of Package dialog
From 5419f94dd0c9d6bd5aa8b25546122c1d476bce53 Mon Sep 17 00:00:00 2001 From: Ludwig Nussel <ludwig.nussel@suse.de> Date: Tue, 12 Dec 2023 11:01:26 +0100 Subject: [PATCH] Enable use of bright colors On terminals that support more than eight colors use the actual bright variants instead of setting bold. Most graphical terminal emulators don't interpret bold as bright anymore by default. --- dlg_colors.h | 101 ++++++++++++++++++++++++++++----------------------- rc.c | 8 ++++ util.c | 14 +++++++ 3 files changed, 77 insertions(+), 46 deletions(-) diff --git a/dlg_colors.h b/dlg_colors.h index de91627..af81c11 100644 --- a/dlg_colors.h +++ b/dlg_colors.h @@ -29,6 +29,15 @@ #include <dialog.h> +#define COLOR_BRIGHT_BLACK COLOR_BLACK+8 +#define COLOR_BRIGHT_RED COLOR_RED+8 +#define COLOR_BRIGHT_GREEN COLOR_GREEN+8 +#define COLOR_BRIGHT_YELLOW COLOR_YELLOW+8 +#define COLOR_BRIGHT_BLUE COLOR_BLUE+8 +#define COLOR_BRIGHT_MAGENTA COLOR_MAGENTA+8 +#define COLOR_BRIGHT_CYAN COLOR_CYAN+8 +#define COLOR_BRIGHT_WHITE COLOR_WHITE+8 + /* * Default color definitions (DLGC means "Dialog Color") * @@ -38,15 +47,15 @@ * DLGC_UL_xxx = underline for "xxx" * DLGC_RV_xxx = reverse for "xxx" */ -#define DLGC_FG_SCREEN COLOR_CYAN +#define DLGC_FG_SCREEN COLOR_BRIGHT_CYAN #define DLGC_BG_SCREEN COLOR_BLUE -#define DLGC_HL_SCREEN TRUE +#define DLGC_HL_SCREEN FALSE #define DLGC_UL_SCREEN FALSE #define DLGC_RV_SCREEN FALSE -#define DLGC_FG_SHADOW COLOR_BLACK +#define DLGC_FG_SHADOW COLOR_BRIGHT_BLACK #define DLGC_BG_SHADOW COLOR_BLACK -#define DLGC_HL_SHADOW TRUE +#define DLGC_HL_SHADOW FALSE #define DLGC_UL_SHADOW FALSE #define DLGC_RV_SHADOW FALSE @@ -56,15 +65,15 @@ #define DLGC_UL_DIALOG FALSE #define DLGC_RV_DIALOG FALSE -#define DLGC_FG_TITLE COLOR_BLUE +#define DLGC_FG_TITLE COLOR_BRIGHT_BLUE #define DLGC_BG_TITLE COLOR_WHITE -#define DLGC_HL_TITLE TRUE +#define DLGC_HL_TITLE FALSE #define DLGC_UL_TITLE FALSE #define DLGC_RV_TITLE FALSE -#define DLGC_FG_BORDER COLOR_WHITE +#define DLGC_FG_BORDER COLOR_BRIGHT_WHITE #define DLGC_BG_BORDER COLOR_WHITE -#define DLGC_HL_BORDER TRUE +#define DLGC_HL_BORDER FALSE #define DLGC_UL_BORDER FALSE #define DLGC_RV_BORDER FALSE @@ -74,9 +83,9 @@ #define DLGC_UL_BORDER2 FALSE #define DLGC_RV_BORDER2 FALSE -#define DLGC_FG_BUTTON_ACTIVE COLOR_WHITE +#define DLGC_FG_BUTTON_ACTIVE COLOR_BRIGHT_WHITE #define DLGC_BG_BUTTON_ACTIVE COLOR_BLUE -#define DLGC_HL_BUTTON_ACTIVE TRUE +#define DLGC_HL_BUTTON_ACTIVE FALSE #define DLGC_UL_BUTTON_ACTIVE FALSE #define DLGC_RV_BUTTON_ACTIVE FALSE @@ -86,9 +95,9 @@ #define DLGC_UL_BUTTON_INACTIVE FALSE #define DLGC_RV_BUTTON_INACTIVE FALSE -#define DLGC_FG_BUTTON_KEY_ACTIVE COLOR_WHITE +#define DLGC_FG_BUTTON_KEY_ACTIVE COLOR_BRIGHT_WHITE #define DLGC_BG_BUTTON_KEY_ACTIVE COLOR_BLUE -#define DLGC_HL_BUTTON_KEY_ACTIVE TRUE +#define DLGC_HL_BUTTON_KEY_ACTIVE FALSE #define DLGC_UL_BUTTON_KEY_ACTIVE FALSE #define DLGC_RV_BUTTON_KEY_ACTIVE FALSE @@ -98,21 +107,21 @@ #define DLGC_UL_BUTTON_KEY_INACTIVE FALSE #define DLGC_RV_BUTTON_KEY_INACTIVE FALSE -#define DLGC_FG_BUTTON_LABEL_ACTIVE COLOR_YELLOW +#define DLGC_FG_BUTTON_LABEL_ACTIVE COLOR_BRIGHT_YELLOW #define DLGC_BG_BUTTON_LABEL_ACTIVE COLOR_BLUE -#define DLGC_HL_BUTTON_LABEL_ACTIVE TRUE +#define DLGC_HL_BUTTON_LABEL_ACTIVE FALSE #define DLGC_UL_BUTTON_LABEL_ACTIVE FALSE #define DLGC_RV_BUTTON_LABEL_ACTIVE FALSE -#define DLGC_FG_BUTTON_LABEL_INACTIVE COLOR_BLACK +#define DLGC_FG_BUTTON_LABEL_INACTIVE COLOR_BRIGHT_BLACK #define DLGC_BG_BUTTON_LABEL_INACTIVE COLOR_WHITE -#define DLGC_HL_BUTTON_LABEL_INACTIVE TRUE +#define DLGC_HL_BUTTON_LABEL_INACTIVE FALSE #define DLGC_UL_BUTTON_LABEL_INACTIVE FALSE #define DLGC_RV_BUTTON_LABEL_INACTIVE FALSE -#define DLGC_FG_FORM_ITEM_READONLY COLOR_CYAN +#define DLGC_FG_FORM_ITEM_READONLY COLOR_BRIGHT_CYAN #define DLGC_BG_FORM_ITEM_READONLY COLOR_WHITE -#define DLGC_HL_FORM_ITEM_READONLY TRUE +#define DLGC_HL_FORM_ITEM_READONLY FALSE #define DLGC_UL_FORM_ITEM_READONLY FALSE #define DLGC_RV_FORM_ITEM_READONLY FALSE @@ -140,15 +149,15 @@ #define DLGC_UL_SEARCHBOX FALSE #define DLGC_RV_SEARCHBOX FALSE -#define DLGC_FG_SEARCHBOX_TITLE COLOR_BLUE +#define DLGC_FG_SEARCHBOX_TITLE COLOR_BRIGHT_BLUE #define DLGC_BG_SEARCHBOX_TITLE COLOR_WHITE -#define DLGC_HL_SEARCHBOX_TITLE TRUE +#define DLGC_HL_SEARCHBOX_TITLE FALSE #define DLGC_UL_SEARCHBOX_TITLE FALSE #define DLGC_RV_SEARCHBOX_TITLE FALSE -#define DLGC_FG_SEARCHBOX_BORDER COLOR_WHITE +#define DLGC_FG_SEARCHBOX_BORDER COLOR_BRIGHT_WHITE #define DLGC_BG_SEARCHBOX_BORDER COLOR_WHITE -#define DLGC_HL_SEARCHBOX_BORDER TRUE +#define DLGC_HL_SEARCHBOX_BORDER FALSE #define DLGC_UL_SEARCHBOX_BORDER FALSE #define DLGC_RV_SEARCHBOX_BORDER FALSE @@ -158,9 +167,9 @@ #define DLGC_UL_SEARCHBOX_BORDER2 FALSE #define DLGC_RV_SEARCHBOX_BORDER2 FALSE -#define DLGC_FG_POSITION_INDICATOR COLOR_BLUE +#define DLGC_FG_POSITION_INDICATOR COLOR_BRIGHT_BLUE #define DLGC_BG_POSITION_INDICATOR COLOR_WHITE -#define DLGC_HL_POSITION_INDICATOR TRUE +#define DLGC_HL_POSITION_INDICATOR FALSE #define DLGC_UL_POSITION_INDICATOR FALSE #define DLGC_RV_POSITION_INDICATOR FALSE @@ -170,9 +179,9 @@ #define DLGC_UL_MENUBOX FALSE #define DLGC_RV_MENUBOX FALSE -#define DLGC_FG_MENUBOX_BORDER COLOR_WHITE +#define DLGC_FG_MENUBOX_BORDER COLOR_BRIGHT_WHITE #define DLGC_BG_MENUBOX_BORDER COLOR_WHITE -#define DLGC_HL_MENUBOX_BORDER TRUE +#define DLGC_HL_MENUBOX_BORDER FALSE #define DLGC_UL_MENUBOX_BORDER FALSE #define DLGC_RV_MENUBOX_BORDER FALSE @@ -188,21 +197,21 @@ #define DLGC_UL_ITEM FALSE #define DLGC_RV_ITEM FALSE -#define DLGC_FG_ITEM_SELECTED COLOR_WHITE +#define DLGC_FG_ITEM_SELECTED COLOR_BRIGHT_WHITE #define DLGC_BG_ITEM_SELECTED COLOR_BLUE -#define DLGC_HL_ITEM_SELECTED TRUE +#define DLGC_HL_ITEM_SELECTED FALSE #define DLGC_UL_ITEM_SELECTED FALSE #define DLGC_RV_ITEM_SELECTED FALSE -#define DLGC_FG_TAG COLOR_BLUE +#define DLGC_FG_TAG COLOR_BRIGHT_BLUE #define DLGC_BG_TAG COLOR_WHITE -#define DLGC_HL_TAG TRUE +#define DLGC_HL_TAG FALSE #define DLGC_UL_TAG FALSE #define DLGC_RV_TAG FALSE -#define DLGC_FG_TAG_SELECTED COLOR_YELLOW +#define DLGC_FG_TAG_SELECTED COLOR_BRIGHT_YELLOW #define DLGC_BG_TAG_SELECTED COLOR_BLUE -#define DLGC_HL_TAG_SELECTED TRUE +#define DLGC_HL_TAG_SELECTED FALSE #define DLGC_UL_TAG_SELECTED FALSE #define DLGC_RV_TAG_SELECTED FALSE @@ -212,9 +221,9 @@ #define DLGC_UL_TAG_KEY FALSE #define DLGC_RV_TAG_KEY FALSE -#define DLGC_FG_TAG_KEY_SELECTED COLOR_RED +#define DLGC_FG_TAG_KEY_SELECTED COLOR_BRIGHT_RED #define DLGC_BG_TAG_KEY_SELECTED COLOR_BLUE -#define DLGC_HL_TAG_KEY_SELECTED TRUE +#define DLGC_HL_TAG_KEY_SELECTED FALSE #define DLGC_UL_TAG_KEY_SELECTED FALSE #define DLGC_RV_TAG_KEY_SELECTED FALSE @@ -224,21 +233,21 @@ #define DLGC_UL_CHECK FALSE #define DLGC_RV_CHECK FALSE -#define DLGC_FG_CHECK_SELECTED COLOR_WHITE +#define DLGC_FG_CHECK_SELECTED COLOR_BRIGHT_WHITE #define DLGC_BG_CHECK_SELECTED COLOR_BLUE -#define DLGC_HL_CHECK_SELECTED TRUE +#define DLGC_HL_CHECK_SELECTED FALSE #define DLGC_UL_CHECK_SELECTED FALSE #define DLGC_RV_CHECK_SELECTED FALSE -#define DLGC_FG_UARROW COLOR_GREEN +#define DLGC_FG_UARROW COLOR_BRIGHT_GREEN #define DLGC_BG_UARROW COLOR_WHITE -#define DLGC_HL_UARROW TRUE +#define DLGC_HL_UARROW FALSE #define DLGC_UL_UARROW FALSE #define DLGC_RV_UARROW FALSE -#define DLGC_FG_DARROW COLOR_GREEN +#define DLGC_FG_DARROW COLOR_BRIGHT_GREEN #define DLGC_BG_DARROW COLOR_WHITE -#define DLGC_HL_DARROW TRUE +#define DLGC_HL_DARROW FALSE #define DLGC_UL_DARROW FALSE #define DLGC_RV_DARROW FALSE @@ -248,21 +257,21 @@ #define DLGC_UL_ITEMHELP FALSE #define DLGC_RV_ITEMHELP FALSE -#define DLGC_FG_FORM_ACTIVE_TEXT COLOR_WHITE +#define DLGC_FG_FORM_ACTIVE_TEXT COLOR_BRIGHT_WHITE #define DLGC_BG_FORM_ACTIVE_TEXT COLOR_BLUE -#define DLGC_HL_FORM_ACTIVE_TEXT TRUE +#define DLGC_HL_FORM_ACTIVE_TEXT FALSE #define DLGC_UL_FORM_ACTIVE_TEXT FALSE #define DLGC_RV_FORM_ACTIVE_TEXT FALSE -#define DLGC_FG_FORM_TEXT COLOR_WHITE +#define DLGC_FG_FORM_TEXT COLOR_BRIGHT_WHITE #define DLGC_BG_FORM_TEXT COLOR_CYAN -#define DLGC_HL_FORM_TEXT TRUE +#define DLGC_HL_FORM_TEXT FALSE #define DLGC_UL_FORM_TEXT FALSE #define DLGC_RV_FORM_TEXT FALSE -#define DLGC_FG_GAUGE COLOR_BLUE +#define DLGC_FG_GAUGE COLOR_BRIGHT_BLUE #define DLGC_BG_GAUGE COLOR_WHITE -#define DLGC_HL_GAUGE TRUE +#define DLGC_HL_GAUGE FALSE #define DLGC_UL_GAUGE FALSE #define DLGC_RV_GAUGE FALSE diff --git a/rc.c b/rc.c index a1f97cf..6dfbbae 100644 --- a/rc.c +++ b/rc.c @@ -58,6 +58,14 @@ static const color_names_st color_names[] = {"MAGENTA", COLOR_MAGENTA}, {"CYAN", COLOR_CYAN}, {"WHITE", COLOR_WHITE}, + {"BRIGHT_BLACK", COLOR_BRIGHT_BLACK}, + {"BRIGHT_RED", COLOR_BRIGHT_RED}, + {"BRIGHT_GREEN", COLOR_BRIGHT_GREEN}, + {"BRIGHT_YELLOW", COLOR_BRIGHT_YELLOW}, + {"BRIGHT_BLUE", COLOR_BRIGHT_BLUE}, + {"BRIGHT_MAGENTA", COLOR_BRIGHT_MAGENTA}, + {"BRIGHT_CYAN", COLOR_BRIGHT_CYAN}, + {"BRIGHT_WHITE", COLOR_BRIGHT_WHITE}, }; /* color names */ #define COLOR_COUNT TableSize(color_names) #endif /* HAVE_COLOR */ diff --git a/util.c b/util.c index 461d874..d37c2c2 100644 --- a/util.c +++ b/util.c @@ -513,10 +513,24 @@ dlg_color_setup(void) for (i = 0; i < sizeof(dlg_color_table) / sizeof(dlg_color_table[0]); i++) { + /* + * On terminals with only eight colors emulate bright by + * setting bold + */ + if (COLORS <= 8) { + if (dlg_color_table[i].fg > 7) { + dlg_color_table[i].fg -= 8; + dlg_color_table[i].hilite = TRUE; + } + if (dlg_color_table[i].bg > 7) + dlg_color_table[i].bg -= 8; + } + /* Initialize color pairs */ chtype atr = dlg_color_pair(dlg_color_table[i].fg, dlg_color_table[i].bg); + atr |= (dlg_color_table[i].hilite ? A_BOLD : 0); #ifdef HAVE_RC_FILE2 atr |= (dlg_color_table[i].ul ? A_UNDERLINE : 0); -- 2.42.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor