mlreportgen.dom.BackgroundColor Class
R2026bNamespace: mlreportgen.dom
Background color of document element
Description
Specifies the background color of a document element
The mlreportgen.dom.BackgroundColor class is a handle class.
Creation
Description
creates a white background.backgroundColorObj = BackgroundColor
creates a background color object based on the specified CSS color name,
hexadecimal RGB value, decimal RGB value, or decimal percent RGB color
value.backgroundColorObj = BackgroundColor(colorValue)
Input Arguments
Color value, specified as one of these formats.
| Format | Value |
|---|---|
| CSS color name | CSS color name. For a list of CSS color names, see https://www.w3.org/wiki/CSS/Properties/color/keywords. |
| Hexadecimal RGB value | RGB color in the format "#RRGGBB". Use # as the first
character and two-digit hexadecimal numbers for the red, green, and blue values.
You can use uppercase or lowercase letters. |
| Decimal RGB color value | RGB color in the format "rgb(r,g,b)", where r,
g, and b are nonnegative integers that
specify the red, green, and blue values, respectively. Each value range must be
between 0 and 255. |
| Decimal percent RGB color value | Row vector of three nonnegative numerical values between 0 and
1. The first, second, and third elements of the vector
represent the red, green, and blue values, respectively. |
Example: "red" specifies a red color by using the CSS
color name.
Example: "#0000ff" specifies a blue color by using
the hexadecimal RGB value.
Example: "rgb(255,255,0)" specifies a yellow color by
using the decimal RGB color value.
Example: [0.5 0 0.5] specifies a purple color by using a decimal percent RGB color value.
Properties
Hexadecimal RGB color value, specified as a character vector or string scalar. You can use either uppercase or lowercase letters as part of a hexadecimal value.
Example: "#8b008b" specifies a dark magenta
color.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Background color of the document element, specified as one of these formats.
| Format | Value |
|---|---|
| CSS color name | CSS color name. For a list of CSS color names, see https://www.w3.org/wiki/CSS/Properties/color/keywords. |
| Hexadecimal RGB value | RGB color in the format "#RRGGBB". Use # as the first
character and two-digit hexadecimal numbers for the red, green, and blue values.
You can use uppercase or lowercase letters. |
| Decimal RGB color value | RGB color in the format "rgb(r,g,b)", where r,
g, and b are nonnegative integers that
specify the red, green, and blue values, respectively. Each value range must be
between 0 and 255. |
| Decimal percent RGB color value | Row vector of three nonnegative numerical values between 0 and
1. The first, second, and third elements of the vector
represent the red, green, and blue values, respectively. |
Example: "red" specifies a red color by using the CSS
color name.
Example: "#0000ff" specifies a blue color by using
the hexadecimal RGB value.
Example: "rgb(255,255,0)" specifies a yellow color by
using the decimal RGB color value.
Example: [0.5 0 0.5] specifies a purple color by using a decimal percent RGB color value.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: double | char | string
Object identifier, specified as a character vector or string scalar. The DOM API generates a session-unique identifier when it creates the document element object.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Tag, specified as a character vector or string scalar. The DOM API generates a
session-unique tag as part of the creation of this object. The generated tag has the
form CLASS:ID, where
CLASS is the object class and
ID is the value of the
Id property of the object. Use this value to help identify
where an issue occurs during document generation.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Examples
Create a deep sky blue background color object and apply it to a paragraph. Instead of specifying the CSS color name DeepSkyBlue, you can use the hexadecimal value #00bfff.
import mlreportgen.dom.*; doctype = 'html'; d = Document('test',doctype); blue = 'DeepSkyBlue'; % blue = '#00BFFF'; colorfulStyle = {Bold,Color(blue),BackgroundColor('Yellow')}; p = Paragraph('deep sky blue paragraph with yellow background'); p.Style = colorfulStyle; append(d,p); close(d); rptview('test',doctype);
Version History
Introduced in R2014b
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)