layout/base/nsCSSColorUtils.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 /* functions that manipulate colors */
     8 #ifndef __nsCSSColorUtils_h
     9 #define __nsCSSColorUtils_h
    11 #include "nsColor.h"
    13 // "Sufficient contrast" is determined by
    14 // "Techniques For Accessibility Evalution And Repair Tools".
    15 // See http://www.w3.org/TR/AERT#color-contrast
    16 #define NS_SUFFICIENT_LUMINOSITY_DIFFERENCE 125000
    17 #define NS_LUMINOSITY_DIFFERENCE(a, b) \
    18           int32_t(mozilla::Abs(NS_GetLuminosity(a) - NS_GetLuminosity(b)))
    20 // To determine colors based on the background brightness and border color
    21 void NS_GetSpecial3DColors(nscolor aResult[2],
    22                            nscolor aBackgroundColor,
    23                            nscolor aBorderColor);
    25 // Determins brightness for a specific color
    26 int NS_GetBrightness(uint8_t aRed, uint8_t aGreen, uint8_t aBlue);
    28 // Get Luminosity of a specific color. That is same as Y of YIQ color space.
    29 // The range of return value is 0 to 255000.
    30 int32_t NS_GetLuminosity(nscolor aColor);
    32 // function to convert from RGBA color space to HSVA color space 
    33 void NS_RGB2HSV(nscolor aColor, uint16_t &aHue, uint16_t &aSat,
    34                 uint16_t &aValue, uint8_t &aAlpha);
    36 // function to convert from HSVA color space to RGBA color space 
    37 void NS_HSV2RGB(nscolor &aColor, uint16_t aHue, uint16_t aSat, uint16_t aValue,
    38                 uint8_t aAlpha);
    40 #endif

mercurial