Skip to main content

Custom Colors

Desmos provides several standard colors, but custom colors can also be defined and applied to graphs and labels.

The Desmos color palette

Defining a color​

rgb(Red, Green, Blue)​

Specify the red, green, and blue components from 00 to 255255.

Creating a color with rgb

hsv(Hue, Saturation, Value)​

Hue ranges from 00 to 360360; saturation and value range from 00 to 11.

Creating a color with hsv

Using a custom color​

Assign the color to a variable to add it to the expression color menu. A color that is not stored in a variable does not appear as an option.

Applying a custom color to a graph

Colors that depend on variables​

The arguments of rgb() and hsv() may contain variables, so the color can change with a slider. Braces can provide conditional colors.

1
c1=rgb(0,a,255−a)c_1=\mathrm{rgb}(0,a,255-a)
2
c2={0≤b≤1:rgb(200,0,0),1<b<2:rgb(0,200,0),2≤b≤3:rgb(0,0,200)}c_2=\{0\leq b\leq1:\mathrm{rgb}(200,0,0),1<b<2:\mathrm{rgb}(0,200,0),2\leq b\leq3:\mathrm{rgb}(0,0,200)\}
Loading graph…
Open in Desmos ↗

Lists of colors​

Lists and for can generate many colors for list-based graphs.

1
P=(x,y) for x=[0,1],y=[0,1]P=(x,y)\ \mathrm{for}\ x=[0,1],y=[0,1]
2
c=rgb(0,200−100P.x,100P.y)c=\mathrm{rgb}(0,200-100P.x,100P.y)
3
P+0.3(cos⁡t,sin⁡t)P+0.3(\cos t,\sin t)
Loading graph…
Open in Desmos ↗

A larger color list can reproduce a gradient.

1
D=[0,...,255]D=[0,...,255]
2
c=rgb(0,255−D,D)c=\mathrm{rgb}(0,255-D,D)
3
d=0.02d=0.02
4
y=dD{0≤x≤255d}y=dD\{0\leq x\leq255d\}
Loading graph…
Open in Desmos ↗