diff options
author | dante <dante19031999@gmail.com> | 2020-11-20 12:33:57 +0100 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-11-21 07:17:26 +0100 |
commit | fcc9128aabb56d521e71e3e537d895e640c86004 (patch) | |
tree | 70b2058a2dd23b44b328da806243cb16c6df255a /include | |
parent | d0a60f7785dc66e0d491b50e093ebcf606627226 (diff) |
Changes to the color class
Before colors could be only converted to string rrggbb. Now also supports RRGGBB. It can also be converted back into a color.
Change-Id: Ifb89d554b434c243c4f0956ee680ec23de823339
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106224
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/tools/color.hxx | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/include/tools/color.hxx b/include/tools/color.hxx index dfa84d255dbc..99966c65d779 100644 --- a/include/tools/color.hxx +++ b/include/tools/color.hxx @@ -333,6 +333,19 @@ public: */ static Color HSBtoRGB(sal_uInt16 nHue, sal_uInt16 nSaturation, sal_uInt16 nBrightness); + /** Converts a string into a color. Supports: + * #RRGGBB + * #rrggbb + * #RGB + * #rgb + * RRGGBB + * rrggbb + * RGB + * rgb + * If fails returns Color(). + */ + static Color STRtoRGB(const OUString& colorname); + /** Color space conversion tools * @param nHue * @param nSaturation @@ -340,12 +353,18 @@ public: */ void RGBtoHSB(sal_uInt16& nHue, sal_uInt16& nSaturation, sal_uInt16& nBrightness) const; - /* Return color as RGB hex string + /* Return color as RGB hex string: rrggbb * for example "00ff00" for green color * @return hex string */ OUString AsRGBHexString() const; + /* Return color as RGB hex string: RRGGBB + * for example "00FF00" for green color + * @return hex string + */ + OUString AsRGBHEXString() const; + /* get ::basegfx::BColor from this color * @return basegfx color */ |