mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
33 lines
1.1 KiB
C
33 lines
1.1 KiB
C
#pragma once
|
|
|
|
#include "util/FFstrbuf.h"
|
|
#include "common/parsing.h"
|
|
|
|
enum
|
|
{
|
|
FF_PERCENTAGE_TYPE_NUM_BIT = 1 << 0,
|
|
FF_PERCENTAGE_TYPE_BAR_BIT = 1 << 1,
|
|
FF_PERCENTAGE_TYPE_HIDE_OTHERS_BIT = 1 << 2,
|
|
FF_PERCENTAGE_TYPE_NUM_COLOR_BIT = 1 << 3,
|
|
};
|
|
|
|
// if (green <= yellow)
|
|
// [0, green]: print green
|
|
// (green, yellow]: print yellow
|
|
// (yellow, 100]: print red
|
|
//
|
|
// if (green > yellow)
|
|
// [green, 100]: print green
|
|
// [yellow, green): print yellow
|
|
// [0, yellow): print red
|
|
|
|
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig config);
|
|
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFColorRangeConfig config, bool parentheses);
|
|
|
|
typedef struct yyjson_val yyjson_val;
|
|
typedef struct yyjson_mut_doc yyjson_mut_doc;
|
|
typedef struct yyjson_mut_val yyjson_mut_val;
|
|
bool ffPercentParseCommandOptions(const char* key, const char* subkey, const char* value, FFColorRangeConfig* config);
|
|
bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFColorRangeConfig* config);
|
|
void ffPercentGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FFColorRangeConfig defaultConfig, FFColorRangeConfig config);
|