A machine for preparing and dispensing a beverage, such as tea, coffee, hot chocolate, cold chocolate, milk, soup or baby food, such machine comprising: - an extraction unit for extracting a beverage ingredient capsule to form said beverage, e.g. a unit having a first part and a second part that are relatively movable between a distant position for inserting and/or removing a capsule and a close position, such as a close position in which the first and second parts (11,12) delimit an extraction chamber, for securing and extracting such capsule, optionally at least one of said parts (11,12) has a capsule opener e.g. one or more capsule piercers and/or at least one of said parts (11,12) has an opening for an inflow of liquid to be mixed with an ingredient contained in such capsule; - a control unit for controlling the extraction unit to extract such capsule, such as a control unit powered by the mains e.g. via an electric cord; - an outlet for dispensing said beverage formed by extracting such capsule to a user-receptacle, such as a cup or a mug, located in a receptacle placing area, such as on a receptacle support (5,6) e.g. an external placement support on which such machine is located or a machine support e.g. a movable or removable machine support, to collect said beverage, - a colour recognition module for recognizing a colour of a capsule inserted in said machine, the colour recognition module comprising a colour sensor for sensing a sample colour of at least part of the surface of such capsule; characterized in that the colour recognition module is configured to compare said sample colour to at least one reference colour by: - computing a colour distance between a sample colour vector of said sample colour and a reference colour vector of said at least one reference colour, - computing a chromaticity distance between a sample chromaticity vector of said sample colour and a reference chromaticity vector of said at least one reference colour, - computing a score with said colour distance and said chromaticity distance to determine a match between said colour sample and said at least one reference colour. - an extraction unit for extracting a beverage ingredient capsule to form said beverage, e.g. a unit having a first part and a second part that are relatively movable between a distant position for inserting and/or removing a capsule and a close position, such as a close position in which the first and second parts (11,12) delimit an extraction chamber, for securing and extracting such capsule, optionally at least one of said parts (11,12) has a capsule opener e.g. one or more capsule piercers and/or at least one of said parts (11,12) has an opening for an inflow of liquid to be mixed with an ingredient contained in such capsule; - a control unit for controlling the extraction unit to extract such capsule, such as a control unit powered by the mains e.g. via an electric cord; - an outlet for dispensing said beverage formed by extracting such capsule to a user-receptacle, such as a cup or a mug, located in a receptacle placing area, such as on a receptacle support (5,6) e.g. an external placement support on which such machine is located or a machine support e.g. a movable or removable machine support, to collect said beverage, - a colour recognition module for recognizing a colour of a capsule inserted in said machine, the colour recognition module comprising a colour sensor for sensing a sample colour of at least part of the surface of such capsule; - computing a colour distance between a sample colour vector of said sample colour and a reference colour vector of said at least one reference colour, - computing a chromaticity distance between a sample chromaticity vector of said sample colour and a reference chromaticity vector of said at least one reference colour, - computing a score with said colour distance and said chromaticity distance to determine a match between said colour sample and said at least one reference colour.