mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-01 18:42:56 +01:00
Colors: support JSON config
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "fastfetch.h"
|
||||
#include "common/printing.h"
|
||||
#include "util/textModifier.h"
|
||||
#include "modules/colors/colors.h"
|
||||
|
||||
void ffPrintColors(FFinstance* instance)
|
||||
{
|
||||
@@ -28,3 +29,10 @@ void ffPrintColors(FFinstance* instance)
|
||||
|
||||
puts(FASTFETCH_TEXT_MODIFIER_RESET);
|
||||
}
|
||||
|
||||
#ifdef FF_HAVE_JSONC
|
||||
void ffParseColorsJsonObject(FFinstance* instance, FF_MAYBE_UNUSED json_object* module)
|
||||
{
|
||||
return ffPrintColors(instance);
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
|
||||
#define FF_COLORS_MODULE_NAME "Colors"
|
||||
|
||||
void ffPrintColors(FFinstance* instance);
|
||||
|
||||
#ifdef FF_HAVE_JSONC
|
||||
#include "common/jsonconfig.h"
|
||||
void ffParseColorsJsonObject(FFinstance* instance, json_object* module);
|
||||
#endif
|
||||
@@ -40,6 +40,7 @@ static bool parseModuleJsonObject(FFinstance* instance, const char* type, json_o
|
||||
case 'C': {
|
||||
return
|
||||
tryModule(instance, type, module, FF_COMMAND_MODULE_NAME, ffParseCommandJsonObject) ||
|
||||
tryModule(instance, type, module, FF_COLORS_MODULE_NAME, ffParseColorsJsonObject) ||
|
||||
false;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "modules/board/board.h"
|
||||
#include "modules/break/break.h"
|
||||
#include "modules/command/command.h"
|
||||
#include "modules/colors/colors.h"
|
||||
#include "modules/datetime/datetime.h"
|
||||
#include "modules/display/display.h"
|
||||
#include "modules/host/host.h"
|
||||
|
||||
Reference in New Issue
Block a user