A quality is an attribute or a property characteristic of an object. In contemporary philosophy the idea of qualities, and especially how to distinguish certain kinds of qualities from one another, remains controversial.
Aristotle analyzed qualities in his logical work, the Categories. To him, qualities are hylomorphically–formal attributes, such as "white" or "grammatical". Categories of state, such as "shod" and "armed" are also non–essential qualities (katà symbebekós). Aristotle observed: "one and the selfsame substance, while retaining its identity, is yet capable of admitting contrary qualities. The same individual person is at one time white, at another black, at one time warm, at another cold, at one time good, at another bad. This capacity is found nowhere else... it is the peculiar mark of substance that it should be capable of admitting contrary qualities; for it is by itself changing that it does so". Aristotle described four types of qualitative opposites: correlatives, contraries, privatives and positives.
John Locke presented a distinction between primary and secondary qualities in An Essay Concerning Human Understanding. For Locke, a quality is an idea of a sensation or a perception. Locke further asserts that qualities can be divided in two kinds: primary and secondary qualities. Primary qualities are intrinsic to an object—a thing or a person—whereas secondary qualities are dependent on the interpretation of the subjective mode and the context of appearance. For example, a shadow is a secondary quality. It requires a certain lighting to be applied to an object. For another example, consider the mass of an object. Weight is a secondary quality since, as a measurement of gravitational force, it varies depending on the distance to, and mass of, very massive objects like the Earth, as described by Newton's law. It could be thought that mass is intrinsic to an object, and thus a primary quality. In the context of relativity, the idea of mass quantifying an amount of matter requires caution. The relativistic mass varies for variously traveling observers; then there is the idea of rest mass or invariant mass (the magnitude of the energy-momentum 4-vector), basically a system's relativistic mass in its own rest frame of reference. (Note, however, that Aristotle drew a distinction between qualification and quantification; a thing's quality can vary in degree). Only an isolated system's invariant mass in relativity is the same as observed in variously traveling observers' rest frames, and conserved in reactions; moreover, a system's heat, including the energy of its massless particles such as photons, contributes to the system's invariant mass (indeed, otherwise even an isolated system's invariant mass would not be conserved in reactions); even a cloud of photons traveling in different directions has, as a whole, a rest frame and a rest energy equivalent to invariant mass. Thus, to treat rest mass (and by that stroke, rest energy) as an intrinsic quality distinctive of physical matter raises the question of what is to count as physical matter. Little of the invariant mass of a hadron (for example a proton or a neutron) consists in the invariant masses of its component quarks (in a proton, around 1%) apart from their gluon particle fields; most of it consists in the quantum chromodynamics binding energy of the (massless) gluons (see Quark#Mass).