Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2601

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/01/2601/1

Change definition of "dark" colour for fdo#61993

- Increase the threshold for "dark" colours from Luminosity<=38 to
  Luminosity<=60.

  This makes LibreOffice align more closely with MS Word when
  considering whether "automatic" font colour should be black or white,
  a decision that is based on whether the background colour is "dark".

  Beware that this also affects other areas.

- Fix the coefficients for GetLuminosity which appeared to be off
  by one according to the "Rec 601" coefficients for Luma quoted at
  http://en.wikipedia.org/wiki/Luma_%28video%29

Change-Id: I0af1f77909713e3db5ea8ee98456146569679594
---
M tools/inc/tools/color.hxx
M tools/source/generic/color.cxx
2 files changed, 3 insertions(+), 3 deletions(-)



diff --git a/tools/inc/tools/color.hxx b/tools/inc/tools/color.hxx
index 823f341..911088b 100644
--- a/tools/inc/tools/color.hxx
+++ b/tools/inc/tools/color.hxx
@@ -198,9 +198,9 @@
 
 inline sal_uInt8 Color::GetLuminance() const
 {
-    return( (sal_uInt8) ( ( COLORDATA_BLUE( mnColor ) * 28UL +
+    return( (sal_uInt8) ( ( COLORDATA_BLUE( mnColor ) * 29UL +
                         COLORDATA_GREEN( mnColor ) * 151UL +
-                        COLORDATA_RED( mnColor ) * 77UL ) >> 8UL ) );
+                        COLORDATA_RED( mnColor ) * 76UL ) >> 8UL ) );
 }
 
 inline void Color::Merge( const Color& rMergeColor, sal_uInt8 cTransparency )
diff --git a/tools/source/generic/color.cxx b/tools/source/generic/color.cxx
index 33e6aff..a6a8084 100644
--- a/tools/source/generic/color.cxx
+++ b/tools/source/generic/color.cxx
@@ -102,7 +102,7 @@
 
 sal_Bool Color::IsDark() const
 {
-    return GetLuminance() <= 38;
+    return GetLuminance() <= 60;
 }
 
 sal_Bool Color::IsBright() const

-- 
To view, visit https://gerrit.libreoffice.org/2601
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0af1f77909713e3db5ea8ee98456146569679594
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Luke Deller <luke@deller.id.au>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.