In the Janovsky reaction, an aldehyde or ketone which contains at least one $\alpha$ methylen group reacts with 1,3-dinitrobenzene and a strong base (like $\ce{NaOH}$) to form a colored Meisenheimer complex (source). The enolate acts as a nucleophile which attacks the aromatic ring that is electron-deficient due to the presence of multiple electron-withdrawing nitro substituents.
image source
As the reaction mechanism relies on the formation of an enolate, non-enolizable aldehydes like, for example, formaldehyde or benzaldehyde, do not resond to this test. Likewise, non-enolizable ketones (like benzophenone) cannot react in this way. The color of the formed complex varies with the number of nitro substituents of the benzene ring, with 1,3-dinitro compounds giving blue complexes, while trinitro compounds yield a red coloration (source).
This paper contains a list of the colors produced by various aromatic nitro compounds when reacted with acetone and $\ce{NaOH}$. It is reported that most mononitro compounds do not produce any color at all, with the exeption of 3-nitro-4-aminotoluene (orange) and 3-nitro-4-aminotoluene benzoate (orange-red). Some examples for the colors obtained from the reaction of dinitro compounds are: m-dinitrobenzene (purplish blue), 2,4-dinitrotoluene (blue), 2,4-dinitrophenol (yellow-orange), 2,4-dinitroresorcinol (brownish-green) and p-dinitrobenzene (green-yellow).