Рубрики

paint

Formulas for obtaining a purple color with paint

What do you call friends who like maths?Alge-bros.


Let’s do Color and Math

At Shazam, we introduced a brand new, visually more appealing way to accommodate ads in the app. This new ad format overtakes the whole screen with a smooth animation. The experience not only looks better, but also feels less interruptive and way more engaging.

Designers tend to think of advertising as a necessary evil. Ads are external content that need real estate on our pixel-perfect, unique design. The UI has colors, the ads have colors. It’s not easy to apply a dozen of them to our interfaces and make them work together. It takes a process of studying color theory and playing around with rules to have confidence and control over what looks and functions well on the screen.

In this case, the ads need to stand out without interrupting the core experience. What we want to achieve here is a tool for third party clients that excludes certain colors from the acceptable mix. A tool that works with a single HEX code as input and tells if a particular color matches our defined criteria. We would like to filter out too light colors that damage usability and washed-out colors that make the experience less desirable. In order to do this, we will need to squeeze out these values from a single HEX code.

Color Wheel

Colors are the way our brain, through our eyes, interprets electromagnetic radiation of a wavelength within the visible spectrum. Yum. Visible light lies between 400 and 700 nanometers. Radiation with a wavelength of over 750 nm is called infra-red and radiation under 350 nm is ultra-violet.

A color wheel is really just the spectrum twisted around so that the violet and red ends are joined. This wheel is particularly useful for showing how the colors relate to each other and how you can create new ones by mixing two or more of them.

RGB refers to a system for representing the colors to be used on a computer display. RGB is a combination of Red, Green and Blue. These colors can be combined in various proportions to obtain any color in the visible spectrum.

Each level is measured by the range of decimal numbers from 0 to 255 (256 levels for each color). For example, if a color has zero Blue, it will be a mixture of Red and Green. This means we can generate 256 x 256 x 256 = 16.777.216 different colors with this model.

It is important to note that different devices detect or reproduce a given RGB value differently. An RGB color format is represented by its Red, Green and Blue values, no surprises here:

RGB = (54, 155, 229) | Note: 54 = Red, 155 = Green and 229 = Blue

HEX is a widely known and used format for defining colors on the web. The name comes from the phrase hexadecimal, which is used by humans to shorten binary to a more easily understandable form. Each of the HEX numbers use numbers and letters to represent values between 0–16. Numbers are used for the range 0–9 and letters A, B, C, D, E, F for the range 10–16.

The code itself is a HEX triplet, which represents 3 separate values that specify the levels of the component colors. These 3 values are called bytes and make up a six-digit hexadecimal number used in HTML, CSS, SVG and other computing applications.

The first value pair refers to Red, the second to Green and the third to Blue. One byte represents a number in the range 0 to 255 in decimal notation. In hexadecimal notation, the scale goes from the lowest (00) to the highest (FF) intensity of each color. HEX codes start with a hashtag sign and are followed by the mentioned format:

HEX = #A3D645 | Note: A3 = Red, D6 = Green and 45 = Blue

We will transform an RGB code into a HEX code. What this truly means is that we need to convert decimal numbers from given RGB values to hexadecimals. In order to do this, we will divide our values by 16.

R / 16 = X1 + Y1G / 16 = X2 + Y2B / 16 = X3 + Y3

In the above mentioned formula, X is called the quotient and Y is the remainder. These two numbers are used to represent the HEX value pair for each particular color, Red, Green and Blue. A HEX code can be calculated from these values as #X1Y1X2Y2X3Y3 where X1Y1 are the values for Red, X2Y2 for Green and X3Y3 for Blue. Let’s have a look at this with the following RGB values: (54, 155, 229)

R = 54 / 16 = 3 + 6G = 155 / 16 = 9 + 11 | Note: 11 = B in hexadecimalB = 229 / 16 = 14 + 5 | Note: 14 = E in hexadecimal

Voila, our code (54, 155, 229) in RGB becomes #369BE5 in HEX

We can also make the conversion work in reverse. In case we would like to transform HEX codes into RGB codes, all we have to do is to multiply the quotients by 16 and add the remainders.

R = X1 x 16 + Y1G = X2 x 16 + Y2B = X3 x 16 + Y3

