Custom color for any object

@Hibchibbler @kittykatattack @Arcan Please clarify exactly what you are looking for. For most people, being able to color objects by type suffices since there’s usually not going to be too many different things within the same project that need to be told apart in the level editor, by color at least. In case you have more things to tell apart, it’s also always an option to create a tileset with as many images or plain colored rectangles as you want and place them as tile objects.

In addition, Tiled gained support for projects with the release of Tiled 1.4. This means that you can now use a different objecttypes.xml for each project and can quickly switch between those, so you no longer build up a huge list of types like @Rabbit mentioned and the types are easy to share with teammates (just need to check in the .tiled-project and the objecttypes.xml in version control, no need for manual setup for teammates).

That said, there is still the occasional use-case for per-object colors, but only @AxiomVerge has made it clear that this is what he needs. I’m thinking about implementing it, but I’m not exactly sure about what its behavior should be:

  • I’m somewhat afraid that once added, people will start using it instead of setting the color on the type or the object layer, even if those latter features would in the end be more suitable.

  • I also wonder whether the color should be used as a tint color in case of tile objects, and if so, whether it should still also apply to shapes or labels at all since it could be undesirable that tinting an object changes the color of its label.

Right now I’m more leaning towards adding a tint color only. This could be more generally useful, and also allows plain colored rectangles by using a white tile. Any feedback is welcome!

1 Like

It’s been so long since I wrote that I can’t recall the actual use case. Maybe light objects? It seems like tint would be perfect for that.

1 Like

Hello! I found this thread just now because I have a use case :grinning_face_with_smiling_eyes:

I’m building a single screen run&gun platformer with several screens per map. I’d like to drop a couple of shapes in each room to tell the game which ammo and enemy types to spawn there. If I were to use the Types system then it seems AmmoTypeMarker and EnemyTypeMarker would be types, with a template for each specific ammo or enemy type, and instances of those templates scattered around the map.

It sure would be helpful if the markers could have unique colours for the specific enemy or ammo they refer to, so I could see at a glance how these things are distributed around the world.

Does this make sense?

@Farbs Sure, if you can’t use icon tiles for visualizing your ammo and enemy markers, for example because you also need them to mark areas of different sizes, then using different colors could be helpful.

Since you’re already setting up templates for each specific type, you could use a colored white rectangle tile if I would add a per-object custom tint color. So right now I would still consider adding a tint color only, as opposed to a color that effected the shapes and labels as well. It could anyway be useful to see the type color on the label in addition to the specific type as the colored rectangle.

1 Like

Oh wow, thanks for the quick reply.

This is my first Tiled project - looking into icon tiles now :slight_smile:

So, I set Object Layer 1 colour red, and I set an object(CFVH)'s colour different.
But it looks red.

You mentioned that “custom colour doesn’t display in Tiled.”
So, where can I check or how can I colour object in the programme?

Any help will be appreciated. Cheers.

When you parse the object in your programme, it’s up to you to look at the custom properties and do what you will with them.

The way to access the custom properties depends on whatever you’re using to parse TMX files. If you’ve written your own parser, then check the TMX file format (or JSON, if you’re using that) pages in the Tiled docs to see how custom properties are stored. If you’re using an existing parser, check its documentation to see how it stores custom properties.

1 Like

Thanks for your help. I will look into this issue to my co-worker