The Web SDK for PC supports user interface (UI) style customization. You can customize elements such as icons, button colors, and background colors on the guide page, certificate capture page, OCR result editing page, and liveness detection page.
Configuration method
You can pass a JSON string of custom styles to the Alibaba Cloud server for initialization using the StyleConfig field in the server-side Initialize API.
If you do not provide a custom configuration, the default configuration is used. If you omit a specific configuration item, its default style is used. To minimize the size of the initialization request, we recommend that you pass only the configurations that you want to modify and rely on the default Alibaba Cloud settings for the rest.
The JSON string cannot contain special characters used in regular expressions.
Configuration template
JavaScript
const styleConfig = {
guidePage: {
step1Icon: "", // The icon for Step 1. The image dimensions (width × height) are 200 × 200.
step2Icon: "", // The icon for Step 2. The image dimensions (width × height) are 200 × 200.
pathIcon: "", // The icon for the connecting line between steps. The image dimensions (width × height) are 320 × 3.
startBtnBgColor: "#FF6A00", // The background color of the Start Authentication button. Default value: #FF6A00.
startBtnTextColor: "#FFFFFF", // The text color of the Start Authentication button. Default value: #FFFFFF.
},
ocrPage: {
backIcon: "", // The icon for the Back button. The image dimensions (width × height) are 24 × 24.
uploadIcon: "", // The icon for Upload. The image dimensions (width × height) are 16 × 16.
uploadTextColor: "#FF6A00", // The color of the upload text. Default value: #FF6A00.
submitBtnBgColor: "#FF6A00", // The background color of the Submit button. Default value: #FF6A00.
submitBtnTextColor: "#FFFFFF", // The text color of the Submit button. Default value: #FFFFFF.
},
alert: {
top: "45%", // The distance from the top of the pop-up window. Default value: 45%.
left: "50%", // The distance from the left of the pop-up window. Default value: 50%.
width: "480px", // The width of the pop-up window. Default value: 480px.
primaryBtnBgColor: "#FF6A00", // The background color of the primary button. Default value: #FF6A00.
primaryBtnTextColor: "#FFFFFF", // The text color of the primary button. Default value: #FFFFFF.
btnBgColor: "#FFFFFF", // The background color of the secondary button. Default value: #FFFFFF.
btnBgTextColor: "#FF6A00", // The text color of the secondary button. Default value: #FF6A00.
btnBorder: "1px solid #FF6A00", // The border style of the secondary button. Default value: 1px solid #FF6A00.
}
};JSON
{
"guidePage": {
"step1Icon": "",
"step2Icon": "",
"pathIcon": "",
"startBtnBgColor": "#FF6A00",
"startBtnTextColor": "#FFFFFF"
},
"ocrPage": {
"backIcon": "",
"uploadIcon": "",
"uploadTextColor": "#FF6A00",
"submitBtnBgColor": "#FF6A00",
"submitBtnTextColor": "#FFFFFF"
},
"alert": {
"top": "45%",
"left": "50%",
"width": "480px",
"primaryBtnBgColor": "#FF6A00",
"primaryBtnTextColor": "#FFFFFF",
"btnBgColor": "#FFFFFF",
"btnBgTextColor": "#FF6A00",
"btnBorder": "1px solid #FF6A00"
}
}Configuration items
Custom page colors: You can provide color values for various UI components to replace the default colors.
Custom icons: You can provide custom icons or image resources to replace the default ones. The size and position of the icons remain unchanged.
Custom frame styles: You can provide custom resource files to replace the default ones. The size and position of the frames remain unchanged.
Module page | Element | Description | Configuration item | Description of the configuration item |
Guide page | Sample image | Customers can replace the sample image. | |
|
Button background color/Button font color | None | |
| |
Certificate capture page | Back button icon/Upload image icon | None | |
|
Upload text style | None | | The color of the upload text. Default value: | |
Submit button style | None | |
| |
Pop-up window style customization | Distance from the top | None | | The distance from the top of the pop-up window. Default value: |
Distance from the left | None | | The distance from the left of the pop-up window. Default value: | |
Width | None | | The width of the pop-up window. Default value: | |
Primary button style:
| None | |
| |
Secondary button style:
| None | |
|