From 913c3dd7117bfe7a2d1cb57b47b34cfc8dcbb98b Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Tue, 12 Apr 2022 23:47:32 +0200 Subject: [PATCH] Accept both colons and semicolons in inline pal spec --- man/rgbgfx.1 | 12 ++++++------ src/gfx/pal_spec.cpp | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/man/rgbgfx.1 b/man/rgbgfx.1 index 4b09b21d..9091751a 100644 --- a/man/rgbgfx.1 +++ b/man/rgbgfx.1 @@ -122,12 +122,12 @@ begins with a hash character .Ql # , it is treated as an inline palette specification. It should contain a comma-separated list of hexadecimal colors, each beginning with a hash. -Colors in are accepted in the following formats: -.Ql #rgb , -.Ql #rrggbb , -and -.Ql #rrggbbaa . -Palettes must be separated by a semicolon (they may require quoting to avoid special handling by the shell), and spaces are allowed around semicolons and commas; trailing commas and semicolons are allowed. +Colors in are accepted either as +.Ql #rgb +or +.Ql #rrggbb +format. +Palettes must be separated by a colon or semicolon (the latter may require quoting to avoid special handling by the shell), and spaces are allowed around colons, semicolons and commas; trailing commas and semicolons are allowed. See .Sx EXAMPLES for an example of an inline palette specification. diff --git a/src/gfx/pal_spec.cpp b/src/gfx/pal_spec.cpp index 37a6b92b..487b7128 100644 --- a/src/gfx/pal_spec.cpp +++ b/src/gfx/pal_spec.cpp @@ -128,7 +128,7 @@ void parseInlinePalSpec(char const * const rawArg) { skipWhitespace(arg, n); if (n == arg.length()) { break; - } else if (arg[n] != ';') { + } else if (arg[n] != ';' && arg[n] != ':') { if (nbColors == 4) { parseError(n, 1, "Each palette can only contain up to 4 colors"); return; @@ -137,6 +137,7 @@ void parseInlinePalSpec(char const * const rawArg) { } [[fallthrough]]; + case ':': case ';': ++n; skipWhitespace(arg, n); @@ -265,7 +266,6 @@ static void parsePSPFile(std::filebuf &file) { readLine(file, line); n = 0; - // TODO: parse R G B uint8_t r = parseDec(line, n); skipWhitespace(line, n); if (n == line.length()) {