mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
Merge branch '2169_256colors'
* 2169_256colors: Added skin for demonstrate how to use 256 colors in mc Added Russian translation of 256 colors capability. Ticket #2169: Add support for 256 colors terminals
This commit is contained in:
commit
1ce4670852
3
AUTHORS
3
AUTHORS
@ -59,6 +59,9 @@ Anton Chumak <nightfast@yahoo.co.uk>
|
||||
Antonio Palama, DOS port <palama@posso.dm.unipi.it>
|
||||
DOS port.
|
||||
|
||||
Egmont Koblinger <egmont@gmail.com>
|
||||
Support of 256 colors
|
||||
|
||||
Erwin van Eijk <wabbit@corner.iaf.nl>
|
||||
|
||||
Gerd Knorr <kraxel@cs.tu-berlin.de>
|
||||
|
@ -3417,7 +3417,7 @@ xterm=menu=magenta:marked=,magenta:markselect=,red
|
||||
The format for the color definition is:
|
||||
.PP
|
||||
.nf
|
||||
<keyword>=<foregroundcolor>,<backgroundcolor>:<keyword>= ...
|
||||
<keyword>=<fgcolor>,<bgcolor>,<attributes>:<keyword>=...
|
||||
.fi
|
||||
.PP
|
||||
The colors are optional, and the keywords are: normal, selected, disabled, marked,
|
||||
@ -3481,12 +3481,22 @@ The possible colors are: black, gray, red, brightred, green,
|
||||
brightgreen, brown, yellow, blue, brightblue, magenta, brightmagenta,
|
||||
cyan, brightcyan, lightgray and white. And there is a special keyword
|
||||
for transparent background. It is 'default'. The 'default' can only be
|
||||
used for background color. Example:
|
||||
used for background color. Another special keyword "base" means mc's main
|
||||
colors. When 256 colors are available, they can be specified either as
|
||||
color16 to color255, or as rgb000 to rgb555 and gray0 to gray23. Example:
|
||||
.PP
|
||||
.nf
|
||||
[Colors]
|
||||
base_color=normal=white,default:marked=magenta,default
|
||||
.fi
|
||||
.PP
|
||||
Attributes can be any of bold, underline, reverse and blink, appended by a
|
||||
plus sign if more than one are desired. The special word "none" means no
|
||||
attributes, without attempting to fall back to base_color. Example:
|
||||
.PP
|
||||
.nf
|
||||
menuhotsel=yellow;black;bold+underline
|
||||
.fi
|
||||
|
||||
.\"NODE "Skins"
|
||||
.SH "Skins"
|
||||
@ -3727,11 +3737,12 @@ attribute
|
||||
.SH " Color pair definitions"
|
||||
Any parameter in skin\-file contain definition of color pair.
|
||||
.PP
|
||||
Color pairs described as two colors separated by ';'. First color
|
||||
sets the foreground color, second color sets background color.
|
||||
One of the colors may be omitted, in this case color will be
|
||||
taken from default color pair (global color pair or
|
||||
from default color pair of this section).
|
||||
Color pairs described as two colors and the optional attributes
|
||||
separated by ';'. First field sets the foreground color, second
|
||||
field sets background color, third field sets the attributes.
|
||||
Any of the fields may be omitted, in this case value will be
|
||||
taken from default color pair (global color pair or from default
|
||||
color pair of this section).
|
||||
.PP
|
||||
Example:
|
||||
.br
|
||||
@ -3739,14 +3750,15 @@ Example:
|
||||
[core]
|
||||
# green on black
|
||||
_default_=green;black
|
||||
# green (default) on blue
|
||||
# green (default) on blue
|
||||
selected=;blue
|
||||
# yellow on black (default)
|
||||
marked=yellow;
|
||||
# underlined yellow on black (default)
|
||||
marked=yellow;;underline
|
||||
.fi
|
||||
|
||||
.PP
|
||||
Possible colors (names) described in
|
||||
Possible colors (names) and attributes are described in
|
||||
.\"LINK2"
|
||||
Colors\&.
|
||||
.\"Colors"
|
||||
|
@ -33,7 +33,7 @@ Force black and white display.
|
||||
Force ANSI color mode on terminals that don't seem to have color
|
||||
support.
|
||||
.TP
|
||||
.I "\-C <keyword>=<FGcolor>,<BGcolor>:<keyword>= ..."
|
||||
.I "\-C <keyword>=<fgcolor>,<bgcolor>,<attributes>:<keyword>= ..."
|
||||
Specify a different color set. See the
|
||||
.B Colors
|
||||
section in mc(1) for more information.
|
||||
@ -249,12 +249,14 @@ Each context starts with a line of the form:
|
||||
.I delim
|
||||
.RI [ foreground ]
|
||||
.RI [ background ]
|
||||
.RI [ attributes ]
|
||||
.PP
|
||||
The first context is an exception. It must start with the command
|
||||
.PP
|
||||
.B context default
|
||||
.RI [ foreground ]
|
||||
.RI [ background ]
|
||||
.RI [ attributes ]
|
||||
.PP
|
||||
otherwise
|
||||
.B mcedit
|
||||
@ -294,6 +296,7 @@ Each rule is a line of the form:
|
||||
.RB [ linestart ]
|
||||
.I string foreground
|
||||
.RI [ background ]
|
||||
.RI [ attributes ]
|
||||
.PP
|
||||
Context or keyword strings are interpreted, so that you can include tabs
|
||||
and spaces with the sequences \\t and \\s. Newlines and backslashes are
|
||||
@ -331,8 +334,14 @@ directive to continue across multiple lines.
|
||||
.PP
|
||||
The possible colors are: black, gray, red, brightred, green,
|
||||
brightgreen, brown, yellow, blue, brightblue, magenta, brightmagenta,
|
||||
cyan, brightcyan, lightgray and white. If the syntax file is shared
|
||||
with
|
||||
cyan, brightcyan, lightgray and white. The special keyword "default" means
|
||||
the terminal's default. Another special keyword "base" means mc's main
|
||||
colors, it is useful as a placeholder if you want to specify attributes
|
||||
without modifying the background color. When 256 colors are available,
|
||||
they can be specified either as color16 to color255, or as rgb000 to rgb555
|
||||
and gray0 to gray23.
|
||||
.PP
|
||||
If the syntax file is shared with
|
||||
.BR cooledit ,
|
||||
it is possible to specify different colors for
|
||||
.B mcedit
|
||||
@ -349,6 +358,9 @@ uses the color before the slash. See cooledit(1) for supported
|
||||
.B cooledit
|
||||
colors.
|
||||
.PP
|
||||
Attributes can be any of bold, underline, reverse and blink, appended by a
|
||||
plus sign if more than one are desired.
|
||||
.PP
|
||||
Comments may be put on a separate line starting with the hash sign (#).
|
||||
.PP
|
||||
If you are describing case insensitive language you need to use
|
||||
|
@ -23,7 +23,7 @@ Force color mode on terminals where
|
||||
.B mcview
|
||||
defaults to black and white.
|
||||
.TP
|
||||
.I "\-C <keyword>=<FGcolor>,<BGcolor>:<keyword>= ..."
|
||||
.I "\-C <keyword>=<fgcolor>,<bgcolor>,<attributes>:<keyword>= ..."
|
||||
Specify a different color set. See the
|
||||
.B Colors
|
||||
section in mc(1) for more information.
|
||||
|
@ -3675,7 +3675,7 @@ xterm=menu=magenta:marked=,magenta:markselect=,red
|
||||
Формат определения цвета:
|
||||
.PP
|
||||
.nf
|
||||
<keyword>=<foregroundcolor>,<backgroundcolor>:<keyword>= ...
|
||||
<keyword>=<fgcolor>,<bgcolor>,<attributes>:<keyword>= ...
|
||||
.fi
|
||||
.PP
|
||||
Цвета не являются обязательными, а в качестве ключевых слов (keywords)
|
||||
@ -3754,17 +3754,27 @@ editnormal, editbold, editmarked, editwhitespace, editlinestate.
|
||||
.PP
|
||||
Возможные цвета: black, gray, red, brightred, green, brightgreen, brown,
|
||||
yellow, blue, brightblue, magenta, brightmagenta, cyan, brightcyan,
|
||||
lightgray и white.
|
||||
.PP
|
||||
Для прозрачного фона используются специальное ключевое слово 'default'.
|
||||
Слово 'default' можно использовать только при задании цвета фона.
|
||||
lightgray и white. Для прозрачного фона используются специальное ключевое
|
||||
слово "default". Слово "default" можно использовать только при задании цвета
|
||||
фона. Для основных цветов MC используется другое специальное ключевое
|
||||
слово: "base". Если терминал поддерживает 256 цветов, то для них могут
|
||||
использоваться обозначения: от color16 до color255 или от rgb000 до rgb555
|
||||
и от gray0 до gray23.
|
||||
Пример:
|
||||
.PP
|
||||
.nf
|
||||
[Colors]
|
||||
base_color=normal=white,default:marked=magenta,default
|
||||
.fi
|
||||
|
||||
.PP
|
||||
Атрибуты обозначаются словами "bold", "underline", "reverse" и "blink".
|
||||
Чтобы использовать несколько атрибутов, их надо перечислить через символ "+".
|
||||
The special word "none" menas no attributes, without attempting to fall back
|
||||
to base_color. Пример:
|
||||
.PP
|
||||
.nf
|
||||
menuhotsel=yellow;black;bold+underline
|
||||
.fi
|
||||
.\"NODE "Skins"
|
||||
.SH "Внешний вид"
|
||||
Вы можете изменить внешний вид Midnight Commander'а. Для этого необходимо
|
||||
@ -3983,7 +3993,6 @@ base_color=normal=white,default:marked=magenta,default
|
||||
.I editlinestate
|
||||
Цвет области отображения состояния строки.
|
||||
|
||||
|
||||
.PP
|
||||
Секция
|
||||
.BR [viewer]
|
||||
@ -3993,15 +4002,15 @@ base_color=normal=white,default:marked=magenta,default
|
||||
Цветовыделение элементов с атрибутом
|
||||
.BR underline
|
||||
|
||||
|
||||
.\"NODE " Skins colors"
|
||||
.SH " Цветовые пары"
|
||||
Каждый параметр в скин\-файле содержит цветовые пары
|
||||
Каждый параметр в скин\-файле содержит цветовые пары.
|
||||
.PP
|
||||
Цветовые пары описываются как два цвета, разделённых символом ';'
|
||||
первый цвет задаёт цвет написания символов, второй \- цвет фона.
|
||||
Один из цветов может быть пропущен, в этом случае будет взят цвет
|
||||
по умолчанию (глобальный или для данной секции).
|
||||
Цветовые пары описываются как два цвета и необязательные атрибуты,
|
||||
разделённые символом ";". Первый цвет задаёт цвет написания символов,
|
||||
второй \- цвет фона. Любой из цветов и атрибуты могут быть пропущены,
|
||||
в этом случае будет взят цвет по умолчанию (глобальный или для данной
|
||||
секции).
|
||||
.PP
|
||||
Например:
|
||||
.br
|
||||
@ -4009,19 +4018,18 @@ base_color=normal=white,default:marked=magenta,default
|
||||
[core]
|
||||
# зелёным по чёрному
|
||||
_default_=green;black
|
||||
# зелёным (умолч.) по синему
|
||||
# зелёным (умолч.) по синему
|
||||
selected=;blue
|
||||
# жёлтым по чёрному(умолч.)
|
||||
marked=yellow;
|
||||
# жёлтым по чёрному (умолч.) с подчёркиванием
|
||||
marked=yellow;;underline
|
||||
.fi
|
||||
|
||||
.PP
|
||||
Возможные цвета (названия) описаны в секции
|
||||
Возможные цвета (названия) и атрибуты описаны в секции
|
||||
.\"LINK2"
|
||||
Цвета\&.
|
||||
.\"Colors"
|
||||
|
||||
|
||||
.\"NODE " Skins lines"
|
||||
.SH " Линии для отрисовки рамок"
|
||||
Линии задаются в секции
|
||||
|
@ -2,10 +2,11 @@
|
||||
Skins engine.
|
||||
Work with colors - backward compability
|
||||
|
||||
Copyright (C) 2009 The Free Software Foundation, Inc.
|
||||
Copyright (C) 2009, 2010 The Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009.
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009
|
||||
Egmont Koblinger <egmont@gmail.com>, 2010
|
||||
|
||||
This file is part of the Midnight Commander.
|
||||
|
||||
@ -135,7 +136,7 @@ mc_skin_colors_old_configure_one (mc_skin_t * mc_skin, const char *the_color_str
|
||||
|
||||
for (; *colors; colors++)
|
||||
{
|
||||
key_val = g_strsplit_set (*colors, "=,", 3);
|
||||
key_val = g_strsplit_set (*colors, "=,", 4);
|
||||
|
||||
if (!key_val)
|
||||
continue;
|
||||
@ -147,7 +148,9 @@ mc_skin_colors_old_configure_one (mc_skin_t * mc_skin, const char *the_color_str
|
||||
continue;
|
||||
}
|
||||
|
||||
if (key_val[2] != NULL)
|
||||
if (key_val[3] != NULL)
|
||||
skin_val = g_strdup_printf ("%s;%s;%s", key_val[1], key_val[2], key_val[3]);
|
||||
else if (key_val[2] != NULL)
|
||||
skin_val = g_strdup_printf ("%s;%s", key_val[1], key_val[2]);
|
||||
else
|
||||
skin_val = g_strdup_printf ("%s;", key_val[1]);
|
||||
|
@ -2,10 +2,11 @@
|
||||
Skins engine.
|
||||
Work with colors
|
||||
|
||||
Copyright (C) 2009 The Free Software Foundation, Inc.
|
||||
Copyright (C) 2009, 2010 The Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009.
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009
|
||||
Egmont Koblinger <egmont@gmail.com>, 2010
|
||||
|
||||
This file is part of the Midnight Commander.
|
||||
|
||||
@ -144,36 +145,19 @@ mc_skin_color_get_from_ini_file (mc_skin_t * mc_skin, const gchar * group, const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (items_count)
|
||||
{
|
||||
case 0:
|
||||
tmp = mc_skin_color_get_with_defaults (group, "_default_");
|
||||
if (tmp != NULL)
|
||||
{
|
||||
mc_skin_color->fgcolor = g_strdup (tmp->fgcolor);
|
||||
mc_skin_color->bgcolor = g_strdup (tmp->bgcolor);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_strfreev (values);
|
||||
g_free (mc_skin_color);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
mc_skin_color->fgcolor = (values[0]) ? g_strstrip (g_strdup (values[0])) : NULL;
|
||||
tmp = mc_skin_color_get_with_defaults (group, "_default_");
|
||||
mc_skin_color->bgcolor = (tmp != NULL) ? g_strdup (tmp->bgcolor) : NULL;
|
||||
break;
|
||||
case 2:
|
||||
mc_skin_color->fgcolor = (values[0]) ? g_strstrip (g_strdup (values[0])) : NULL;
|
||||
mc_skin_color->bgcolor = (values[1]) ? g_strstrip (g_strdup (values[1])) : NULL;
|
||||
break;
|
||||
}
|
||||
tmp = mc_skin_color_get_with_defaults (group, "_default_");
|
||||
mc_skin_color->fgcolor = (items_count > 0 && values[0][0]) ? g_strstrip (g_strdup (values[0])) :
|
||||
(tmp != NULL) ? g_strdup (tmp->fgcolor) : NULL;
|
||||
mc_skin_color->bgcolor = (items_count > 1 && values[1][0]) ? g_strstrip (g_strdup (values[1])) :
|
||||
(tmp != NULL) ? g_strdup (tmp->bgcolor) : NULL;
|
||||
mc_skin_color->attrs = (items_count > 2 && values[2][0]) ? g_strstrip (g_strdup (values[2])) :
|
||||
(tmp != NULL) ? g_strdup (tmp->attrs) : NULL;
|
||||
|
||||
g_strfreev (values);
|
||||
|
||||
mc_skin_color->pair_index =
|
||||
tty_try_alloc_color_pair2 (mc_skin_color->fgcolor, mc_skin_color->bgcolor, FALSE);
|
||||
tty_try_alloc_color_pair2 (mc_skin_color->fgcolor, mc_skin_color->bgcolor,
|
||||
mc_skin_color->attrs, FALSE);
|
||||
|
||||
return mc_skin_color;
|
||||
}
|
||||
@ -189,8 +173,10 @@ mc_skin_color_set_default_for_terminal (mc_skin_t * mc_skin)
|
||||
{
|
||||
mc_skin_color->fgcolor = g_strdup ("default");
|
||||
mc_skin_color->bgcolor = g_strdup ("default");
|
||||
mc_skin_color->attrs = NULL;
|
||||
mc_skin_color->pair_index =
|
||||
tty_try_alloc_color_pair2 (mc_skin_color->fgcolor, mc_skin_color->bgcolor, FALSE);
|
||||
tty_try_alloc_color_pair2 (mc_skin_color->fgcolor, mc_skin_color->bgcolor,
|
||||
mc_skin_color->attrs, FALSE);
|
||||
mc_skin_color_add_to_hash (mc_skin, "skin", "terminal_default_color", mc_skin_color);
|
||||
}
|
||||
}
|
||||
@ -337,7 +323,7 @@ mc_skin_color_parse_ini_file (mc_skin_t * mc_skin)
|
||||
if (mc_skin_color == NULL)
|
||||
return FALSE;
|
||||
|
||||
tty_color_set_defaults (mc_skin_color->fgcolor, mc_skin_color->bgcolor);
|
||||
tty_color_set_defaults (mc_skin_color->fgcolor, mc_skin_color->bgcolor, mc_skin_color->attrs);
|
||||
mc_skin_color_add_to_hash (mc_skin, "core", "_default_", mc_skin_color);
|
||||
|
||||
for (; *groups != NULL; groups++)
|
||||
|
@ -2,10 +2,11 @@
|
||||
Skins engine.
|
||||
Interface functions
|
||||
|
||||
Copyright (C) 2009 The Free Software Foundation, Inc.
|
||||
Copyright (C) 2009, 2010 The Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009.
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009
|
||||
Egmont Koblinger <egmont@gmail.com>, 2010
|
||||
|
||||
This file is part of the Midnight Commander.
|
||||
|
||||
@ -54,6 +55,7 @@ mc_skin_hash_destroy_value (gpointer data)
|
||||
mc_skin_color_t *mc_skin_color = (mc_skin_color_t *) data;
|
||||
g_free (mc_skin_color->fgcolor);
|
||||
g_free (mc_skin_color->bgcolor);
|
||||
g_free (mc_skin_color->attrs);
|
||||
g_free (mc_skin_color);
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ typedef struct mc_skin_color_struct
|
||||
{
|
||||
gchar *fgcolor;
|
||||
gchar *bgcolor;
|
||||
gchar *attrs;
|
||||
int pair_index;
|
||||
} mc_skin_color_t;
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
/* Internal stuff of color setup
|
||||
Copyright (C) 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||
2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2009.
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009.
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2009
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009
|
||||
Egmont Koblinger <egmont@gmail.com>, 2010
|
||||
|
||||
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
|
||||
@ -49,21 +50,21 @@ typedef struct mc_tty_color_table_struct
|
||||
|
||||
mc_tty_color_table_t const color_table[] = {
|
||||
{"black", COLOR_BLACK},
|
||||
{"gray", COLOR_BLACK | A_BOLD},
|
||||
{"gray", COLOR_BLACK + 8},
|
||||
{"red", COLOR_RED},
|
||||
{"brightred", COLOR_RED | A_BOLD},
|
||||
{"brightred", COLOR_RED + 8},
|
||||
{"green", COLOR_GREEN},
|
||||
{"brightgreen", COLOR_GREEN | A_BOLD},
|
||||
{"brightgreen", COLOR_GREEN + 8},
|
||||
{"brown", COLOR_YELLOW},
|
||||
{"yellow", COLOR_YELLOW | A_BOLD},
|
||||
{"yellow", COLOR_YELLOW + 8},
|
||||
{"blue", COLOR_BLUE},
|
||||
{"brightblue", COLOR_BLUE | A_BOLD},
|
||||
{"brightblue", COLOR_BLUE + 8},
|
||||
{"magenta", COLOR_MAGENTA},
|
||||
{"brightmagenta", COLOR_MAGENTA | A_BOLD},
|
||||
{"brightmagenta", COLOR_MAGENTA + 8},
|
||||
{"cyan", COLOR_CYAN},
|
||||
{"brightcyan", COLOR_CYAN | A_BOLD},
|
||||
{"brightcyan", COLOR_CYAN + 8},
|
||||
{"lightgray", COLOR_WHITE},
|
||||
{"white", COLOR_WHITE | A_BOLD},
|
||||
{"white", COLOR_WHITE + 8},
|
||||
{"default", -1}, /* default color of the terminal */
|
||||
/* special colors */
|
||||
{"A_REVERSE", SPEC_A_REVERSE},
|
||||
@ -74,24 +75,71 @@ mc_tty_color_table_t const color_table[] = {
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
mc_tty_color_table_t const attributes_table[] = {
|
||||
{"bold", A_BOLD},
|
||||
{"underline", A_UNDERLINE},
|
||||
{"reverse", A_REVERSE},
|
||||
{"blink", A_BLINK},
|
||||
/* End of list */
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
/*** file scope functions ************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
parse_256_color_name (const char *color_name)
|
||||
{
|
||||
int i;
|
||||
char dummy;
|
||||
if (sscanf (color_name, "color%d%c", &i, &dummy) == 1 && i >= 0 && i < 256)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
if (sscanf (color_name, "gray%d%c", &i, &dummy) == 1 && i >= 0 && i < 24)
|
||||
{
|
||||
return 232 + i;
|
||||
}
|
||||
if (strncmp (color_name, "rgb", 3) == 0 &&
|
||||
color_name[3] >= '0' && color_name[3] < '6' &&
|
||||
color_name[4] >= '0' && color_name[4] < '6' &&
|
||||
color_name[5] >= '0' && color_name[5] < '6' && color_name[6] == '\0')
|
||||
{
|
||||
return 16 + 36 * (color_name[3] - '0') + 6 * (color_name[4] - '0') + (color_name[5] - '0');
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** public functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
const char *
|
||||
tty_color_get_valid_name (const char *color_name)
|
||||
tty_color_get_name_by_index (int idx)
|
||||
{
|
||||
static char **color_N_names = NULL;
|
||||
int i;
|
||||
|
||||
if (color_name != NULL)
|
||||
/* Find the real English name of the first 16 colors, */
|
||||
/* as well as the A_* special values. */
|
||||
for (i = 0; color_table[i].name != NULL; i++)
|
||||
if (idx == color_table[i].value)
|
||||
return color_table[i].name;
|
||||
/* Create and return the strings "color16" to "color255". */
|
||||
if (idx >= 16 && idx < 256)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; color_table[i].name != NULL; i++)
|
||||
if (strcmp (color_name, color_table[i].name) == 0)
|
||||
return color_table[i].name;
|
||||
if (color_N_names == NULL)
|
||||
{
|
||||
color_N_names = g_try_malloc0 (240 * sizeof (char *));
|
||||
}
|
||||
if (color_N_names[idx - 16] == NULL)
|
||||
{
|
||||
color_N_names[idx - 16] = g_try_malloc (9);
|
||||
sprintf (color_N_names[idx - 16], "color%d", idx);
|
||||
}
|
||||
return color_N_names[idx - 16];
|
||||
}
|
||||
return NULL;
|
||||
return "default";
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -106,8 +154,37 @@ tty_color_get_index_by_name (const char *color_name)
|
||||
for (i = 0; color_table[i].name != NULL; i++)
|
||||
if (strcmp (color_name, color_table[i].name) == 0)
|
||||
return color_table[i].value;
|
||||
return parse_256_color_name (color_name);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
tty_attr_get_bits (const char *attrs)
|
||||
{
|
||||
int attr_bits = 0;
|
||||
gchar **attr_list;
|
||||
int i, j;
|
||||
|
||||
if (attrs != NULL)
|
||||
{
|
||||
attr_list = g_strsplit (attrs, "+", -1);
|
||||
for (i = 0; attr_list[i] != NULL; i++)
|
||||
{
|
||||
for (j = 0; attributes_table[j].name != NULL; j++)
|
||||
{
|
||||
if (strcmp (attr_list[i], attributes_table[j].name) == 0)
|
||||
{
|
||||
attr_bits |= attributes_table[j].value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
g_strfreev (attr_list);
|
||||
}
|
||||
return attr_bits;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -33,11 +33,10 @@ typedef enum {
|
||||
|
||||
typedef struct mc_color_pair_struct
|
||||
{
|
||||
const char *cfg;
|
||||
const char *cbg;
|
||||
int ifg;
|
||||
int ibg;
|
||||
int pair_index;
|
||||
int attr;
|
||||
size_t pair_index;
|
||||
gboolean is_temp;
|
||||
} tty_color_pair_t;
|
||||
|
||||
@ -48,8 +47,9 @@ extern gboolean mc_tty_color_disable;
|
||||
|
||||
/*** declarations of public functions ************************************************************/
|
||||
|
||||
const char *tty_color_get_valid_name (const char *);
|
||||
const char *tty_color_get_name_by_index (int);
|
||||
int tty_color_get_index_by_name (const char *);
|
||||
int tty_attr_get_bits (const char *);
|
||||
|
||||
void tty_color_init_lib (gboolean, gboolean);
|
||||
void tty_color_deinit_lib (void);
|
||||
|
@ -1,9 +1,11 @@
|
||||
/* Color setup for NCurses screen library
|
||||
Copyright (C) 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||
2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2009.
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2009
|
||||
Slava Zanko <slavazanko@gmail.com>, 2010
|
||||
Egmont Koblinger <egmont@gmail.com>, 2010
|
||||
|
||||
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
|
||||
@ -57,28 +59,25 @@ mc_tty_color_attr_destroy_cb (gpointer data)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
mc_tty_color_save_attr_lib (int color_pair, int color_attr)
|
||||
static void
|
||||
mc_tty_color_save_attr (int color_pair, int color_attr)
|
||||
{
|
||||
int *attr, *key;
|
||||
|
||||
attr = g_try_new0 (int, 1);
|
||||
if (attr == NULL)
|
||||
return color_attr;
|
||||
return;
|
||||
|
||||
key = g_try_new (int, 1);
|
||||
if (key == NULL)
|
||||
{
|
||||
g_free (attr);
|
||||
return color_attr;
|
||||
return;
|
||||
}
|
||||
|
||||
*key = color_pair;
|
||||
*attr = color_attr;
|
||||
|
||||
if (color_attr != -1)
|
||||
*attr = color_attr & (A_BOLD | A_REVERSE | A_UNDERLINE);
|
||||
g_hash_table_replace (mc_tty_color_color_pair_attrs, (gpointer) key, (gpointer) attr);
|
||||
return color_attr & (~(*attr));
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -97,14 +96,13 @@ color_get_attr (int color_pair)
|
||||
|
||||
static void
|
||||
mc_tty_color_pair_init_special (tty_color_pair_t * mc_color_pair,
|
||||
int fg1, int bg1, int fg2, int bg2, int mask)
|
||||
int fg1, int bg1, int fg2, int bg2, int attr)
|
||||
{
|
||||
if (has_colors () && !mc_tty_color_disable)
|
||||
init_pair (mc_color_pair->pair_index,
|
||||
mc_tty_color_save_attr_lib (mc_color_pair->pair_index, fg1 | mask), bg1);
|
||||
init_pair (mc_color_pair->pair_index, fg1, bg1);
|
||||
else
|
||||
init_pair (mc_color_pair->pair_index,
|
||||
mc_tty_color_save_attr_lib (mc_color_pair->pair_index, fg2 | mask), bg2);
|
||||
init_pair (mc_color_pair->pair_index, fg2, bg2);
|
||||
mc_tty_color_save_attr (mc_color_pair->pair_index, attr);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -141,6 +139,7 @@ tty_color_deinit_lib (void)
|
||||
void
|
||||
tty_color_try_alloc_pair_lib (tty_color_pair_t * mc_color_pair)
|
||||
{
|
||||
|
||||
if (mc_color_pair->ifg <= (int) SPEC_A_REVERSE)
|
||||
{
|
||||
switch (mc_color_pair->ifg)
|
||||
@ -169,13 +168,21 @@ tty_color_try_alloc_pair_lib (tty_color_pair_t * mc_color_pair)
|
||||
}
|
||||
else
|
||||
{
|
||||
int mask_fg = (mc_color_pair->ifg == -1) ? mc_color_pair->ifg : 0xff;
|
||||
int mask_bg = (mc_color_pair->ibg == -1) ? mc_color_pair->ibg : 0xff;
|
||||
int ifg, ibg, attr;
|
||||
|
||||
init_pair (mc_color_pair->pair_index,
|
||||
mc_tty_color_save_attr_lib (mc_color_pair->pair_index,
|
||||
mc_color_pair->ifg) & mask_fg,
|
||||
mc_color_pair->ibg & mask_bg);
|
||||
ifg = mc_color_pair->ifg;
|
||||
ibg = mc_color_pair->ibg;
|
||||
attr = mc_color_pair->attr;
|
||||
|
||||
/* In 8 color mode, change bright colors into bold */
|
||||
if (COLORS == 8 && ifg >= 8 && ifg < 16)
|
||||
{
|
||||
ifg &= 0x07;
|
||||
attr |= A_BOLD;
|
||||
}
|
||||
|
||||
init_pair (mc_color_pair->pair_index, ifg, ibg);
|
||||
mc_tty_color_save_attr (mc_color_pair->pair_index, attr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
/* Color setup for S_Lang screen library
|
||||
Copyright (C) 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||
2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2009.
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2009
|
||||
Egmont Koblinger <egmont@gmail.com>, 2010
|
||||
|
||||
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
|
||||
@ -168,9 +169,10 @@ tty_color_try_alloc_pair_lib (tty_color_pair_t * mc_color_pair)
|
||||
}
|
||||
else
|
||||
{
|
||||
fg = (mc_color_pair->cfg) ? mc_color_pair->cfg : "default";
|
||||
bg = (mc_color_pair->cbg) ? mc_color_pair->cbg : "default";
|
||||
fg = tty_color_get_name_by_index(mc_color_pair->ifg);
|
||||
bg = tty_color_get_name_by_index(mc_color_pair->ibg);
|
||||
SLtt_set_color (mc_color_pair->pair_index, (char *) "", (char *) fg, (char *) bg);
|
||||
SLtt_add_color_attribute (mc_color_pair->pair_index, mc_color_pair->attr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,12 +11,21 @@
|
||||
/*** typedefs(not structures) and defined constants **********************************************/
|
||||
|
||||
/* When using Slang with color, we have all the indexes free but
|
||||
* those defined here (A_BOLD, A_UNDERLINE, A_REVERSE, A_BOLD_REVERSE)
|
||||
* those defined here (A_BOLD, A_UNDERLINE, A_REVERSE, A_BLINK)
|
||||
*/
|
||||
|
||||
#ifndef A_BOLD
|
||||
#define A_BOLD SLTT_BOLD_MASK
|
||||
#endif /* A_BOLD */
|
||||
#ifndef A_UNDERLINE
|
||||
#define A_UNDERLINE SLTT_ULINE_MASK
|
||||
#endif /* A_UNDERLINE */
|
||||
#ifndef A_REVERSE
|
||||
#define A_REVERSE SLTT_REV_MASK
|
||||
#endif /* A_REVERSE */
|
||||
#ifndef A_BLINK
|
||||
#define A_BLINK SLTT_BLINK_MASK
|
||||
#endif /* A_BLINK */
|
||||
|
||||
/*** enums ***************************************************************************************/
|
||||
|
||||
|
@ -2,11 +2,13 @@
|
||||
Interface functions.
|
||||
|
||||
Copyright (C) 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||
2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2009.
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009.
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2009
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009
|
||||
Egmont Koblinger <egmont@gmail.com>, 2010
|
||||
|
||||
|
||||
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
|
||||
@ -46,6 +48,7 @@ char *command_line_colors = NULL;
|
||||
|
||||
static char *tty_color_defaults__fg = NULL;
|
||||
static char *tty_color_defaults__bg = NULL;
|
||||
static char *tty_color_defaults__attrs = NULL;
|
||||
|
||||
/* Set if we are actually using colors */
|
||||
gboolean use_colors = FALSE;
|
||||
@ -87,7 +90,7 @@ tty_color_free_all (gboolean is_temp_color)
|
||||
static gboolean
|
||||
tty_color_get_next_cpn_cb (gpointer key, gpointer value, gpointer user_data)
|
||||
{
|
||||
int cp;
|
||||
size_t cp;
|
||||
tty_color_pair_t *mc_color_pair;
|
||||
(void) key;
|
||||
|
||||
@ -99,7 +102,7 @@ tty_color_get_next_cpn_cb (gpointer key, gpointer value, gpointer user_data)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
static size_t
|
||||
tty_color_get_next__color_pair_number (void)
|
||||
{
|
||||
const size_t cp_count = g_hash_table_size (mc_tty_color__hashtable);
|
||||
@ -132,6 +135,7 @@ tty_colors_done (void)
|
||||
tty_color_deinit_lib ();
|
||||
g_free (tty_color_defaults__fg);
|
||||
g_free (tty_color_defaults__bg);
|
||||
g_free (tty_color_defaults__attrs);
|
||||
|
||||
g_hash_table_destroy (mc_tty_color__hashtable);
|
||||
}
|
||||
@ -147,21 +151,25 @@ tty_use_colors (void)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
tty_try_alloc_color_pair2 (const char *fg, const char *bg, gboolean is_temp_color)
|
||||
tty_try_alloc_color_pair2 (const char *fg, const char *bg, const char *attrs,
|
||||
gboolean is_temp_color)
|
||||
{
|
||||
gchar *color_pair;
|
||||
tty_color_pair_t *mc_color_pair;
|
||||
const char *c_fg, *c_bg;
|
||||
int ifg, ibg, attr;
|
||||
|
||||
if (fg == NULL)
|
||||
if (fg == NULL || !strcmp (fg, "base"))
|
||||
fg = tty_color_defaults__fg;
|
||||
if (bg == NULL)
|
||||
if (bg == NULL || !strcmp (bg, "base"))
|
||||
bg = tty_color_defaults__bg;
|
||||
if (attrs == NULL || !strcmp (attrs, "base"))
|
||||
attrs = tty_color_defaults__attrs;
|
||||
|
||||
c_fg = tty_color_get_valid_name (fg);
|
||||
c_bg = tty_color_get_valid_name (bg);
|
||||
ifg = tty_color_get_index_by_name (fg);
|
||||
ibg = tty_color_get_index_by_name (bg);
|
||||
attr = tty_attr_get_bits (attrs);
|
||||
|
||||
color_pair = g_strdup_printf ("%s.%s", c_fg, c_bg);
|
||||
color_pair = g_strdup_printf ("%d.%d.%d", ifg, ibg, attr);
|
||||
if (color_pair == NULL)
|
||||
return 0;
|
||||
|
||||
@ -182,10 +190,9 @@ tty_try_alloc_color_pair2 (const char *fg, const char *bg, gboolean is_temp_colo
|
||||
}
|
||||
|
||||
mc_color_pair->is_temp = is_temp_color;
|
||||
mc_color_pair->cfg = c_fg;
|
||||
mc_color_pair->cbg = c_bg;
|
||||
mc_color_pair->ifg = tty_color_get_index_by_name (c_fg);
|
||||
mc_color_pair->ibg = tty_color_get_index_by_name (c_bg);
|
||||
mc_color_pair->ifg = ifg;
|
||||
mc_color_pair->ibg = ibg;
|
||||
mc_color_pair->attr = attr;
|
||||
mc_color_pair->pair_index = tty_color_get_next__color_pair_number ();
|
||||
|
||||
tty_color_try_alloc_pair_lib (mc_color_pair);
|
||||
@ -198,9 +205,9 @@ tty_try_alloc_color_pair2 (const char *fg, const char *bg, gboolean is_temp_colo
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
tty_try_alloc_color_pair (const char *fg, const char *bg)
|
||||
tty_try_alloc_color_pair (const char *fg, const char *bg, const char *attrs)
|
||||
{
|
||||
return tty_try_alloc_color_pair2 (fg, bg, TRUE);
|
||||
return tty_try_alloc_color_pair2 (fg, bg, attrs, TRUE);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -222,13 +229,15 @@ tty_color_free_all_non_tmp (void)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
tty_color_set_defaults (const char *fgcolor, const char *bgcolor)
|
||||
tty_color_set_defaults (const char *fgcolor, const char *bgcolor, const char *attrs)
|
||||
{
|
||||
g_free (tty_color_defaults__fg);
|
||||
g_free (tty_color_defaults__fg);
|
||||
g_free (tty_color_defaults__attrs);
|
||||
|
||||
tty_color_defaults__fg = (fgcolor != NULL) ? g_strdup (fgcolor) : NULL;
|
||||
tty_color_defaults__bg = (bgcolor != NULL) ? g_strdup (bgcolor) : NULL;
|
||||
tty_color_defaults__attrs = (attrs != NULL) ? g_strdup (attrs) : NULL;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -38,8 +38,8 @@ void tty_init_colors (gboolean disable, gboolean force);
|
||||
void tty_colors_done (void);
|
||||
|
||||
gboolean tty_use_colors (void);
|
||||
int tty_try_alloc_color_pair (const char *, const char *);
|
||||
int tty_try_alloc_color_pair2 (const char *, const char *, gboolean);
|
||||
int tty_try_alloc_color_pair (const char *, const char *, const char *);
|
||||
int tty_try_alloc_color_pair2 (const char *, const char *, const char *, gboolean);
|
||||
|
||||
void tty_color_free_all_tmp (void);
|
||||
void tty_color_free_all_non_tmp (void);
|
||||
@ -48,7 +48,7 @@ void tty_setcolor (int color);
|
||||
void tty_lowlevel_setcolor (int color);
|
||||
void tty_set_normal_attrs (void);
|
||||
|
||||
void tty_color_set_defaults (const char *, const char *);
|
||||
void tty_color_set_defaults (const char *, const char *, const char *);
|
||||
|
||||
/*** inline functions ****************************************************************************/
|
||||
#endif /* MC_COLOR_H */
|
||||
|
@ -2,10 +2,11 @@
|
||||
Interface to the terminal controlling library.
|
||||
Slang wrapper.
|
||||
|
||||
Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2009.
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2009
|
||||
Egmont Koblinger <egmont@gmail.com>, 2010
|
||||
|
||||
This file is part of the Midnight Commander.
|
||||
|
||||
@ -291,7 +292,7 @@ tty_init (gboolean slow, gboolean ugly_lines)
|
||||
|
||||
tty_reset_prog_mode ();
|
||||
load_terminfo_keys ();
|
||||
SLtt_Blink_Mode = 0;
|
||||
SLtt_Blink_Mode = 1;
|
||||
|
||||
tty_start_interrupt_key ();
|
||||
|
||||
|
@ -6,7 +6,9 @@ skin_DATA = \
|
||||
double-lines.ini \
|
||||
featured.ini \
|
||||
gotar.ini \
|
||||
nicedark.ini
|
||||
nicedark.ini \
|
||||
sand256.ini
|
||||
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(skin_DATA)
|
||||
|
174
misc/skins/sand256.ini
Normal file
174
misc/skins/sand256.ini
Normal file
@ -0,0 +1,174 @@
|
||||
# This skin demonstrates how to use 256 colors in mc.
|
||||
#
|
||||
# As a prerequisite, you will need to:
|
||||
# 1) Have a terminal emulator that supports 256 colors (a few examples:
|
||||
# xterm, Gnome terminal and other VTE derivatives, KDE's Konsole;
|
||||
# iTerm for Mac OS X, PuTTY for Windows).
|
||||
# 2) Adjust your TERM variable accordingly, e.g.: export TERM=xterm-256color
|
||||
# Verify by running tput colors
|
||||
#
|
||||
# Each of the 256 colors has two names, you can use whichever you prefer.
|
||||
#
|
||||
# One possibility is to use the names "color0" to "color255" to access every
|
||||
# color directly based on their number.
|
||||
#
|
||||
# The first 16 colors ("color0" to "color15") can also be specified by their
|
||||
# names (these names are already being used by mc for 8/16 color terminals):
|
||||
# black gray
|
||||
# red brightred
|
||||
# green brightgreen
|
||||
# brown yellow
|
||||
# blue brightblue
|
||||
# magenta brightmagenta
|
||||
# cyan brightcyan
|
||||
# lightgray white
|
||||
# Note that with 8/16 color terminal settings (such as TERM=xterm), colors
|
||||
# of the second column can only be used for the foreground, and their actual
|
||||
# interpretation varies across terminals. Some terminals show the colors
|
||||
# from the first column instead (that is, you only have 8 colors), but make
|
||||
# them bold. Others show the brighter version (16 foreground colors). Yet
|
||||
# others make them bold and bright at the same time. Switching to 256 colors
|
||||
# should end this ambiguity: you should have 16 separate colors according to
|
||||
# their names, none of them are bold by default but any of them can be
|
||||
# switched to bold, and all of them are available for background, too. This
|
||||
# is the intended behavior, the actual behavior might vary across terminals.
|
||||
#
|
||||
# Colors of the 6x6x6 cube ("color16" to "color231") can alternatively be
|
||||
# referred to as "rgb000" to "rgb555", all three digits ranging from 0 to 5,
|
||||
# corresponding to the R, G and B color components.
|
||||
#
|
||||
# The 24 grayscale colors ("color232" to "color255") have the aliases "gray0"
|
||||
# to "gray23".
|
||||
#
|
||||
# In addition to the 256 colors, the special word "default" means the
|
||||
# default foreground or background color of your terminal, while "base" means
|
||||
# mc's main colors. A missing value means falling back to the _default_ of the
|
||||
# given section.
|
||||
#
|
||||
# Following the foreground and background colors, the third (optional) value
|
||||
# can specify special attributes to enable. Valid values are bold, underline,
|
||||
# reverse and blink. Append more with a plus sign, e.g. "underline+bold".
|
||||
# Leaving the field empty makes it fall back to the attributes of _default_.
|
||||
# Use any other word (e.g. "none") to prevent fallback and disable all flags.
|
||||
|
||||
[skin]
|
||||
description=Sand skin using 256 colors
|
||||
|
||||
[Lines]
|
||||
horiz=─
|
||||
vert=│
|
||||
lefttop=┌
|
||||
righttop=┐
|
||||
leftbottom=└
|
||||
rightbottom=┘
|
||||
topmiddle=─
|
||||
bottommiddle=─
|
||||
leftmiddle=├
|
||||
rightmiddle=┤
|
||||
cross=┼
|
||||
dhoriz=─
|
||||
dvert=│
|
||||
dlefttop=┌
|
||||
drighttop=┐
|
||||
dleftbottom=└
|
||||
drightbottom=┘
|
||||
dtopmiddle=─
|
||||
dbottommiddle=─
|
||||
dleftmiddle=├
|
||||
drightmiddle=┤
|
||||
|
||||
[core]
|
||||
_default_=black;rgb554
|
||||
selected=;rgb452
|
||||
marked=rgb400
|
||||
markselect=rgb400;rgb452
|
||||
gauge=;rgb452
|
||||
input=;rgb452
|
||||
reverse=;rgb452
|
||||
|
||||
[dialog]
|
||||
_default_=black;rgb553
|
||||
dfocus=;rgb452
|
||||
dhotnormal=;;underline
|
||||
dhotfocus=;rgb452;underline
|
||||
|
||||
[error]
|
||||
_default_=rgb554;rgb320;bold
|
||||
errdhotnormal=;;bold+underline
|
||||
errdhotfocus=black;rgb452;underline
|
||||
|
||||
[filehighlight]
|
||||
directory=
|
||||
executable=rgb030
|
||||
symlink=rgb202
|
||||
# 404 Not Found :)
|
||||
stalelink=rgb404
|
||||
device=rgb231
|
||||
special=rgb331
|
||||
core=rgb430
|
||||
temp=gray15
|
||||
archive=rgb012
|
||||
doc=rgb103
|
||||
source=rgb310
|
||||
media=rgb024
|
||||
graph=rgb033
|
||||
database=rgb421
|
||||
|
||||
[menu]
|
||||
_default_=black;rgb452
|
||||
menuhot=;;underline
|
||||
menusel=;rgb551
|
||||
menuhotsel=;rgb551;underline
|
||||
menuinactive=
|
||||
|
||||
[buttonbar]
|
||||
hotkey=black;rgb554
|
||||
button=black;rgb452
|
||||
|
||||
[help]
|
||||
_default_=black;rgb553
|
||||
helpitalic=green
|
||||
helpbold=red
|
||||
helplink=blue;;underline
|
||||
helpslink=blue;;reverse
|
||||
|
||||
[editor]
|
||||
_default_=black;rgb554
|
||||
editbold=rgb400
|
||||
editmarked=;rgb452
|
||||
editwhitespace=rgb400;rgb553
|
||||
editlinestate=;rgb553
|
||||
bookmark=;rgb551
|
||||
bookmarkfound=;rgb530
|
||||
editrightmargin=rgb400;rgb553
|
||||
|
||||
[viewer]
|
||||
viewunderline=;;underline
|
||||
|
||||
[diffviewer]
|
||||
added=;rgb450
|
||||
changedline=blue;rgb553
|
||||
changednew=rgb400;rgb553
|
||||
changed=;rgb553
|
||||
removed=;rgb511
|
||||
folder=;rgb530
|
||||
error=rgb554;rgb320
|
||||
|
||||
[widget-common]
|
||||
sort-sign-up = ↓
|
||||
sort-sign-down = ↑
|
||||
|
||||
[widget-panel]
|
||||
hiddenfiles-sign-show = •
|
||||
hiddenfiles-sign-hide = ○
|
||||
history-prev-item-sign = «
|
||||
history-next-item-sign = »
|
||||
history-show-list-sign = ^
|
||||
|
||||
[widget-scollbar]
|
||||
first-vert-char=↑
|
||||
last-vert-char=↓
|
||||
first-horiz-char=«
|
||||
last-horiz-char=»
|
||||
current-char=■
|
||||
background-char=▒
|
15
src/args.c
15
src/args.c
@ -322,8 +322,8 @@ mc_args_new_color_group (void)
|
||||
/* FIXME: to preserve translations, lines should be split. */
|
||||
mc_args__loc__colors_string = g_strdup_printf ("%s\n%s",
|
||||
/* TRANSLATORS: don't translate keywords */
|
||||
_("--colors KEYWORD={FORE},{BACK}\n\n"
|
||||
"{FORE} and {BACK} can be omitted, and the default will be used\n"
|
||||
_("--colors KEYWORD={FORE},{BACK},{ATTR}:KEYWORD2=...\n\n"
|
||||
"{FORE}, {BACK} and {ATTR} can be omitted, and the default will be used\n"
|
||||
"\n Keywords:\n"
|
||||
" Global: errors, disabled, reverse, gauge, viewunderline\n"
|
||||
" input, inputmark, inputunchanged, commandlinemark\n"
|
||||
@ -337,11 +337,16 @@ mc_args_new_color_group (void)
|
||||
" editlinestate\n"
|
||||
" Viewer: viewunderline\n"
|
||||
" Help: helpnormal, helpitalic, helpbold, helplink, helpslink\n"),
|
||||
/* TRANSLATORS: don't translate color names */
|
||||
_("Colors:\n"
|
||||
/* TRANSLATORS: don't translate color names and attributes */
|
||||
_("Standard Colors:\n"
|
||||
" black, gray, red, brightred, green, brightgreen, brown,\n"
|
||||
" yellow, blue, brightblue, magenta, brightmagenta, cyan,\n"
|
||||
" brightcyan, lightgray and white\n\n"));
|
||||
" brightcyan, lightgray and white\n\n"
|
||||
"Extended colors, when 256 colors are available:\n"
|
||||
" color16 to color255, or rgb000 to rgb555 and gray0 to gray23\n\n"
|
||||
"Attributes:\n"
|
||||
" bold, underline, reverse, blink; append more with '+'\n")
|
||||
);
|
||||
|
||||
return g_option_group_new ("color", mc_args__loc__colors_string,
|
||||
_("Color options"), NULL, NULL);
|
||||
|
@ -1,9 +1,11 @@
|
||||
/* editor syntax highlighting.
|
||||
|
||||
Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2004, 2005, 2006,
|
||||
2007 Free Software Foundation, Inc.
|
||||
2007, 2010 Free Software Foundation, Inc.
|
||||
|
||||
Authors: 1998 Paul Sheer
|
||||
Authors:
|
||||
1998 Paul Sheer
|
||||
Egmont Koblinger <egmont@gmail.com>, 2010
|
||||
|
||||
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
|
||||
@ -762,14 +764,16 @@ get_args (char *l, char **args, int args_size)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
this_try_alloc_color_pair (const char *fg, const char *bg)
|
||||
this_try_alloc_color_pair (const char *fg, const char *bg, const char *attrs)
|
||||
{
|
||||
char f[80], b[80], *p;
|
||||
char f[80], b[80], a[80], *p;
|
||||
|
||||
if (bg != NULL && *bg == '\0')
|
||||
bg = NULL;
|
||||
if (fg != NULL && *fg == '\0')
|
||||
fg = NULL;
|
||||
if (attrs != NULL && *attrs == '\0')
|
||||
attrs = NULL;
|
||||
|
||||
if ((fg == NULL) && (bg == NULL))
|
||||
return EDITOR_NORMAL_COLOR;
|
||||
@ -820,7 +824,19 @@ this_try_alloc_color_pair (const char *fg, const char *bg)
|
||||
g_free (editnormal);
|
||||
}
|
||||
|
||||
return tty_try_alloc_color_pair (fg, bg);
|
||||
if (attrs != NULL)
|
||||
{
|
||||
g_strlcpy (a, attrs, sizeof (a));
|
||||
p = strchr (a, '/');
|
||||
if (p != NULL)
|
||||
*p = '\0';
|
||||
/* get_args() mangles the + signs, unmangle 'em */
|
||||
p = a;
|
||||
while ((p = strchr (p, SYNTAX_TOKEN_PLUS)) != NULL)
|
||||
*p++ = '+';
|
||||
attrs = a;
|
||||
}
|
||||
return tty_try_alloc_color_pair (fg, bg, attrs);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -873,8 +889,8 @@ static int
|
||||
edit_read_syntax_rules (WEdit * edit, FILE * f, char **args, int args_size)
|
||||
{
|
||||
FILE *g = NULL;
|
||||
char *fg, *bg;
|
||||
char last_fg[32] = "", last_bg[32] = "";
|
||||
char *fg, *bg, *attrs;
|
||||
char last_fg[32] = "", last_bg[32] = "", last_attrs[64] = "";
|
||||
char whole_right[512];
|
||||
char whole_left[512];
|
||||
char *l = 0;
|
||||
@ -1051,11 +1067,15 @@ edit_read_syntax_rules (WEdit * edit, FILE * f, char **args, int args_size)
|
||||
if (*a)
|
||||
a++;
|
||||
bg = *a;
|
||||
if (*a)
|
||||
a++;
|
||||
attrs = *a;
|
||||
if (*a)
|
||||
a++;
|
||||
g_strlcpy (last_fg, fg ? fg : "", sizeof (last_fg));
|
||||
g_strlcpy (last_bg, bg ? bg : "", sizeof (last_bg));
|
||||
c->keyword[0]->color = this_try_alloc_color_pair (fg, bg);
|
||||
g_strlcpy (last_attrs, attrs ? attrs : "", sizeof (last_attrs));
|
||||
c->keyword[0]->color = this_try_alloc_color_pair (fg, bg, attrs);
|
||||
c->keyword[0]->keyword = g_strdup (" ");
|
||||
check_not_a;
|
||||
|
||||
@ -1120,13 +1140,18 @@ edit_read_syntax_rules (WEdit * edit, FILE * f, char **args, int args_size)
|
||||
if (*a)
|
||||
a++;
|
||||
bg = *a;
|
||||
if (*a)
|
||||
a++;
|
||||
attrs = *a;
|
||||
if (*a)
|
||||
a++;
|
||||
if (!fg)
|
||||
fg = last_fg;
|
||||
if (!bg)
|
||||
bg = last_bg;
|
||||
k->color = this_try_alloc_color_pair (fg, bg);
|
||||
if (!attrs)
|
||||
attrs = last_attrs;
|
||||
k->color = this_try_alloc_color_pair (fg, bg, attrs);
|
||||
check_not_a;
|
||||
|
||||
if (++num_words >= alloc_words_per_context)
|
||||
|
Loading…
Reference in New Issue
Block a user