Color Command
- Added support for displaying color samples. If you run the command 'task color red on grey12' then task will show you a sample of this color, along with other examples. This is helpful if you are trying to choose colors for auto colorization rules.
This commit is contained in:
@@ -27,10 +27,12 @@
|
||||
+ The new 'priority_long' field can be shown in custom reports, and will
|
||||
display 'High' rather than the abbreviated 'H'.
|
||||
+ Added feature #307 that provides vim with syntax highlighting for .taskrc.
|
||||
+ Task now support .taskrc command line overrides using rc.name:value and
|
||||
+ Task now supports .taskrc command line overrides using rc.name:value and
|
||||
the new rc.name=value to accommodate a frequent mistake.
|
||||
+ The color rules for projects (color.project.foo) now matches on partial
|
||||
project names, the same way as filters.
|
||||
+ The color command now takes a color as an argument, and displays that color
|
||||
with sample text.
|
||||
+ Fixed bug that showed a calendar for the year 2037 when 'task calendar due'
|
||||
was run, and there are no tasks with due dates.
|
||||
+ Fixed bug #316 which caused the timesheet report to display an oddly sorted
|
||||
|
||||
@@ -328,7 +328,8 @@ black, blue, red, green, cyan, magenta, yellow or white
|
||||
.RE
|
||||
|
||||
All colors are specified in this way. Take a look in .taskrc for all the other
|
||||
color rules that you control.
|
||||
color rules that you control, and run 'task color' to see samples of all
|
||||
supported colors.
|
||||
|
||||
Tagging tasks is a good way to group them, aside from specifying a project.
|
||||
To add a tag to a task:
|
||||
|
||||
@@ -121,8 +121,8 @@ Imports tasks from a variety of formats.
|
||||
Exports all tasks as a CSV file.
|
||||
|
||||
.TP
|
||||
.B color
|
||||
Displays all possible colors.
|
||||
.B color [sample]
|
||||
Displays all possible colors, or a sample.
|
||||
|
||||
.TP
|
||||
.B version
|
||||
|
||||
@@ -1369,7 +1369,42 @@ int handleColor (std::string &outs)
|
||||
{
|
||||
int rc = 0;
|
||||
std::stringstream out;
|
||||
|
||||
if (context.config.get ("color", true) || context.config.get (std::string ("_forcecolor"), false))
|
||||
{
|
||||
// If there is something in the description, then assume that is a color,
|
||||
// and display it as a sample.
|
||||
std::string description = context.task.get ("description");
|
||||
if (description != "")
|
||||
{
|
||||
Color one ("black on bright yellow");
|
||||
Color two ("underline cyan on bright blue");
|
||||
Color three ("color214 on color202");
|
||||
Color four ("rgb150 on rgb020");
|
||||
Color five ("underline grey10 on grey3");
|
||||
Color six ("red on color173");
|
||||
Color sample (description);
|
||||
|
||||
out << std::endl
|
||||
<< "Use this command to see how colors are displayed by your terminal." << std::endl
|
||||
<< std::endl
|
||||
<< "16-color usage (supports underline, bold text, bright background):" << std::endl
|
||||
<< " " << one.colorize ("task color black on bright yellow") << std::endl
|
||||
<< " " << two.colorize ("task color underline cyan on bright blue") << std::endl
|
||||
<< std::endl
|
||||
<< "256-color usage (supports underline):" << std::endl
|
||||
<< " " << three.colorize ("task color color214 on color202") << std::endl
|
||||
<< " " << four.colorize ("task color rgb150 on rgb020") << std::endl
|
||||
<< " " << five.colorize ("task color underline grey10 on grey3") << std::endl
|
||||
<< " " << six.colorize ("task color red on color173") << std::endl
|
||||
<< std::endl
|
||||
<< "Your sample:" << std::endl
|
||||
<< " " << sample.colorize ("task color " + description) << std::endl
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
// Show all supported colors. Possibly show some unsupported ones too.
|
||||
else
|
||||
{
|
||||
out << std::endl
|
||||
<< "Basic colors"
|
||||
@@ -1452,7 +1487,12 @@ int handleColor (std::string &outs)
|
||||
out << Color::colorize (" ", s.str ());
|
||||
}
|
||||
|
||||
out << std::endl << std::endl;
|
||||
out << std::endl
|
||||
<< std::endl
|
||||
<< "Try running 'task color white on red'"
|
||||
<< std::endl
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -178,8 +178,8 @@ int shortUsage (std::string &outs)
|
||||
table.addCell (row, 2, "Lists all tasks in CSV format.");
|
||||
|
||||
row = table.addRow ();
|
||||
table.addCell (row, 1, "task color");
|
||||
table.addCell (row, 2, "Displays all possible colors.");
|
||||
table.addCell (row, 1, "task color [sample]");
|
||||
table.addCell (row, 2, "Displays all possible colors, or a sample.");
|
||||
|
||||
row = table.addRow ();
|
||||
table.addCell (row, 1, "task version");
|
||||
|
||||
Reference in New Issue
Block a user