mlreportgen.dom.BackgroundColor Class
Namespace: 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.backgroundColorObj
= BackgroundColor(colorName
)
creates a background color object using the hexadecimal RGB color
value.backgroundColorObj
= BackgroundColor(rgbValue
)
Input Arguments
colorName
— Name of a color to use
character vector
The name of a color, specified as a character vector or string scalar. The name must be a CSS color name. See https://www.w3.org/wiki/CSS/Properties/color/keywords.
rgbValue
— Hexadecimal RGB (red, green, blue) color value
character vector
A character vector using the following RGB format:
#RRGGBB
. Use #
as the first
character and two-digit hexadecimal numbers each for the red, green, and
blue values. For example, '#0000ff'
specifies
blue.
Properties
HexValue
— Hexadecimal RGB color value
character vector | string scalar
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:
NonCopyable | true |
Data Types: char
| string
Value
— Color of document element
character vector | string scalar | three comma-separated positive integers | row vector of three positive numerical values
Color of the document element, specified as one of these formats:
Format | Data Type |
---|---|
CSS color name | Specify as a character vector or string scalar. The name must be a CSS color name. See https://www.w3.org/wiki/CSS/Properties/color/keywords. |
Hexadecimal RGB value | Specified as a character vector or string scalar using the format #RRGGBB . Use # as the first character and two-digit hexadecimal numbers for the red, green, and blue values. You can use either uppercase or lowercase letters as part of a hexadecimal value. |
Decimal RGB color value | Specify three comma-separated positive integers, values , in the string "rgb(values)" . The digits specify the red, green, and blue values. Each value ranges from 0 to 255 . |
Decimal percent RGB color value | Specify a row vector of three positive numerical values. The digits specify the red, green, and blue values. Each value ranges from 0 to 1 . |
Example: "red"
specifies a red color using a CSS color name.
Example: "#0000ff"
specifies a blue color using a hexadecimal RGB value.
Example: "rgb(128,0,128)"
specifies a purple color using a decimal RGB color value.
Example: [0.5 0 0.5]
specifies a purple color using a decimal percent RGB color value.
Attributes:
NonCopyable | true |
Data Types: double
| char
| string
Id
— Object identifier for mlreportgen.dom.BackgroundColor
object
character vector | string scalar
Object identifier for the mlreportgen.dom.BackgroundColor
object, specified as a
character vector or string scalar. The DOM API generates a session-unique identifier
when it creates the document element object. You can specify your own value for
Id
.
Attributes:
NonCopyable | true |
Data Types: char
| string
Tag
— Tag for mlreportgen.dom.BackgroundColor
object
character vector | string scalar
Tag for the mlreportgen.dom.BackgroundColor
object, 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. Specify your own tag value to help
you identify where to look when an issue occurs during document generation.
Attributes:
NonCopyable | true |
Data Types: char
| string
Examples
Create and Apply a Background Color
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
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.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- 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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)