| Index: ui/gfx/color_utils.cc
|
| diff --git a/ui/gfx/color_utils.cc b/ui/gfx/color_utils.cc
|
| index e35d7b33fb8dc8576969c3908e2da96541060f3a..95dea0936c0fc4d35494ef7ed8e450b7873c013f 100644
|
| --- a/ui/gfx/color_utils.cc
|
| +++ b/ui/gfx/color_utils.cc
|
| @@ -11,6 +11,8 @@
|
|
|
| #include "base/logging.h"
|
| #include "base/numerics/safe_conversions.h"
|
| +#include "base/strings/string_number_conversions.h"
|
| +#include "base/strings/stringprintf.h"
|
| #include "build/build_config.h"
|
| #include "third_party/skia/include/core/SkBitmap.h"
|
| #include "ui/gfx/color_palette.h"
|
| @@ -347,4 +349,17 @@ SkColor DeriveDefaultIconColor(SkColor text_color) {
|
| static_cast<int>(0.8f * SkColorGetA(text_color)));
|
| }
|
|
|
| +std::string SkColorToRgbaString(SkColor color) {
|
| + // We convert the alpha using DoubleToString because StringPrintf will use
|
| + // locale specific formatters (e.g., use , instead of . in German).
|
| + return base::StringPrintf(
|
| + "rgba(%s,%s)", SkColorToRgbString(color).c_str(),
|
| + base::DoubleToString(SkColorGetA(color) / 255.0).c_str());
|
| +}
|
| +
|
| +std::string SkColorToRgbString(SkColor color) {
|
| + return base::StringPrintf("%d,%d,%d", SkColorGetR(color), SkColorGetG(color),
|
| + SkColorGetB(color));
|
| +}
|
| +
|
| } // namespace color_utils
|
|
|