diff --git a/interfaces/kits/napi/window_runtime/window_napi/js_window_utils.cpp b/interfaces/kits/napi/window_runtime/window_napi/js_window_utils.cpp index 7e863d93..663b8198 100644 --- a/interfaces/kits/napi/window_runtime/window_napi/js_window_utils.cpp +++ b/interfaces/kits/napi/window_runtime/window_napi/js_window_utils.cpp @@ -174,8 +174,8 @@ static uint32_t GetColorFromJs(NativeEngine& engine, NativeObject* jsObject, } WLOGFI("origin color: %{public}s", colorStr.c_str()); std::string color = colorStr.substr(1); - if (colorStr.length() == RGB_LENGTH) { - colorStr = "FF" + colorStr; // ARGB + if (color.length() == RGB_LENGTH) { + color = "FF" + color; // ARGB } std::stringstream ss; uint32_t hexColor;