Page 1 of 1

Color filter API

Posted: Thu Mar 10, 2016 7:36 am
by FalcoGer
Coloring based on who occupies a vehicle has been in the game since multiplayer came along, perhaps even before then. It uses a color filter on specific parts of a sprite, which in turn allows less memory and hard drive storage space to store different sprites which are basically the same except for their color, as well as allowing a wide array of colors, specifically 256³ = 2^24 without having to have that many sprites.
Furthermore there have been mods for colored flooring, colored trains, colored train tracks, colored cargo wagons and such. Especially with the train related ones having a huge impact on the memory used as trains have different sprites for all the different angles and they are relatively large.

It wouldn't be to far fetched to allow mod makers to just put a color filter over their sprite or replacing a specific color (such as pure purple or pure green as it is commonly used for such applications) in such sprites with a defined color either by script or by user input (into those scripts).
This would require that an additional variable is saved for any entity that can have such a filter applied to it, containing that color. For instance, a user could set the color to red, lay down red concrete floor, then change it to blue and lay down the very same concrete with the same properties except for it's color, instead of having a different type for each of a limited number of different colors.

It would be nice to have such features in vanilla for things like railways, trains and flooring with an UI to change those things on the fly for any containers/vehicles.

Re: Color filter API

Posted: Thu Mar 10, 2016 11:35 am
by ssilk
Just a note: They added colors for the lamps in 0.13. See FFF about new combinators.

Re: Color filter API

Posted: Fri Mar 11, 2016 1:58 am
by FalcoGer
That's not what I meant. I mean stuff like built in support for color-coding belts, chests, locomotives/wagons, flooring, and many more. Either with a brush like tool, or by defining what color you wish the item to be before placing it, or by some kind of UI interface with the item itself.