Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What’s the difference between the LESS color functions lighten and tint?

Tags:

colors

less

Both lighten and tint seem to make a color lighter (closer to white). Why does LESS define both?

From the LESS documentation:

lighten(@color, 10%); // return a color 10% points *lighter*

tint(@color, 10%); // return a color mixed 10% with white

How one site defines tint (note the use of the word “lighter”):

If you tinted a color, you've been adding white to the original color.

A tint is lighter than the original color.

like image 590
jaredjacobs Avatar asked Oct 18 '13 17:10

jaredjacobs


People also ask

What is the function of tint?

It protects car interiors from cracking and warping to keep your car looking newer longer. Window tinting also blocks windshield glare to decrease eye fatigue from direct sun and bright nighttime headlights.

What is a tint in art?

Tint refers to any hue or mixture of pure colors to which white is added. Pastel colors are generally tinted colors. Tinted color remains the same color, but it is paler than the original.

What is the difference between tints shades and tones?

Tone: A pure pigment with just grey added. Tint: A pure pigment with just white added. Shade: a pure pigment with just black added.

How would you create a tint of a color?

Tints and shades are art terminology for the lighter and darker variations of a single color. They're created by adding white (for tints) or black (for shades) to a base color. Using them as part of a color palette has a number of advantages.


2 Answers

From this thread that was asking for tint comes this comment:

Tint/shade is not the same thing as lighten/darken. Tint and shade are effectively mixing with white and black respectively, whereas lighten/darken are manuipulating the luminance channel independently of hue and saturation. The former can produce hue shifts, whereas the latter does not. That's not to say it's not useful, just that it's not the same thing. Mathematically it's that linear changes in RGB space do not necessarily correspond with linear changes in HSL space, though in practice they will produce fairly similar results.

There is a slight difference in the math behind the two.

like image 128
ScottS Avatar answered Sep 30 '22 18:09

ScottS


Both functions produce a 'lighter' color somehow but use different methods to do so.

Take a look at the source to see how they work:

tint: function(color, amount) {
    return this.mix(this.rgb(255,255,255), color, amount);
},
lighten: function (color, amount) {
    var hsl = color.toHSL();

    hsl.l += amount.value / 100;
    hsl.l = clamp(hsl.l);
    return hsla(hsl);
},

So tint is mixing in white (as stated by the documentation) and lighten increases the lightness of in the HSL color model.

like image 37
kapex Avatar answered Sep 30 '22 18:09

kapex