Skip to content

Commit 5338583

Browse files
committed
Logo (Chafa): accept enum strings instead of numbers
1 parent 6c49288 commit 5338583

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

src/options/logo.c

+28-3
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,36 @@ bool ffOptionsParseLogoCommandLine(FFOptionsLogo* options, const char* key, cons
189189
else if(strcasecmp(subKey, "symbols") == 0)
190190
ffOptionParseString(key, value, &options->chafaSymbols);
191191
else if(strcasecmp(subKey, "canvas-mode") == 0)
192-
options->chafaCanvasMode = ffOptionParseUInt32(key, value);
192+
{
193+
options->chafaCanvasMode = (uint32_t) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
194+
{ "TRUECOLOR", 0 },
195+
{ "INDEXED_256", 1 },
196+
{ "INDEXED_240", 2 },
197+
{ "INDEXED_16", 3 },
198+
{ "FGBG_BGFG", 4 },
199+
{ "FGBG", 5 },
200+
{ "INDEXED_8", 6 },
201+
{ "INDEXED_16_8", 7 },
202+
{},
203+
});
204+
}
193205
else if(strcasecmp(subKey, "color-space") == 0)
194-
options->chafaColorSpace = ffOptionParseUInt32(key, value);
206+
{
207+
options->chafaColorSpace = (uint32_t) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
208+
{ "RGB", 0 },
209+
{ "DIN99D", 1 },
210+
{},
211+
});
212+
}
195213
else if(strcasecmp(subKey, "dither-mode") == 0)
196-
options->chafaDitherMode = ffOptionParseUInt32(key, value);
214+
{
215+
options->chafaDitherMode = (uint32_t) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
216+
{ "NONE", 0 },
217+
{ "ORDERED", 1 },
218+
{ "DIFFUSION", 2 },
219+
{},
220+
});
221+
}
197222
else
198223
return false;
199224
}

0 commit comments

Comments
 (0)