Skip to content

Repository files navigation

Download

A simple Encoder/Decoder for Color Set files from Clip Studio Paint (.cls)

Examples

Saving

ClsColorSetset=new(newList<ClsColor>(){newClsColor(123,234,243,255),newClsColor(123,234,243,0),},"Color Set Name");set.Save("TwoColors.cls");

Loading

ClsColorSetset=ClsColorSet.Load(@"LightGrayish.cls");

.cls file format

I reverse-engineered the format myself, so this is not a complete spec. I don't know if the values are signed or unsigned, but it shouldn't matter for any reasonable color set. I assume unsigned in the code.

CSP seems to treat any colors with non-zero alpha as fully opaque, so the only alpha values you should use are 0 and 255.

Types

typedescription
int32number, 32 bit
int16number, 16 bit
rgba4 bytes with RGBA values
asciitext encoded as ASCII, 1 byte/character (without string terminators or anything else)
utf8text encoded as UTF-8, 1-4 bytes/character

File sections

Signature

typevalue
asciiSLCC
int16256

I put 256 as a part of the signature, but it could also be an indication of the version

Header

typevalue
int32length of the rest of the header in bytes
int16length of the following string in bytes
asciiname of the color set
int320
int16length of the following string in bytes
utf8name of the color set

CSP ignored the ASCII name.

The zero in the middle seems to be useless, changing it to any other value doesn't prevent CSP from loading the file.

Colors

typevalue
int324
int32number of colors
int32length of the next section in bytes

"4" might be the number of channels, values above 4 prevent CSP from loading the file. 0-3 are treated the same as 4.

The next section contains all colors written one after another in the following format:

typevalue
int32length of the rest of this block in bytes, always 8
rgbathe color
int320

The 0 in the end doesn't do anything as far as I can tell, but it has to be a zero. Curiously, you can omit the 0 and set the length to 4, and the file loads just fine. Increasing the length and appending more zeros also doesn't break the file. I don't recommend doing any of that though, as CSP itself outputs colors with length 8 and a trailing 0.

About

A simple Encoder/Decoder for Color Set files from Clip Studio Paint (.cls)

Topics

Resources

Stars

10 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages