summaryrefslogtreecommitdiffstats
path: root/extensions/common/image_util.h
blob: 2efdafd0ad19d2e22b0427d2fe7cc7353bbce43f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef EXTENSIONS_COMMON_IMAGE_UTIL_H_
#define EXTENSIONS_COMMON_IMAGE_UTIL_H_

#include <string>

typedef unsigned int SkColor;

// This file contains various utility functions for extension images and colors.
namespace extensions {
namespace image_util {

// Parses a CSS-style color string from hex (3- or 6-digit) or HSL(A) format.
// Returns true on success.
bool ParseCssColorString(const std::string& color_string, SkColor* result);

// Parses a string like #FF9982 or #EEE to a color. Returns true for success.
bool ParseHexColorString(const std::string& color_string, SkColor* result);

// Creates a string like #FF9982 from a color.
std::string GenerateHexColorString(SkColor color);

// Parses hsl() or hsla() string to a SkColor. Returns true for success.
bool ParseHslColorString(const std::string& color_string, SkColor* result);

}  // namespace image_util
}  // namespace extensions

#endif  // EXTENSIONS_BROWSER_IMAGE_UTIL_H__