/** * 设置状态栏颜色 * @param color */ export function setStatusBarColor(color: string) { let windowClass: window.Window | undefined = undefined; try { let promise = window.getLastWindow(getContext()); promise.then((data) => { windowClass = data; windowClass.setWindowSystemBarProperties({ statusBarColor: color, statusBarContentColor: color, navigationBarColor: color, navigationBarContentColor: color }) console.info('Succeeded in obtaining the top window. Data: ' + JSON.stringify(data)); }).catch((err: BusinessError) => { console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(err)); }); } catch (exception) { console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(exception)); } }将颜色设置改位6位的模式,比如红色改“\#ff0000”
将颜色设置改位6位的模式,比如红色改“\#ff0000”