From e91d011c8c60907811c124c4983c85c88e2e182e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 12 Sep 2023 20:23:58 +0800 Subject: [PATCH] Theme: support JSON format --- src/modules/theme/theme.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/modules/theme/theme.c b/src/modules/theme/theme.c index 268d7bf50..08b345fe7 100644 --- a/src/modules/theme/theme.c +++ b/src/modules/theme/theme.c @@ -67,3 +67,17 @@ void ffParseThemeJsonObject(FFThemeOptions* options, yyjson_val* module) ffPrintError(FF_THEME_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key); } } + +void ffGenerateThemeJson(FF_MAYBE_UNUSED FFThemeOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) +{ + FF_STRBUF_AUTO_DESTROY theme = ffStrbufCreate(); + const char* error = ffDetectTheme(&theme); + + if(error) + { + yyjson_mut_obj_add_str(doc, module, "error", error); + return; + } + + yyjson_mut_obj_add_strbuf(doc, module, "result", &theme); +}