harmony 鸿蒙数据类型说明

  • 2022-10-28
  • 浏览 (872)

数据类型说明

说明:

从API Version 8 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。

长度类型

名称 类型定义 描述
length string | number 用于描述尺寸单位,输入为number类型时,使用px单位。输入为string类型时,需要显式指定像素单位,当前支持的像素单位有:
- px:逻辑尺寸单位。
- fp:字体尺寸单位,随系统字体大小设置发生变化,仅支持文本类组件设置相应的字体大小。
percentage string 百分比尺寸单位,如“50%”。

颜色类型

名称 类型定义 描述
color string |颜色枚举 用于描述颜色信息。
  字符串格式如下:
- ‘rgb(255, 255, 255)‘。
- ‘rgba(255, 255, 255, 1.0)‘。
- HEX格式:’#rrggbb’,’#aarrggbb’。
- 枚举格式:’black’,’white’。
JS脚本中不支持颜色枚举格式。

表1 当前支持的颜色枚举

枚举名称 对应颜色 颜色
aliceblue #f0f8ff aliceblue
antiquewhite #faebd7 antiquewhite
aqua #00ffff aqua
aquamarine #7fffd4 aquamarine
azure #f0ffff azure
beige #f5f5dc beige
bisque #ffe4c4 bisque
black #000000 #000000
blanchedalmond #ffebcd blanchedalmond
blue #0000ff blue
blueviolet #8a2be2 blueviolet
brown #a52a2a brown
burlywood #deB887 burlywood
cadetblue #5f9ea0 cadetblue
chartreuse #7fff00 chartreuse
chocolate #d2691e chocolate
coral #ff7f50 coral
cornflowerblue #6495ed cornflowerblue
cornsilk #fff8dc cornsilk
crimson #dc143c crimson
cyan #00ffff cyan
darkblue #00008b darkblue
darkcyan #008b8b darkcyan
darkgoldenrod #b8860b darkgoldenrod
darkgray #a9a9a9 darkgray
darkgreen #006400 darkgreen
darkgrey #a9a9a9 darkgrey
darkkhaki #bdb76b darkkhaki
darkmagenta #8b008b darkmagenta
darkolivegreen #556b2f darkolivegreen
darkorange #ff8c00 darkorange
darkorchid #9932cc darkorchid
darkred #8b0000 darkred
darksalmon #e9967a darksalmon
darkseagreen #8fbc8f darkseagreen
darkslateblue #483d8b darkslateblue
darkslategray #2f4f4f darkslategray
darkslategrey #2f4f4f darkslategrey
darkturquoise #00ced1 darkturquoise
darkviolet #9400d3 darkviolet
deeppink #ff1493 deeppink
deepskyblue #00bfff deepskyblue
dimgray #696969 dimgray
dimgrey #696969 dimgrey
dodgerblue #1e90ff dodgerblue
firebrick #b22222 firebrick
floralwhite #fffaf0 floralwhite
forestgreen #228b22 forestgreen
fuchsia #ff00ff fuchsia
gainsboro #dcdcdc gainsboro
ghostwhite #f8f8ff ghostwhite
gold #ffd700 gold
goldenrod #daa520 goldenrod
gray #808080 gray
green #008000 green
greenyellow #adff2f greenyellow
grey #808080 grey
honeydew #f0fff0 honeydew
hotpink #ff69b4 hotpink
indianred #cd5c5c indianred
indigo #4b0082 indigo
ivory #fffff0 ivory
khaki #f0e68c khaki
lavender #e6e6fa lavender
lavenderblush #fff0f5 lavenderblush
lawngreen #7cfc00 lawngreen
lemonchiffon #fffacd lemonchiffon
lightblue #add8e6 lightblue
lightcoral #f08080 lightcoral
lightcyan #e0ffff lightcyan
lightgoldenrodyellow #fafad2 lightgoldenrodyellow
lightgray #d3d3d3 lightgray
lightgreen #90ee90 lightgreen
lightpink #ffb6c1 lightpink
lightsalmon #ffa07a lightsalmon
lightseagreen #20b2aa lightseagreen
lightskyblue #87cefa lightskyblue
lightslategray #778899 lightslategray
lightslategrey #778899 lightslategrey
lightsteelblue #b0c4de lightsteelblue
lightyellow #ffffe0 lightyellow
lime #00ff00 lime
limegreen #32cd32 limegreen
linen #faf0e6 linen
magenta #ff00ff magenta
maroon #800000 maroon
mediumaquamarine #66cdaa mediumaquamarine
mediumblue #0000cd mediumblue
mediumorchid #ba55d3 mediumorchid
mediumpurple #9370db mediumpurple
mediumseagreen #3cb371 mediumseagreen
mediumslateblue #7b68ee mediumslateblue
mediumspringgreen #00fa9a mediumspringgreen
mediumturquoise #48d1cc mediumturquoise
mediumvioletred #c71585 mediumvioletred
midnightblue #191970 midnightblue
mintcream #f5fffa mintcream
mistyrose #ffe4e1 mistyrose
moccasin #ffe4b5 moccasin
navajowhite #ffdead navajowhite
navy #000080 navy
oldlace #fdf5e6 oldlace
olive #808000 olive
olivedrab #6b8e23 olivedrab
orange #ffa500 orange
orangered #ff4500 orangered
orchid #da70d6 orchid
palegoldenrod #eee8aa palegoldenrod
palegreen #98fb98 palegreen
paleturquoise #afeeee paleturquoise
palevioletred #db7093 palevioletred
papayawhip #ffefd5 papayawhip
peachpuff #ffdab9 peachpuff
peru #cd853f peru
pink #ffc0cb pink
plum #dda0dd plum
powderblue #b0e0e6 powderblue
purple #800080 purple
rebeccapurple #663399 rebeccapurple
red #ff0000 red
rosybrown #bc8f8f rosybrown
royalblue #4169e1 royalblue
saddlebrown #8b4513 saddlebrown
salmon #fa8072 salmon
sandybrown #f4a460 sandybrown
seagreen #2e8b57 seagreen
seashell #fff5ee seashell
sienna #a0522d sienna
silver #c0c0c0 silver
skyblue #87ceeb skyblue
slateblue #6a5acd slateblue
slategray #708090 slategray
slategrey #708090 slategray
snow #fffafa snow
springgreen #00ff7f springgreen
steelblue #4682b4 steelblue
tan #d2b48c tan
teal #008080 teal
thistle #d8Bfd8 thistle
tomato #ff6347 tomato
turquoise #40e0d0 turquoise
violet #ee82ee violet
wheat #f5deb3 wheat
white #ffffff white
whitesmoke #f5f5f5 whitesmoke
yellow #ffff00 yellow
yellowgreen #9acd32 yellowgreen

你可能感兴趣的鸿蒙文章

harmony 鸿蒙JS服务卡片UI组件

harmony 鸿蒙button

harmony 鸿蒙calendar

harmony 鸿蒙chart

harmony 鸿蒙clock

harmony 鸿蒙divider

harmony 鸿蒙image

harmony 鸿蒙input

harmony 鸿蒙progress

harmony 鸿蒙span

0  赞