Colors in Raylib

Salih Dincer salihdb at hotmail.com
Tue Mar 1 15:47:17 UTC 2022


On Monday, 28 February 2022 at 12:18:37 UTC, Mike Parker wrote:
> Then you can mixin aliases for any named enum members you'd 
> like:
>
> ```d
> mixin(expandEnum!Colors);
> ```

Meanwhile it's very skillful :)

It is possible to change all the color palette with a second 
parameter:
```d
import std.stdio;

enum Colors { BLACK, GRAY, WHITE }
enum Color {  WHITE, GRAY, BLACK }

mixin(expandEnum!(Colors, "Color"));

void main() {
   with(Colors) writefln("%d%d", GRAY, WHITE);// 12

   writefln("%d%d", GRAY, WHITE);  // 10
}
```



More information about the Digitalmars-d-learn mailing list