ref: refs/heads/master
commit 409db76f2bd6f6ab47fc35b41ea9bdd35022f6ac
Author: Ján Kupec
Date: Sat Apr 25 22:41:51 2009 +0200
color/highlight config option introduced
---
src/Config.cc | 10 ++++++++++
src/Config.h | 3 +++
src/utils/colors.cc | 2 ++
src/utils/colors.h | 1 +
zypper.conf | 11 ++++++++++-
5 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/src/Config.cc b/src/Config.cc
index 91ecf1e..99be31c 100644
--- a/src/Config.cc
+++ b/src/Config.cc
@@ -41,6 +41,7 @@ const ConfigOption ConfigOption::COLOR_MSG_ERROR(ConfigOption::COLOR_MSG_ERROR_e
const ConfigOption ConfigOption::COLOR_MSG_WARNING(ConfigOption::COLOR_MSG_WARNING_e);
const ConfigOption ConfigOption::COLOR_POSITIVE(ConfigOption::COLOR_POSITIVE_e);
const ConfigOption ConfigOption::COLOR_NEGATIVE(ConfigOption::COLOR_NEGATIVE_e);
+const ConfigOption ConfigOption::COLOR_HIGHLIGHT(ConfigOption::COLOR_HIGHLIGHT_e);
const ConfigOption ConfigOption::COLOR_PROMPT_OPTION(ConfigOption::COLOR_PROMPT_OPTION_e);
const ConfigOption ConfigOption::COLOR_PROMPT_SHORTHAND(ConfigOption::COLOR_PROMPT_SHORTHAND_e);
@@ -62,6 +63,7 @@ ConfigOption::Option ConfigOption::parse(const std::string & strval_r)
_table["color/msgWarning"] = ConfigOption::COLOR_MSG_WARNING_e;
_table["color/positive"] = ConfigOption::COLOR_POSITIVE_e;
_table["color/negative"] = ConfigOption::COLOR_NEGATIVE_e;
+ _table["color/highlight"] = ConfigOption::COLOR_HIGHLIGHT_e;
_table["color/promptOption"] = ConfigOption::COLOR_PROMPT_OPTION_e;
}
map::const_iterator it = _table.find(strval_r);
@@ -88,6 +90,7 @@ const string ConfigOption::asString() const
_table_str[COLOR_MSG_WARNING_e] = "color/msgWarning";
_table_str[COLOR_POSITIVE_e] = "color/positive";
_table_str[COLOR_NEGATIVE_e] = "color/negative";
+ _table_str[COLOR_HIGHLIGHT_e] = "color/highlight";
_table_str[COLOR_PROMPT_OPTION_e] = "color/promptOption";
}
map::const_iterator it = _table_str.find(_value);
@@ -108,6 +111,7 @@ Config::Config()
, color_msgWarning ("yellow")
, color_positive ("green")
, color_negative ("red")
+ , color_highlight ("cyan")
, color_promptOption("grey")
{}
@@ -205,6 +209,12 @@ void Config::read()
if (!c.value().empty())
color_negative = c;
+ ////// color/highlight //////
+
+ c = Color(augeas.getOption(ConfigOption::COLOR_HIGHLIGHT.asString()));
+ if (!c.value().empty())
+ color_highlight = c;
+
////// color/colorPromptOption //////
c = Color(augeas.getOption(ConfigOption::COLOR_PROMPT_OPTION.asString()));
diff --git a/src/Config.h b/src/Config.h
index 5871e2b..402387f 100644
--- a/src/Config.h
+++ b/src/Config.h
@@ -25,6 +25,7 @@ public:
static const ConfigOption COLOR_MSG_WARNING;
static const ConfigOption COLOR_POSITIVE;
static const ConfigOption COLOR_NEGATIVE;
+ static const ConfigOption COLOR_HIGHLIGHT;
static const ConfigOption COLOR_PROMPT_OPTION;
static const ConfigOption COLOR_PROMPT_SHORTHAND;
@@ -40,6 +41,7 @@ public:
COLOR_MSG_WARNING_e,
COLOR_POSITIVE_e,
COLOR_NEGATIVE_e,
+ COLOR_HIGHLIGHT_e,
COLOR_PROMPT_OPTION_e,
COLOR_PROMPT_SHORTHAND_e
};
@@ -94,6 +96,7 @@ struct Config
Color color_msgWarning;
Color color_positive;
Color color_negative;
+ Color color_highlight;
Color color_promptOption;
};
diff --git a/src/utils/colors.cc b/src/utils/colors.cc
index 1bc5d0f..02d1c51 100644
--- a/src/utils/colors.cc
+++ b/src/utils/colors.cc
@@ -89,6 +89,8 @@ static const string get_color(const Config & conf, const ColorContext context)
return conf.color_negative.value();
case COLOR_CONTEXT_PROMPT_OPTION:
return conf.color_promptOption.value();
+ case COLOR_CONTEXT_HIGHLIGHT:
+ return conf.color_highlight.value();
default:
return COLOR_RESET;
}
diff --git a/src/utils/colors.h b/src/utils/colors.h
index c2d84ab..adda775 100644
--- a/src/utils/colors.h
+++ b/src/utils/colors.h
@@ -56,6 +56,7 @@ typedef enum zypper_color_contexts
COLOR_CONTEXT_NEGATIVE = 6,
COLOR_CONTEXT_PROMPT_OPTION = 7,
COLOR_CONTEXT_PROMPT_SHORTHAND = 8,
+ COLOR_CONTEXT_HIGHLIGHT = 9,
COLOR_CONTEXT_DEFAULT = -1
} ColorContext;
diff --git a/zypper.conf b/zypper.conf
index 98ecc21..d575a84 100644
--- a/zypper.conf
+++ b/zypper.conf
@@ -14,7 +14,7 @@
## 0 1 yes no on off true false
## Color values are:
## white grey darkgrey black red green blue yellow brown cyan purple
-## lightred lightgreen lighblue lighcyan lighpurple
+## lightred lightgreen lightblue lightcyan lightpurple
[main]
@@ -96,6 +96,15 @@
##
# negative = red
+## Color for highlighting information for easier reading.
+## Unlike positive/negative color, this is intended for neutral information,
+## like highlighting table column by which the rows are sorted.
+##
+## Valid values: color
+## Default value: lightcyan
+##
+# highlight = lightcyan
+
## Color for user dialog options.
##
## Valid values: color
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org