Custom Colors

Use custom colors to go beyond the default Desmos palette and add a personal touch to your graphs!

You can define colors using hue, saturation, and value parameters (HSV); or by specifying the amounts of red, green, and blue in the color (RGB). You can even create a list of colors to use with a list of objects! Check out the example graphs below, or read on for more details.

Defining a Custom Color

HSV

The expression c=hsv(230, 0.52, 0.7) defines a new color with a hue of 230°, 52% saturation, and a value of 70%.

Expression line of a graphing calculator. c=\operatorname{hsv}\left(230,0.52,0.7\right). Screenshot.

 

The hue of a color is a number between 0 and 360, representing an angle on the chromatic circle. Note that by convention, this angle is always measured in degrees. Example: Hue gradient

The saturation of a color is a number between 0 and 1, describing how grey or “washed out” the color is. Example: Saturation gradient

Finally, the value of a color works together with hue and saturation to influence how bright the color appears: from 0 for black up to 1 for full brightness. Example: Value gradient

RGB

The expression c=rgb(86, 101, 179) defines a new color that is a mixture of 86 units red, 101 units green, and 179 units blue.

Expression line of a graphing calculator. c=\operatorname{rgb}(86,101,179). Screenshot.

 

Each input to rgb() should be a number between 0 and 255. The red, green, and blue components act like colored lights: rgb(0,0,0) produces a black color, while rgb(255,255,255) will produce white.

Graphing calculator expression line 1: c_{black}=\operatorname{rgb}\left(0,0,0\right).  Expression line 2: c_{white}=\operatorname{rgb}\left(255,255,255\right). Screenshot.

 

Note that opacity can also influence the actual color that appears in the graph. (Example: Opacity and Color.)

 

Using a Custom Color

Once you have defined a custom color in the expression list and given it a name (left image, below), it will appear as an option in the style menu for any object (right image, below). Hover over the color swatch to see your name for this color.

 

Graphing calculator. Expression line 1:\left(0,0\right), with style menu showing.  Expression line 2:c_{1}=\operatorname{hsv}\left(359,0.88,0.84\right).  Expression line 3: c_{2}=\operatorname{hsv}\left(30,0.62,0.99\right). Expression line 4: c_{3}=\operatorname{hsv}\left(60,0.25,1\right). Expression line 5: c_{4}=\operatorname{hsv}\left(195,0.27,0.91\right).  Expression line 6: c_{5}=\operatorname{hsv}\left(206,0.76,0.71\right).  Expression line 7: C_{palette}=\left[c_{1},c_{2},c_{3},c_{4},c_{5}\right].  Screenshot.

Graphing calculator. Expression line 1:\left(0,0\right), with style menu showing.  Expression line 2:c_{1}=\operatorname{hsv}\left(359,0.88,0.84\right).  Expression line 3: c_{2}=\operatorname{hsv}\left(30,0.62,0.99\right). Expression line 4: c_{3}=\operatorname{hsv}\left(60,0.25,1\right). Expression line 5: c_{4}=\operatorname{hsv}\left(195,0.27,0.91\right).  Expression line 6: c_{5}=\operatorname{hsv}\left(206,0.76,0.71\right).  Expression line 7: C_{palette}=\left[c_{1},c_{2},c_{3},c_{4},c_{5}\right]. Also has style menu pulled up to show custom colors added there.  Screenshot.

 

Accessibility

If you are planning to share your graph with others, keep in mind that individuals often experience colors differently. We recommend aiming for a contrast level of at least 3:1 in your custom colors, and not relying on color alone to distinguish important elements of your graphs.

Was this article helpful?
24 out of 29 found this helpful