[Libreoffice-bugs] [Bug 156182] FORMATTING Automatic text color can be unreadable with darker cell colors

2023-07-12 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=156182

Heiko Tietze  changed:

   What|Removed |Added

 CC||noelgran...@gmail.com
   Assignee|libreoffice-b...@lists.free |heiko.tietze@documentfounda
   |desktop.org |tion.org
   See Also||https://bugs.documentfounda
   ||tion.org/show_bug.cgi?id=61
   ||993
 Status|UNCONFIRMED |ASSIGNED
 Ever confirmed|0   |1

--- Comment #5 from Heiko Tietze  ---
Color was changed for bug 61993 (the ticket mentions the suggested calculation
of relative luma) and the threshold modified later with
https://gerrit.libreoffice.org/c/core/+/117383 "to match Ubuntu" (and some
unrelated changes in https://gerrit.libreoffice.org/c/core/+/105526).

Going to submit a tentative patch.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 156182] FORMATTING Automatic text color can be unreadable with darker cell colors

2023-07-10 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=156182

--- Comment #4 from Heiko Tietze  ---
Created attachment 188297
  --> https://bugs.documentfoundation.org/attachment.cgi?id=188297=edit
Playground

Here is a macro to play with the various approaches. Not only the calculation
makes a difference but also the threshold. My personal favorite is the quick
and dirty #5.

We have two functions implemented, isDark() and isBright(), both taking the
luminance into account with thresholds <=62 and >=245 resp. In between is
neither dark nor bright and I cannot assess the implications (beside the
positive effect on all the isDark() cases).

Sub Main
Doc = ThisComponent
Sheets=Doc.Sheets
Sheet=Sheets.getByName("sheet1")
Dim aColor
Dim aLum as Double

Formula = 5

for i = 0 to 11
 for j = 0 to 9
Cell=sheet.getcellByposition(i,j)
aColor = Cell.CellBackColor

Select Case Formula 
 Case 0 REM current implementation in color.hxx
aLum = (Red(aColor) * 76 + Green(aColor) * 151 +
Blue(aColor) * 29) / 256
Threshold = 62
 Case 1 REM Photometric/digital ITU BT.709:
https://stackoverflow.com/questions/596216/formula-to-determine-perceived-brightness-of-rgb-color
aLum = Red(aColor) * 0.2126 + Green(aColor) * 0.7152 +
Blue(aColor) * 0.0722
Threshold = 150
 Case 2 REM Digital ITU BT.601
aLum = Red(aColor) * 0.299 + Green(aColor) * 0.587 +
Blue(aColor) * 0.114
Threshold = 150
 Case 3 REM http://alienryderflex.com/hsp.html
aLum = sqr( (Red(aColor)/255)^2 * 0.299 +
(Green(aColor)/255)^2 * 0.587 + (Blue(aColor)/255)^2 * 0.114 )
Threshold = 0.6
 Case 4 REM Andy's Down and Dirty Version;
https://stackoverflow.com/questions/71410478/what-is-the-constant-k-in-calculating-the-luminance
aLum = sqr( (Red(aColor)/255)^2.2 * 0.2126 +
(Green(aColor)/255)^2.2 * 0.7152 + (Blue(aColor)/255)^2.2 * 0.0722 )
Threshold = 0.6
 Case 5 REM https://www.w3.org/TR/AERT/#color-contrast
aLum = (Red(aColor) * 299 + Green(aColor) * 587 +
Blue(aColor) * 114) / 1000
Threshold = 150
end select

if (aLum > Threshold) then
Cell.CharColor = RGB(0,0,0)
else   
Cell.CharColor = RGB(255,255,255)  
end if   

 next j
next i

End Sub

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 156182] FORMATTING Automatic text color can be unreadable with darker cell colors

2023-07-07 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=156182

Michael Weghorn  changed:

   What|Removed |Added

 CC||m.wegh...@posteo.de
   Keywords||accessibility

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 156182] FORMATTING Automatic text color can be unreadable with darker cell colors

2023-07-07 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=156182

V Stuart Foote  changed:

   What|Removed |Added

 CC||vsfo...@libreoffice.org
 Blocks||142074
   See Also||https://bugs.documentfounda
   ||tion.org/show_bug.cgi?id=15
   ||5745

--- Comment #3 from V Stuart Foote  ---
Similar is handling (or lack of it) of fg/bg contrast of the Edit cursor, as in
see also bug 155745


Referenced Bugs:

https://bugs.documentfoundation.org/show_bug.cgi?id=142074
[Bug 142074] [META] Application Colours settings bugs and enhancements
-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 156182] FORMATTING Automatic text color can be unreadable with darker cell colors

2023-07-07 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=156182

Heiko Tietze  changed:

   What|Removed |Added

 CC||libreoffice-ux-advise@lists
   ||.freedesktop.org

--- Comment #2 from Heiko Tietze  ---
Most if not all automatic colors are set by checking whether the background is
dark. It is implemented in include/tools/color.hxx as 

bool IsDark() const
{
//  62 is the number that means it also triggers on Ubuntu in dark mode
return GetLuminance() <= 62;
}

bool IsBright() const
{
return GetLuminance() >= 245;
}

And luminance is sal_uInt8((B * 29UL + G * 151UL + R * 76UL) >> 8);

I wonder how this luminance value relates to your calculation, that apparently
is much better dealing with the contrast.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 156182] FORMATTING Automatic text color can be unreadable with darker cell colors

2023-07-06 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=156182

ady  changed:

   What|Removed |Added

   Keywords||needsUXEval

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Libreoffice-bugs] [Bug 156182] FORMATTING Automatic text color can be unreadable with darker cell colors

2023-07-06 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=156182

--- Comment #1 from Myndex  ---
Created attachment 188235
  --> https://bugs.documentfoundation.org/attachment.cgi?id=188235=edit
An image showing examples of how automatic text color issues and solution

See first post for description.

-- 
You are receiving this mail because:
You are the assignee for the bug.