mlreportgen.dom.BackgroundColor class
Package: mlreportgen.dom
Superclasses:
Background color of document element
Description
Specifies the background color of a document element
Construction
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. 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.
Output Arguments
backgroundColorObj
— Background color
mlreportgen.dom.BackgroundColor
object
Background color for a report object, returned as an mlreportgen.dom.BackgroundColor
object
Properties
HexValue
— Hexadecimal color value (read-only)
character vector
Hexadecimal number representing an RGB color value. For example, '#8b008b'
specifies
dark magenta. You can use either uppercase or lowercase letters as
part of a hexadecimal value.
Id
— ID for this document element
character vector | string scalar
ID for this document element, specified as a character vector or string scalar. The DOM generates a session-unique ID when it creates the document element. You can specify your own ID.
Tag
— Tag for this document element
character vector | string scalar
Tag for this document element, specified as a character vector or string scalar.
The DOM 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. Specifying your own tag value can
help you to identify where an issue occurred during document generation.
Value
— CSS color name or hexadecimal RGB value for this color
character vector
Either a CSS color name or a hexadecimal RGB value, specified as a character vector.
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);
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
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)