color_util.h 755 B

1234567891011121314151617181920212223242526
  1. // Copyright (c) 2016 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ELECTRON_SHELL_COMMON_COLOR_UTIL_H_
  5. #define ELECTRON_SHELL_COMMON_COLOR_UTIL_H_
  6. #include <string>
  7. #include "third_party/skia/include/core/SkColor.h"
  8. namespace electron {
  9. // Parses a CSS-style color string from hex, rgb(), rgba(),
  10. // hsl(), hsla(), or color name formats.
  11. SkColor ParseCSSColor(const std::string& color_string);
  12. // Convert color to RGB hex value like "#RRGGBB".
  13. std::string ToRGBHex(SkColor color);
  14. // Convert color to RGBA hex value like "#RRGGBBAA".
  15. std::string ToRGBAHex(SkColor color, bool include_hash = true);
  16. } // namespace electron
  17. #endif // ELECTRON_SHELL_COMMON_COLOR_UTIL_H_