We already know the quotients (X1, X2, X3) and remainders (Y1, Y2, Y3). A HEX code consists of these values as #X1Y1X2Y2X3Y3. Let’s try converting back our HEX code: #369BE5

R = 3 x 16 + 6 = 54G = 9 x 16 + 11 = 155 | Note: 11 = B in hexadecimalB = 14 x 16 + 5 = 229 | Note: 14 = E in hexadecimal

There we go, our code #369BE5 in HEX becomes (54, 155, 229) in RGB

What do you call friends who like maths?

Alge-bros.

Keep smiling. We’re off to continue our journey to the world of HSL.

HSL is a common cylindrical coordinate representation of points in an RGB color model. HSL stands for Hue, Saturation and Luminosity. Hue refers to the colour family of the specific color we’re looking at. It indicates the actual dominant color on the RGB color wheel. Luminosity refers to how much white or black is mixed in the color. Saturation indicates the amount of grey in the same color.


Luminosity

Luminosity (also called brightness, lightness or luminance) stands for the intensity of the energy output of a visible light source. It basically tells how light a color is and is measured on the following scale: L = [0, 1]

It’s time to introduce the maximum and minimum values among our RGB numbers. Max(RGB) stands for the highest and Min(RGB) for the lowest value across Red, Green and Blue. In order to make our further calculations work, we need to convert the RGB values to the range 0–1. This can be done by dividing them by 255. Let’s take our existing RGB values for example: (54, 155, 229)

R = 54 / 255 = 0,212G = 155 / 255 = 0,608B = 229 / 255 = 0,898

The Luminosity of the RGB color (54, 155, 229) can be calculated from the Max(RGB) and Min(RGB) values as follows:

L = (1 / 2) x (Max(RGB) + Min(RGB))

From our R, G and B numbers, R seems to be the smallest and B the largest. We now know the Max(RGB) = B = 0,898 and Min(RGB) = R = 0,212 values.

L = (1 / 2) x ( 0,898 + 0,212 ) = 0,555 ~ 56%


Perfect Purple Paint I

Jessica gets her favorite shade of purple paint by mixing 2 cups of blue paint with 3 cups of red paint. How many cups of blue and red paint does Jessica need to make 20 cups of her favorite purple paint?

The goal of this task is to provide a good context for engaging students in reasoning about ratios. There are many approaches available, ranging from concrete (tape diagram) to more abstract (setting up an equation). The teacher may wish to have physical manipulatives on hand so that students can simulate mixing the paint: for example, blue and red interlocking cubes (or tiles) could be used to model the cups of blue and red paint. Colored pencils (red and blue) should also be made available, either for making strip diagrams or for students to draw their own model of the mixed paint.Â

The teacher may wish to use this task to demonstrate or introduce some of the different representations of ratios (ratio table, double number line, graphing points in the coordinate plane). The numbers are small so that the focus can be on the methods and not performing arithmetic. It is worth noting, in this direction, that the ratio table and the double number line present essentially the same information laid out in two different ways. The main difference is that the double number line provides an additional geometric representation of the sizes of the different quantities. Because of this, the double number line may be helpful for students as they move toward graphing points (as shown in the fourth solution).

This task is appropriate for a variety of formative assessments. Early in a unit on ratios, it can provide ideas the teacher can build upon introducing the different methods for representing ratios. At this point, students would likely draw pictures which could form the basis of a tape diagram representations. Students might also use the idea of multiplication as scaling: there are 5 cups of purple paint in each batch so 4 batches of purple paint will be 20 cups. The idea of multiplication of scaling is the foundation of thinking about ratios and this will provide an opportunity to assess student knowledge in this direction.

The task can also be used in the middle of a unit. At this point, the teacher may want to suggest multiple solutions and could even suggest the methods (tape diagrams, double number lines, ratio tables) if desired. This will provide insight into which methods the students are most or least comfortable with and so could help the teacher decide where to put extra emphasis for the rest of the unit. Similarly, if given at the end of the unit, the task could help the teacher decide how to make changes to the unit for the next time through the material. If, for example, students struggle with or rarely choose to use double number lines, the teacher may wish to integrate this method more throughout the unit.

