Gravit Designer Palette

Started by ajulien, September 11, 2018, 10:06:28 PM

Previous topic - Next topic

ajulien

I use Gravit Designer (https://gravit.io/). It's a very cool (and free) vector design software.

Its palette format is a JSON file which later gets gzipped. I just made a template for Cyotek Palette Editor to generate this JSON format:

{%- for rgb in rgbcolors -%}{%- assign total = rgb.Index -%}{%- endfor -%}
{"@":"swatches","$":[{%- for rgb in rgbcolors -%}
  {"@":"swatch","_pt":"C#[{{rgb.R}},{{rgb.G}},{{rgb.B}}]"}{%- if rgb.Index < total -%},{%- endif -%}
{%- endfor -%}]}


Feel free to use this code if you want to. If Palette Editor had the option to generate the already gzipped file (with a .gvswatch extension) and UTF-8 encoded, it would be great.


Richard Moss

#1
Hello,

Welcome to the forums and thank you for posting that sample template. Pretty cool, and great to know that some users are finding it useful. About the only thing I'd suggest is you don't need the first line where you manually calculate the number of colours - there's a variable named count which has that information.

I hadn't heard of Gravit before (and I have a habit of being irrationally against Electron applications), but one of my goals with the Palette Editor is to support as many formats natively as possible so I will log an enhancement to add this format to the product.

Once again, many thanks for the template data!

Regards;
Richard Moss
Read "Before You Post" before posting (https://forums.cyotek.com/cyotek-webcopy/before-you-post/). Do not send me private messages. Do not expect instant replies.

All responses are hand crafted. No AI involved. Possibly no I either.

ajulien

I had forgotten to reply to you. I tend to prefer native over Electron, certainly. But things like Gravit and VSCode have eased my concerns about performance (even on my 2012 Macbook Air). Plus, it's a decent way to go cross-platform between Mac and Windows (and Linux, for that matter). Program size still climbs, and I know this approach is non-optimal. But I'm learning to ignore my concerns and enjoy the ride ;)

My modified code, according to your comment:

{"@":"swatches","$":[{%- for rgb in rgbcolors -%}
  {"@":"swatch","_pt":"C#[{{rgb.R}},{{rgb.G}},{{rgb.B}}]"}{%- if rgb.Index < count -%},{%- endif -%}
{%- endfor -%}]}


One question: given that there is no "native" palette format (not that we really need one), which would you consider is the most complete format to store out palettes if we work with different formats across different tools? I'm settling with GIMP for now.

Richard Moss

Hello,

Thanks for the follow up! As far as palette formats go, I'd probably go with Gimp over more powerful formats, simply because it is text based and easy to read or write, even by hand and therefore is likely much more likely to be supported by third party tools. While formats like ACO do support different colour spaces and higher precision, the fact that it is binary means it's not particularly easy to use. If I didn't need name support then I might even side with the even old JASC format, again text based and easy to write.

Regards;
Richard Moss

PS: I did add a native Gravit serialiser to the palette editor an update or two back
Read "Before You Post" before posting (https://forums.cyotek.com/cyotek-webcopy/before-you-post/). Do not send me private messages. Do not expect instant replies.

All responses are hand crafted. No AI involved. Possibly no I either.