mlreportgen.dom.Color Class
Namespace: 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
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
Color of the document element, specified as one of the formats in the table.
| Format | Value |
|---|---|
| CSS color name | Specify a CSS color name. For a list of CSS color names, see https://www.w3.org/wiki/CSS/Properties/color/keywords. |
| Hexadecimal RGB value | Use 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 | Use the format "rgb(r,g,b)", where r,
g, and b are comma-separated positive
integers that specify the red, green, and blue values, respectively. Each value
range must be between 0 and 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 must be between 0 and 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 1 0] specifies a green color using a decimal
percent RGB color value.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: double | 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
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
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 |
getUnitVector | 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 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
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.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)