From e856443c99d5175b3de6370590142a8d03054bb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Fri, 23 Oct 2020 19:26:35 +0200 Subject: [PATCH] CLOG: Add getter to know if output supports coloring --- intern/clog/CLG_log.h | 2 ++ intern/clog/clog.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/intern/clog/CLG_log.h b/intern/clog/CLG_log.h index a2841c5c8b3..3e51e228bac 100644 --- a/intern/clog/CLG_log.h +++ b/intern/clog/CLG_log.h @@ -150,6 +150,8 @@ void CLG_level_set(int level); void CLG_logref_init(CLG_LogRef *clg_ref); +int CLG_color_support_get(CLG_LogRef *clg_ref); + /** Declare outside function, declare as extern in header. */ #define CLG_LOGREF_DECLARE_GLOBAL(var, id) \ static CLG_LogRef _static_##var = {id}; \ diff --git a/intern/clog/clog.c b/intern/clog/clog.c index 37c8393f532..2bc3985c71f 100644 --- a/intern/clog/clog.c +++ b/intern/clog/clog.c @@ -755,4 +755,12 @@ void CLG_logref_init(CLG_LogRef *clg_ref) #endif } +int CLG_color_support_get(CLG_LogRef *clg_ref) +{ + if (clg_ref->type == NULL) { + CLG_logref_init(clg_ref); + } + return clg_ref->type->ctx->use_color; +} + /** \} */