This paper introduces the definition of Ant Cube Card in terms of value, time, length and color.
Numeric Unit
Some attributes in the card need to be implemented in pure numerical units, such as flex and lines. In this case, px and vw are not added after the value.
For more information about the value ranges and value types of pure numeric values, see the property definitions of each component in . If a impure value is encountered, it is processed as 0 by default.
Example:
lines:5;
flex:1;Time Unit
Some attributes of cards need to be described by time, for example, animation-duration. Cards support time units in seconds and milliseconds.
Example:
animation-duration:2s;Length Unit
The card has several different units to indicate the length. The length consists of a number and a unit. No space can appear between the number and the unit. The length units are divided into built-in units and custom units.
Built-in Unit
Relative length
Relative length units specify the properties of one length relative to another. For different equipment relative length is more suitable
vw:viewpoint width, window width, 1vw=1% of the window width.
%: Percentage of window height /width.
Example:
font-size: 20vw;
background-size:50%;Absolute length
An absolute length unit is a fixed value that reflects a real physical dimension. The absolute length unit depends on the output medium and does not depend on the environment (monitor, resolution, operating system, etc.)
px: pixel (1px = 1/96th of 1in)
rpx: calculated based on 750, 2rpx = 1px
Example:
font-size: 17px;
line-height:40rpx;Click here detailLength.zip for the complete sample code.
Color Unit
Colors in cards can be specified in the following ways:
Hexadecimal
RGB Color
Color Name
Hex Color
There are several ways to specify the components of a hexadecimal color:
# RRGGBB, where RR (red), GG (green) and BB (blue). All values must be between 0 and FF.
For example, the #0000FF value is rendered blue because the blue component is set to the highest value FF and the others are set to 0.
# RGB, where R (red),G (green) and B (blue). All values must be between 0 and F.
For example, the #00F value appears blue because the blue component is set to the highest value F and the others are set to 0.
0xrrggbb, where rr (red),gg (green) and bb (blue). All values must be between 0 and ff.
For example, the 0x0000ff value appears blue because the blue component is set to the highest value ff and the others are set to 0.
Example:
background-color:#ff0000;
border-top-color:0x0000ff;
border-bottom-color:#00f;RGB Color
There are several ways to specify the color of an RGB component:
RGB (red, green, blue). Each parameter (red, green and blue) defines the brightness of the color, as an integer between 0 and 255. For example, an RGB (0,0,255) value is rendered as blue because the parameter for blue is set to the highest value of 255 and the others are set to 0.
RGBA (red, green, blue, alpha). The alpha parameter is between 0.0 (fully transparent) and 1.0 (fully opaque). For example, an RGB (0,0,255,0.5) value appears as translucent blue.
Example:
background-color:rgb(0,0,255);
border-color:rgba(255,0,0,0.5);Color Name
The card supports 147 color name definitions, including 17 standard colors and 130 other colors. The following table lists the names and corresponding hexadecimal values for all colors.
Standard Color
Parameter | Hexadecimal |
red | 0xffff0000 |
blue | 0xff0000ff |
black | 0xff000000 |
... | Etc. |
Others
Parameter | Hexadecimal |
red | 0xffff0000 |
blue | 0xff0000ff |
black | 0xff000000 |
... | Etc. |
Example
background-color:red;Only the color formats listed above are supported. None of the other color formats are supported.
If an unsupported color format is encountered, the card will be treated as the default transparent color (except for some styles that have separate default color rules).
Click here detailColor.zip for the complete sample code.
Appendix-Color Value Definition
Parameter | Color value |
red | 0xffff0000 |
darkred | 0xff8b0000 |
tan | 0xffd2b48c |
linen | 0xfffaf0e6 |
sienna | 0xffa0522d |
indianred | 0xffcd5c5c |
teal | 0xff008080 |
grey | 0xff808080 |
green | 0xff008000 |
gray | 0xff808080 |
darkgrey | 0xffa9a9a9 |
darkgreen | 0xff006400 |
beige | 0xfff5f5dc |
orange | 0xffffa500 |
darkgray | 0xffa9a9a9 |
orangered | 0xffff4500 |
khaki | 0xfff0e68c |
seagreen | 0xff2e8b57 |
gold | 0xffffd700 |
darkorange | 0xffff8c00 |
darkkhaki | 0xffbdb76b |
indigo | 0xff4b0082 |
goldenrod | 0xffdaa520 |
maroon | 0xff800000 |
gainsboro | 0xffdcdcdc |
lime | 0xff00ff00 |
greenyellow | 0xffadff2f |
darkgoldenrod | 0xffb8860b |
slategrey | 0xff708090 |
slategray | 0xff708090 |
salmon | 0xfffa8072 |
darkseagreen | 0xff8fbc8f |
seashell | 0xfffff5ee |
darksalmon | 0xffe9967a |
tomato | 0xffff6347 |
thistle | 0xffd8bfd8 |
darkslategrey | 0xff2f4f4f |
cyan | 0xff00ffff |
forestgreen | 0xff228b22 |
dimgrey | 0xff696969 |
darkslategray | 0xff2f4f4f |
mistyrose | 0xffffe4e1 |
dimgray | 0xff696969 |
darkcyan | 0xff008b8b |
black | 0xff000000 |
magenta | 0xffff00ff |
limegreen | 0xff32cd32 |
coral | 0xffff7f50 |
darkmagenta | 0xff8b008b |
azure | 0xfff0ffff |
blue | 0xff0000ff |
oldlace | 0xfffdf5e6 |
cornsilk | 0xfffff8dc |
darkblue | 0xff00008b |
skyblue | 0xff87ceeb |
firebrick | 0xffb22222 |
orchid | 0xffda70d6 |
lightgrey | 0xffd3d3d3 |
lightgreen | 0xff90ee90 |
lightyellow | 0xffffffe0 |
lightgray | 0xffd3d3d3 |
darkorchid | 0xff9932cc |
royalblue | 0xff4169e1 |
aqua | 0xff00ffff |
steelblue | 0xff4682b4 |
bisque | 0xffffe4c4 |
crimson | 0xffdc143c |
slateblue | 0xff6a5acd |
dodgerblue | 0xff1e90ff |
blanchedalmond | 0xffffebcd |
lightseagreen | 0xff20b2aa |
lightslategrey | 0xff778899 |
lightslategray | 0xff778899 |
brown | 0xffa52a2a |
lightsalmon | 0xffffa07a |
snow | 0xfffffafa |
lightcyan | 0xffe0ffff |
rosybrown | 0xffbc8f8f |
sandybrown | 0xfff4a460 |
darkslateblue | 0xff483d8b |
yellow | 0xffffff00 |
lightcoral | 0xfff08080 |
mintcream | 0xfff5fffa |
aquamarine | 0xff7fffd4 |
saddlebrown | 0xff8b4513 |
honeydew | 0xfff0fff0 |
pink | 0xffffc0cb |
lightblue | 0xffadd8e6 |
cadetblue | 0xff5f9ea0 |
wheat | 0xfff5deb3 |
lawngreen | 0xff7cfc00 |
white | 0xffffffff |
aliceblue | 0xfff0f8ff |
chocolate | 0xffd2691e |
yellowgreen | 0xff9acd32 |
moccasin | 0xffffe4b5 |
navy | 0xff000080 |
chartreuse | 0xff7fff00 |
ivory | 0xfffffff0 |
palegreen | 0xff98fb98 |
lavender | 0xffe6e6fa |
hotpink | 0xffff69b4 |
olive | 0xff808000 |
fuchsia | 0xffff00ff |
mediumseagreen | 0xff3cb371 |
silver | 0xffc0c0c0 |
olivedrab | 0xff6b8e23 |
darkturquoise | 0xff00ced1 |
turquoise | 0xff40e0d0 |
violet | 0xffee82ee |
violetred | 0xffd02090 |
darkviolet | 0xff9400d3 |
palegoldenrod | 0xffeee8aa |
whitesmoke | 0xfff5f5f5 |
springgreen | 0xff00ff7f |
burlywood | 0xffdeb887 |
peru | 0xffcd853f |
floralwhite | 0xfffffaf0 |
lightpink | 0xffffb6c1 |
darkolivegreen | 0xff556b2f |
ghostwhite | 0xfff8f8ff |
mediumblue | 0xff0000cd |
mediumorchid | 0xffba55d3 |
lightsteelblue | 0xffb0c4de |
lightslateblue | 0xff8470ff |
transparent | 0x00000000 |
deepskyblue | 0xff00bfff |
lightskyblue | 0xff87cefa |
lightgoldenrodyellow | 0xfffafad2 |
plum | 0xffdda0dd |
mediumaquamarine | 0xff66cdaa |
mediumslateblue | 0xff7b68ee |
blueviolet | 0xff8a2be2 |
midnightblue | 0xff191970 |
deeppink | 0xffff1493 |
lemonchiffon | 0xfffffacd |
antiquewhite | 0xfffaebd7 |
paleturquoise | 0xffafeeee |
powderblue | 0xffb0e0e6 |
navajowhite | 0xffffdead |
mediumspringgreen | 0xff00fa9a |
cornflowerblue | 0xff6495ed |
palevioletred | 0xffdb7093 |
mediumvioletred | 0xffc71585 |
purple | 0xff800080 |
rebeccapurple | 0xff663399 |
lavenderblush | 0xfffff0f5 |
mediumturquoise | 0xff48d1cc |
peachpuff | 0xffffdab9 |
mediumpurple | 0xff9370db |
papayawhip | 0xffffefd5 |