From 3ca75bec8ebb83a857e29e245b064c46b8a4a218 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 27 May 2024 13:10:18 +0200 Subject: [PATCH] parsecolortable --- config.cpp | 4 +--- util.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/config.cpp b/config.cpp index a942d42a..d9cd87de 100644 --- a/config.cpp +++ b/config.cpp @@ -770,9 +770,7 @@ EX shared_ptr param_colortable(colortable& val, const paramete u->custom_value = [] () { return -1; }; u->custom_affect = [&val] (void *v) { return &val == v; }; u->custom_load = [&val] (const string& s) { - auto seq = split_string(s, ','); - val.resize(isize(seq)); - for(int i=0; icustom_save = [&val] { bool first = true; diff --git a/util.cpp b/util.cpp index 13a8e6a9..9b1f9b71 100644 --- a/util.cpp +++ b/util.cpp @@ -615,6 +615,17 @@ EX color_t parsecolor(const string& s, bool has_alpha) { return col; } +EX colortable parsecolortable(const string& s) { + colortable tab; + tab.clear(); + exp_parser ep; + ep.s = s; + tab.push_back(ep.parsecolor() >> 8); + while(ep.eat(",")) + tab.push_back(ep.parsecolor() >> 8); + return tab; + } + EX trans23 parsematrix23(const string& s) { trans23 t; #if MAXMDIM == 3