Colors in Matlab

From biophysics
Revision as of 10:49, 24 September 2024 by Lof (talk | contribs) (→‎Color maps)
Jump to navigation Jump to search

RGB colors

For coding purposes colors are mostly specified in RGB, which stands for Red, Blue and Green. The values range from 0 to 1. As an example: the color red is given by the triple [1,0,0]. Since it is hard to know what a certain triple (e.g. [0.5, 1, 0.5]) stands for it is more easy to call them by their name.

We have created a few functions for RGB colors by their names:

  • <RGBcolors> for english names
  • <RGBkleuren> for dutch names
  • <RGBfarben> for german names
  • <RGBcolores> for spanish names

A few examples:

>>colores.AZUL_CLARO
ans = 0.5000   0.5000   1.0000

>>kleuren.FELROZE
ans = 0.5000   0.5000   1.0000

>>farben.BLAU
ans = 0.0000   0.0000   1.0000

>>colors.LIME
ans = 0.0000   1.0000   0.0000

All the named colors are:

RGB Code Hex Code English Name Nederlandse Naam Deutsche Name Nombre en Español Kleur
[0.00, 1.00, 0.00] #00FF00 Lime Limoen Limettengrün Lima
[1.00, 0.00, 0.00] #FF0000 Red Rood Rot Rojo
[0.00, 0.00, 1.00] #0000FF Blue Blauw Blau Azul
[0.00, 1.00, 1.00] #00FFFF Cyan Cyaan Cyan Cian
[1.00, 0.00, 1.00] #FF00FF Magenta Magenta Magenta Magenta
[1.00, 1.00, 0.00] #FFFF00 Yellow Geel Gelb Amarillo
[0.00, 0.00, 0.00] #000000 Black Zwart Schwarz Negro
[0.50, 0.50, 0.50] #808080 Grey Grijs Grau Gris
[1.00, 1.00, 1.00] #FFFFFF White Wit Weiß Blanco
[0.50, 0.00, 0.00] #800000 Maroon Kastanjebruin Kastanienbraun Granate
[0.00, 0.50, 0.00] #008000 Green Groen Grün Verde
[0.00, 0.00, 0.50] #000080 Navy Blue Marineblauw Marineblau Azul Marino
[0.00, 0.50, 0.50] #008080 Olive Olijf Olive Oliva
[0.50, 0.00, 0.50] #800080 Purple Paars Lila Morado
[0.50, 0.50, 0.00] #808000 Teal Zeegroen Türkis Verde azulado
[0.50, 0.00, 1.00] #8000FF Indigo Indigo Indigo Índigo
[0.50, 1.00, 0.00] #80FF00 Chartreuse Chartreuse Chartreuse Chartreuse
[0.00, 0.50, 1.00] #0080FF Royal Blue Koningsblauw Königsblau Azul Real
[1.00, 0.00, 0.50] #FF0080 Hot Pink Felroze Knallrosa Rosa Brilliante
[1.00, 0.50, 0.00] #FF8000 Orange Oranje Orange Naranja
[0.00, 1.00, 0.50] #00FF80 Spring Green Lentegroen Frühlingsgrün Verde Primavera
[0.50, 0.50, 1.00] #8080FF Light Blue Lichtblauw Hellblau Azul Claro
[0.50, 1.00, 0.50] #80FF80 Light Green Lichtgroen Hellgrün Verde Claro
[1.00, 0.50, 0.50] #FF8080 Salmon Zalmroze Lachs Salmón
[0.50, 1.00, 1.00] #80FFFF Aquamarine Aquamarijn Aquamarin Aguamarina
[1.00, 0.50, 1.00] #FF80FF Orchid Orchidee Orchidee Orquídea
[1.00, 1.00, 0.50] #FFFF80 Light Yellow Lichtgeel Hellgelb Amarillo Claro

Color maps

You can make a color map for plots like surface plots:

map = [RGBcolors.LIME, RGBcolors.BLUE, RGBcolors.MAGENTA];
colormap(map);
surf(peaks);
Name Description
parula Parula colormap array
turbo Turbo colormap array
hsv HSV colormap array
hot Hot colormap array
cool Cool colormap array
spring Spring colormap array
summer Summer colormap array
autumn Autumn colormap array
winter Winter colormap array
gray Gray colormap array
bone Bone colormap array
copper Copper colormap array
pink Pink colormap array
lines Lines colormap array
jet Jet colormap array
colorcube Colorcube colormap array
prism Prism colormap array
flag Flag colormap array