Specifying Colors in MATLAB

Colors can be specified in three different ways in MATLAB: Here are the eight predefined colors in MATLAB with their names and RGB equivalents:
RGB value Short name Long name
[1 1 0] y yellow
[1 0 1] m magenta
[0 1 1] c cyan
[1 0 0] r red
[0 1 0] g green
[0 0 1] b blue
[1 1 1] w white
[0 0 0] k black

How to make up your own colors

A subtle pink? A deep burgundy? A neon chartreuse? You can specify the RGB values and create any color you like. Below is a table of some sample colors:
whitebg([255/255 153/255 255/255]) whitebg([102/255 0/255 51/255])
whitebg([0/255 204/255 55/255]) whitebg([153/255 255/255 0/255])
These color combinations are available here (and many other places, just Google "RGB chart").

Note:

Where to use color in MATLAB?

Back to Lab 3 page