This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Color of light

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Value Summary



LightColor sets the color of user-defined light sources such as plot::AmbientLight, plot::DistantLight etc.

The value of LightColor must be an RGB or RGBa color, i.e., a list of three or four numerical values between 0 and 1. (The fourth value is the opacity entry of an RGBa color. It is accepted but does not have any effect on the light color.)

The RGB library provides many predefined colors such as RGB::Blue etc. See Section  of this document for more information on colors.

LightColor cannot be animated.


Example 1

We define a white box and illuminate it by a yellow distant light:

b := plot::Box(-1..1, -1..1, -1..1, Color = RGB::White):
light := plot::DistantLight([-1, -2, 3], [0, 0, 0], 
                            Color = RGB::Yellow):
plot(b, light, Axes = None)

We change the color of the light source:

light::LightColor := RGB::Blue:
plot(b, light, Axes = None)

delete b, light:
Was this topic helpful?