索引
HT for Web默认具有一套整体性的风格效果,在各种组件中保持一致的颜色,尺寸和操作习惯,
但用户客户根据具体使用需要进行定制,改变风格以适应不同项目或行业的效果需求。
改变HT系统默认属性,需要通过全局的htconfig变量名指定,HT系统只在初始化时读取htconfig的配置信息,
因此该属性必须在引入ht.js包之前初始化好,运行状态时修改htconfig变量不会再起作用,示例代码如下:
<script>
htconfig = {
Color: {
label: '#000',
highlight: '#1ABC9C',
},
Default: {
toolTipDelay: 100,
toolTipContinual: true
},
Style: {
'select.color': '#E74C3C',
'select.width': 3
}
};
</script>
<script src="ht.js"></script>
可配置的参数分为三大类:
ht.Color对象属性上ht.Default对象属性上GraphView和Graph3dView组件上图元的默认参数,最终设置到ht.Style对象属性上ht.Color是为简化颜色主题自定义而抽象的一组颜色属性集,HT系统中所有颜色都取之于这组颜色集,
每个属性对应一到多个ht.Default,ht.Style或预定义矢量图片中的具体属性。
ht.Default.listViewSelectBackground和ht.Default.treeViewSelectBackground初始值都由ht.Color.highlight值决定的,因此:
ht.Color.highlight值,可改变所有列表和树组件的选中颜色ht.Default.listViewSelectBackground值,可改变所有列表组件的选中颜色ht.Default.treeViewSelectBackground值,可改变所有树组件的选中颜色listView.setSelectBackground('blue'),可改变具体列表组件对象的选中颜色treeView.setSelectBackground('blue'),可改变具体树组件对象的选中颜色以下是ht.Color每个颜色对应的具体属性
highlight
ht.Style['select.color']ht.Style['note.background']ht.Style['note2.background'] ht.Default.accordionViewSelectBackgroundht.Default.propertyViewSelectBackgroundht.Default.listViewSelectBackgroundht.Default.treeViewSelectBackgroundht.Default.tableViewSelectBackgroundht.Default.treeTableViewSelectBackgroundht.Default.tableHeaderInsertColorht.Default.tabViewSelectBackgroundht.Default.tabViewInsertColorht.Default.toolbarSelectBackgroundht.Default.buttonSelectBackgroundht.Default.comboBoxSelectBackgroundht.Default.propertyPaneSelectBackground
label
ht.Default.labelColorht.Default.toolbarLabelColorht.Style['label.color']ht.Style['label2.color']ht.Default.propertyViewLabelColorht.Default.listViewLabelColorht.Default.treeViewLabelColorht.Default.tableViewLabelColorht.Default.treeTableViewLabelColorht.Default.tableHeaderLabelColorht.Default.toolbarLabelColor ht.Default.textFieldColorht.Default.textAreaColorht.Default.radioButtonLabelColorht.Default.checkBoxLabelColorht.Default.buttonLabelColorht.Default.comboBoxLabelColorht.Default.formPaneLabelColor ht.Default.propertyPaneHeaderLabelColor
labelSelectColor
ht.Style['note.color']ht.Style['note2.color']ht.Style['group.title.color']ht.Default.accordionViewLabelColorht.Default.propertyViewLabelSelectColorht.Default.listViewLabelSelectColorht.Default.treeViewLabelSelectColorht.Default.tableViewLabelSelectColorht.Default.treeTableViewLabelSelectColorht.Default.tabViewLabelColorht.Default.toolbarLabelSelectColorht.Default.buttonLabelSelectColorht.Default.comboBoxLabelSelectColor
transparent
ht.Default.scrollBarColorht.Default.toolTipShadowColorht.Default.tableHeaderMoveBackgroundht.Default.tabViewMoveBackgroundht.Default.overviewMaskBackgroundht.Default.comboBoxShadowColor
titleBackground
ht.Default.accordionViewTitleBackgroundht.Default.splitViewDividerBackgroundht.Default.tabViewTabBackground
titleIconBackground
ht.Default.accordionViewExpandIcon矢量图标背景色ht.Default.accordionViewCollapseIcon矢量图标背景色
headerBackground
ht.Default.propertyViewBackgroundht.Default.tableHeaderBackgroundht.Default.toolbarBackgroundht.Default.propertyPaneHeaderBackground
headerIconBackground
ht.Default.propertyViewExpandIcon矢量图标背景色ht.Default.propertyViewCollapseIcon矢量图标背景色ht.Default.tableHeaderSortDescIcon矢量图标背景色ht.Default.tableHeaderSortAscIcon矢量图标背景色
headerSeparator
ht.Default.toolbarSeparatorColor
headerLine
ht.Default.tableHeaderColumnLineColor
background
ht.Default.overviewContentBackgroundht.Default.comboBoxBackgroundht.Default.dialogContentBackground
disabledBackground
ht.Default.disabledBackground
toolTipBackground
ht.Default.toolTipBackground
rectSelectBorder
ht.Default.graphViewRectSelectBorderColor
rectSelectBackground
ht.Default.graphViewRectSelectBackgroundht.Default.graph3dViewRectSelectBackground
editPointBorder
ht.Default.graphViewEditPointBorderColor
editPointBackground
ht.Default.graphViewEditPointBackground
dash
ht.Style['shape.dash.color']ht.Style['edge.dash.color']
groupBackground
ht.Style['group.background']
groupTitleBackground
ht.Style['group.title.background']
gridBackground
ht.Style['grid.background']
reverse
ht.Style['label.reverse.color']ht.Style['label2.reverse.color']ht.Style['note.reverse.color']ht.Style['note2.reverse.color']ht.Style['shape3d.reverse.color']ht.Style['all.reverse.color']
contentIconBackground
ht.Default.treeViewExpandIcon矢量图标背景色treeViewCollapseIcon矢量图标背景色treeTableViewExpandIcon矢量图标背景色treeTableViewCollapseIcon矢量图标背景色
contentLine
ht.Default.propertyViewRowLineColorht.Default.propertyViewColumnLineColorht.Default.listViewRowLineColorht.Default.treeViewRowLineColorht.Default.tableViewRowLineColorht.Default.tableViewColumnLineColorht.Default.treeTableViewRowLineColorht.Default.treeTableViewColumnLineColor
widgetBackground
ht.Default.buttonBackgroundht.Default.sliderButton矢量图标背景色ht.Default.overviewBackground
widgetBorder
ht.Default.textFieldBorderColorht.Default.textAreaBorderColorht.Default.radioButtonPressBackgroundht.Default.checkBoxPressBackgroundht.Default.buttonBorderColorht.Default.comboBoxBorderColorht.Default.overviewContentBorderColor
widgetIconBackground
widget组件相关矢量图标背景色
widgetIconBorder
widget组件相关矢量图标边框颜色
widgetIconGradient
widget组件相关矢量图标渐进色
widgetIconHighlight
widget组件相关矢量图标高亮色,一般用于表示选中状态
imageBackground
Data类型图元icon和image对应矢量图片背景色
imageGradient
Data类型图元icon和image对应矢量图片渐进色
chart
图表默认颜色数组
ht.Default定义了所有组件的默认参数值,命名规范以组件名+属性名的结合方式,例如树组件TreeView的行线是否显示属性rowLineVisible,
该属性的默认值定义在ht.Default.treeViewRowLineVisible上,因此可通过treeView.setRowLineVisible(true)改变具体组件实例,
也可通过配置ht.Default.treeViewRowLineVisible属性达到全局修改所有TreeView实例的效果。
ht.Default中出了定义了默认参数外,还包含很多工具函数,以下例子是对所有属性参数,以及工具函数使用的描述说明:
ht.Style定义了所有在GraphView和Graph3dView组件上显示的图元的style默认属性,创建Node和Edge这些图元实例对象时,
其对象自身的style属性为空,调用getStyle(name)函数时,如果该属性未设置,则HT会通过ht.Style的全局定义的默认值获取信息,
如果通过setStyle(name, value)的方式设置了具体对象属性后,getStyle(name)则会返回具体被设置的属性信息。
以下为ht.Style所有预定义的参数属性描述说明: