Sublime Forum

Set a color to every struct in c

#1

Hello, how can a set a color to every struct i use in c.
For example, every type is already blue, and every struct will be a different shade of blue, a darker one, or maybe a purple different from the purple of the numbers.

In the following example the type NinjaType would have a color.
typedef struct
{
uint16_t Number;
uint16_t Age;
uint8_t Gender;
uint8_t PurchaseMade;
}NinjaType;
typedef struct nodeNinja
{
NinjaType Ninja;
struct nodeNinja *Prev;
struct nodeNinja *Next;
}NodeNinja;

typedef struct
{
NodeNinja *First;
NodeNinja *Last;
}ListNinja;

0 Likes

#2

That would require a static analysis to your code. I dont think ST’s syntax does that.

0 Likes

#3

Or at least it would require a compiler to run over your code and provide callbacks to the ST highlighter, which is impossible with the current ST API.

0 Likes

#4

https://packagecontrol.io/packages/Colorcoder

0 Likes

#5

@kingkeith thanks for the mention.

please note the plugin is broken atm as per api change in sublime, you have to revert to 3147
the issue is known to sublime devs and i am hope few builds later i will be able to get colorcoder working again

0 Likes