mlreportgen.dom.Color class
Package: mlreportgen.dom
Color of document element
Description
Use objects of the mlreportgen.dom.Color
class to specify the color of a document
element.
The mlreportgen.dom.Color
class is a handle
class.
Creation
Properties
HexValue
— Hexadecimal RGB color value
character vector
Hexadecimal RGB color value, specified as a character vector.
Example: '#8b008b'
specifies a dark magenta
color.
Attributes:
GetAccess | public |
SetAccess | protected |
NonCopyable | true |
Data Types: char
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.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char
| string
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.
Attributes:
GetAccess | public |
SetAccess | public |
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 string scalar or character vector
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:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Methods
Public Methods
Method | Purpose |
---|---|
isValid | Use this method to check if a string is a valid color. tf = mlreportgen.dom.Color.isValid('red'); tf = logical 1 |
| Use this method to get the unit vector values for a valid color. redVector = mlreportgen.dom.Color.getUnitVector('red'); redVector = 1 0 0 |
Examples
Create and Apply a Color Object
Create a blue color object and apply it to a paragraph. Instead of specifying the CSS color name 'blue'
, you could use the hexadecimal value '#0000ff'
.
import mlreportgen.dom.*; doctype = 'html'; d = Document('test',doctype); colorfulStyle = {Bold,Color('blue')}; p = Paragraph('deep sky blue paragraph'); p.Style = colorfulStyle; append(d,p); close(d); rptview('test',doctype);
Version History
Introduced in R2014b
Ouvrir l'exemple
Vous possédez une version modifiée de cet exemple. Souhaitez-vous ouvrir cet exemple avec vos modifications ?
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
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)