This task was developed with the assistance of a group of teachers from Illinois and Washington in connection with an SBAC digital library project. In the videotaped lesson related to this task, the statement was:Â Â ”If Perfect Purple paint is made by mixing 2 cups blue to 3 cups red paint, how much of each color would be needed for 20 cups?”

This task was written as part of a collaborative project between Illustrative Mathematics, the Smarter Balanced Digital Library, the Teaching Channel, and Desmos.

Solutions

Solution: 1 Tape Diagram (6.RP.3.a)

Below is a picture showing 4 batches of purple paint making 20 cups total, along with the blue paint and red paint that make up the purple paint:

  Â

We can see that in the 20 cups of purple paint, there are 8 cups of blue paint (4 groups of 2 cups) and 12 cups of red paint (4 groups of 3 cups).

Solution: 2 Ratio Table (6.RP.3.a)

A ratio table is a more abstract approach than the tape diagram. A ratio table shows the numbers of cups of blue, red, and purple paint rather than physically modeling these quantities:

Blue Paint (cups) Red Paint (cups) Purple Paint (cups)
2 3 5
4 6 10
6 9 15
8 12 20

The rows show 1 batch, 2 batches, 3 batches, and 4 batches of purple paint. To get 20 cups of purple paint, the table shows that we need 8 cups of blue paint and 12 cups of red paint.

Solution: 3 Double Number Line (6.RP.3)

We can solve the problem using double (or triple) number lines. This is similar to the ratio table although the information is presented in a different, more geometric format resembling the tape diagram. For example, to find out how much blue paint there will be in 20 cups of perfect purple paint, we can use the double number line below:

 Â

A similar method will show that there are 12 cups of red paint in 20 cups of perfect purple paint. Or, we can use the fact that there are 8 cups of blue paint and then a second double number line tells us that we need to mix this with 12 cups of red paint to get 20 cups of perfect purple paint:

  Â

The picture below shows how to combine the blue, red, and purple paint with a triple number line (as above, the units for the paint are cups):

 Â

If we mix no blue paint and no red paint we get no purple paint as shown on the left. The next vertical line shows that one batch of 5 cups of purple paint is made out of 3 cups of red paint and 2 cups of blue paint. We are interested in 20 cups of purple paint which is 4 groups of 5. This means that we need 4 groups of 2 or 8 cups of blue paint and 4 groups of 3 or 12 cups of red paint.Â

Solution: 4 Graphing Points (6.RP.3.a and 6.EE.9)

Instead of the double number line which shows both the blue and red paint on different horizontal axes, we can represent the situation using a horizontal axis and a vertical axis as shown below:

  Â

The given information (2 cups of blue paint and 3 cups of red paint is shown in black). The other dots show two, three, and four batches of purple paint. Four batches make 8 cups of blue paint and 12 cups of red paint, for a total of 20 cups of purple paint.

Notice that the 4 points all lie on a line and the line goes through the point (0,0). The point (0,0) is the case where there is no blue paint and no red paint, combining to make no purple paint. Note too that blue paint could be placed on the vertical axis and red paint on the horizontal axis.

Solution: 5 Division and Multiplication with Units (6.RP.3.d)

If Jessica mixes 2 cups of blue paint with 3 cups of red paint this will make 5 cups of her favorite purple paint. She wants 20 cups of purple paint and this will require $20 text < cups>div 5 ,frac>> = 4 text< batches>.$ So Jessica needs to make 4 batches of her purple paint. This will require 4 $times$ 2 = 8 cups of blue paint and 4 $times$ 3 = 12 cups of red paint.

Solution: 6 Setting up an equation (6.RP.3.a and 6.EE.7)

Each batch of 2 cups of blue paint and 3 cups of red paint makes one batch of 5 cups of purple paint. We let $x$ stand for the number of batches of purple paint. In $x$ batches of purple paint there are $x times 5$ or $5x$ cups. Since we want 20 cups of purple paint, we need to solve $5x = 20$. This means $x = 4$ so Jessica needs to make 4 batches of purple paint. She will need 8 cups of blue paint and 12 cups of red paint to make 20 cups of her favorite purple paint.

Colin Wynn
the authorColin Wynn

Leave a Reply