Ants can usually learn patterns, colors and sequences. Species that do not use pheromone trails rely heavily on landmarks for navigation, that is they perform learning walks during which they look backward and circle around the nest to learn what the landscape looks like so they can easily return to the nest after foraging.
Harris, R. A., de Ibarra, N. H., Graham, P., & Collett, T. S. (2005).
Ant navigation: Priming of visual route memories. Nature, 438(7066),
302.
Chameron, S., Schatz, B., Pastergue-Ruiz, I., Beugnon, G., & Collett,
T. S. (1998). The learning of a sequence of visual patterns by the ant
Cataglyphis cursor. Proceedings of the Royal Society of London. Series
B: Biological Sciences, 265(1412), 2309-2313.
This is usually the case in large ants that tend to rely less on pheromones and more on visual cues to navigate. Studies commonly focus on species such as Gigantiops destructor or Myrmecia spp.
Macquart, D., Latil, G., & Beugnon, G. (2008). Sensorimotor sequence
learning in the ant Gigantiops destructor. Animal Behaviour, 75(5),
1693-1701.
Jayatilaka, P., Murray, T., Narendra, A., & Zeil, J. (2018). The
choreography of learning walks in the Australian jack jumper ant
Myrmecia croslandi. Journal of Experimental Biology, 221(20),
jeb185306.
The type of learning you are referring to may be termed habituation, and habituation has been shown in ants, for example some ants tend to be less aggressive to other colonies that they encounter frequently.
Langen, T. A., Tripet, F., & Nonacs, P. (2000). The red and the black:
habituation and the dear-enemy phenomenon in two desert Pheidole ants.
Behavioral Ecology and Sociobiology, 48(4), 285-292.