From 9c018744f4f7dc681d65b94832c4e577d987c5d7 Mon Sep 17 00:00:00 2001 From: Jonathon Simister Date: Tue, 9 Jan 2018 11:07:29 -0800 Subject: [PATCH] Fixes hexColorDWORDToRGBA for transparent colors --- atom/browser/api/atom_api_system_preferences_win.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/atom/browser/api/atom_api_system_preferences_win.cc b/atom/browser/api/atom_api_system_preferences_win.cc index 43a2f2fc9447..f9bbd294ee5e 100644 --- a/atom/browser/api/atom_api_system_preferences_win.cc +++ b/atom/browser/api/atom_api_system_preferences_win.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. +#include + #include "atom/browser/api/atom_api_system_preferences.h" #include "atom/common/color_util.h" @@ -26,10 +28,10 @@ bool SystemPreferences::IsAeroGlassEnabled() { } std::string hexColorDWORDToRGBA(DWORD color) { + DWORD rgba = color << 8 | color >> 24; std::ostringstream stream; - stream << std::hex << color; - std::string hexColor = stream.str(); - return hexColor.substr(2) + hexColor.substr(0, 2); + stream << std::hex << std::setw(8) << std::setfill('0') << rgba; + return stream.str(); } std::string SystemPreferences::GetAccentColor() {