Issue 118191

Summary: Red is not red enough
Product: Math Reporter: lapsap7+ooo
Component: uiAssignee: AOO issues mailing list <issues>
Status: CLOSED FIXED QA Contact:
Severity: Normal    
Priority: P3 CC: issues, j.nitschke, knmc, mseidel, oooforum, pescetti, rb.henschel
Version: OOo 3.3   
Target Milestone: 4.2.0   
Hardware: PC   
OS: Windows XP   
Issue Type: PATCH Latest Confirmation in: ---
Developer Difficulty: Easy
Attachments:
Description Flags
Color comparison between what's currently shown and what's suggested in OOO Wiki
none
suggestion of a fix, to render the colors as defined in HTML
none
updated patch as discussed on dev mailing list none

Description lapsap7+ooo 2011-06-18 18:55:05 UTC
Created attachment 76623 [details]
Color comparison between what's currently shown and what's suggested in OOO Wiki

In OOO 3.3 math, when we use "color red", the colour red is not red enough.  In other words, it's not sharp enough; or we could say, the red in usage is too dull.  It looks like more brown than red.

The attachment shows the difference between what's really shown and what's suggested in OOO Wiki at http://wiki.services.openoffice.org/wiki/Documentation/OOo3_User_Guides/Math_Guide/Math_commands_reference#Attributes
Comment 1 lapsap7+ooo 2011-06-28 11:00:07 UTC
And here is another argument where this color problem should be considered as a bug:
The *named colors* do not follow the de facto standard (or convention) in the world out there.

From Unix/Linux's rgb.txt to HTML's color specification:
* http://web.njit.edu/~kevin/rgb.txt.html
* http://www.w3.org/TR/1999/REC-html401-19991224/sgml/loosedtd.html#Color)
for a 8bits/color palette, the simple named colors like red, green, blue are all defined as (255,0,0), (0,255,0) and (0,0,255) respectively.

I really have no idea where they got the idea that red should be (128,0,0) in OOO!!!
Comment 2 Oliver-Rainer Wittmann 2012-06-13 12:33:13 UTC
getting rid of value "enhancement" for field "severity".
For enhancement the field "issue type" shall be used.
Comment 3 Rob Weir 2013-07-30 02:24:24 UTC
Reset assignee on issues not touched by assignee in more than 2000 days.
Comment 4 oooforum (fr) 2014-03-14 15:16:57 UTC
Maybe, this issue should be fixed if #5156 would be implemented.
Comment 5 lapsap7+ooo 2014-03-15 01:34:24 UTC
Could someone at least *confirm* this issue?
Comment 6 j.nitschke 2014-03-15 13:13:36 UTC
why is this a problem with red but not with green, blue, magenta, cyan?
currently we use the following colors in math:

main/starmath/source/node.cxx Line 2126: (color codes from  
main/tools/inc/tools/color.hxx)
> case TBLACK :		SetColor(Color(COL_BLACK));	break; //0x000000
> case TWHITE :		SetColor(Color(COL_WHITE));	break; //0xffffff
> case TRED :		SetColor(Color(COL_RED));	break; //0x800000
> case TGREEN :		SetColor(Color(COL_GREEN));	break; //0x008000
> case TBLUE :		SetColor(Color(COL_BLUE));	break; //0x000080
> case TCYAN :		SetColor(Color(COL_CYAN));	break; //0x008080
> case TMAGENTA :	SetColor(Color(COL_MAGENTA));	break; //0x800080
> case TYELLOW :	SetColor(Color(COL_YELLOW));	break; //0xffff00
Comment 7 Regina Henschel 2014-03-15 14:28:47 UTC
The current code maps StarMath 5.0 to MathML 1.0. The original StarMath 5.0 is only reconstructed using an annotation element. StarMath 5.0 is not part of ODF1.2, but ODF1.2 references to MathML1.0. MathML 1.0 itself references HTML 4.0, which defines the rgb-values of html-color-name.
http://www.w3.org/TR/1998/REC-MathML-19980407/chap3_3.html#sec3.3.4
http://www.w3.org/TR/REC-html40/types.html#h-6.5

ODF1.2 .odf documents can be written without any StarMath 5.0 information. The author of such documents expects, that the formula style is interpreted as defined in MathML 1.0.

Support of the old StarDivision formats are dropped in Apache OpenOffice 4.0.

Taking all that together I support to render the color names using the rgb-values defined in HTML. That would result in this mapping:

StarMath 5.0 --> MathML --> HTML
red --> red --> #FF0000
green --> green --> #008000
magenta --> fuchsia --> #FF00FF
cyan --> aqua --> #00FFFF
yellow --> yellow --> #FFFF00
blue --> blue --> #0000FF
white --> white --> #FFFFFF
black --> black --> #000000

Current implementation sets the colors in /starmath/source/node.cxx from defines in /tools/inc/tools/color.hxx, but do not take the "LIGHT" versions as it should be. The correct mapping can be found in spnVmlColors[] in oox/source/drawingml/color.cxx. But considering the general enhancement request to allow all colors in bug 5156, I suggest to use the "LIGHT" versions for now, to get the correct colors for Math. That would be
red -->  COL_LIGHTRED
magenta --> COL_LIGHTMAGENTA
cyan --> COL_LIGHTCYAN
blue --> COL_LIGHTBLUE
Comment 8 lapsap7+ooo 2014-03-17 11:54:01 UTC
(In reply to j.nitschke from comment #6)
> why is this a problem with red but not with green, blue, magenta, cyan?
> currently we use the following colors in math:

Because it's a very subjective matter, as the title of bug suggests, "Red is not red *enough*".  What is *enough*?  When something is (not) enough to a person, it is not necessarily the case for another one.  For me, the dullness of red is visually too unpleasant while for green and blue, they are still acceptable to my eyes.  Moreover, a title like "Red is not red enough, green is not green enough, blue is not blue enough" would be too annoying :D

Maybe I should have given a more technical bug title :)

But of course, if you could correct all the colors according to Unix/Linux/HTML standard, I'd more than happy :D

PS: OO Math is not the only place where color names does not match color values according to other standard. "red" in OO Write is another example, but I suppose that is another discussion, another bug ;)
Comment 9 Regina Henschel 2014-10-25 18:19:03 UTC
Created attachment 84109 [details]
suggestion of a fix, to render the colors as defined in HTML

As no one answered to my mail, I have decided to adapt the rendering. I have tested the changes on Windows7. So it would be good, if someone has a look at it on other platforms.
I have kept "cyan" and "magenta" as additionial color names, so that older documents open without a ? error. The other color names are now exactly as defined in HTML and rendering is identical to the values written to .mml.
In addition I have enabled "mathcolor" attribute for reading and handle it as "color" for now; "mathcolor" is not written.  In MathML "color" is deprecated in favor of "mathcolor", but further adaption can wait until there is a real need.
Comment 10 lapsap7+ooo 2014-10-29 17:10:17 UTC
(In reply to Regina Henschel from comment #9)
> Created attachment 84109 [details]
> suggestion of a fix, to render the colors as defined in HTML
> 
> As no one answered to my mail, I have decided to adapt the rendering.

I didn't answer because I have no access right to the source code and my comment has no value.  But please go ahead, I'm 100% mentally with you ^_^

So we'll have those 16 standard HTML colors, right?  Great!

There will be a need to update wiki on this.  Need to make a new bug as a reminder?

> I have tested the changes on Windows7. So it would be good, if someone
> has a look at it on other platforms.

Please tell me where to get the setup and I'll have a look.

> I have kept "cyan" and "magenta" as additionial color names, so that older
> documents open without a ? error. The other color names are now exactly as
> defined in HTML and rendering is identical to the values written to .mml.

I'm wondering if OO Math can be programmed to automatically change "cyan" to "aqua" when a user types it in the editor.
Comment 11 Regina Henschel 2014-10-29 18:14:52 UTC
Created attachment 84119 [details]
updated patch as discussed on dev mailing list

Cyan is rendered as aqua now and magenta is rendered as fuchsia. This is consistent with the color names used in number format in Calc.

@lapsap7+ooo:
Yes, this fix implements the 16 basic html-color-names for Math.

To test the patch directly, you would have to build OpenOffice yourself. If you will test the result, you can use the daily builds from the buildbots. But you have to wait some days, it is not committed yet.

I would not change the Wiki, because it is a page for OOo2.0. It should be discussed on the doc@openoffice.apache.org how to get a guide for Apache OpenOffice 4.x
Comment 12 lapsap7+ooo 2014-10-29 19:30:59 UTC
(In reply to Regina Henschel from comment #11)
> Created attachment 84119 [details]
> updated patch as discussed on dev mailing list

In file "03090600.xhp", line 426:
white, silver, gray, white, maroon, red, purple, fuchsia, green, lime, olive, yellow, navy, blue, teal and aqua

should have been

white, silver, gray, black, maroon, red, purple, fuchsia, green, lime, olive, yellow, navy, blue, teal and aqua

But I'd like to suggest either an alphabetical order:
aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white and yellow

or a natural spectral order:
white, silver, gray, black, red, maroon, yellow, olive, lime, green, aqua, teal, blue, navy, fuchsia and purple

On the other hand, I don't see the matching of cyan to aqua and magenta to fuchsia in the "diff".

> Cyan is rendered as aqua now and magenta is rendered as fuchsia. This is
> consistent with the color names used in number format in Calc.

Yes, I understood this.  I was just wondering if OO Math could do like this:
I type in "color cyan " in the editor
As soon as I press the spacebar after the word "cyan", the editor changes it to "aqua" to make user aware that the new name is aqua.

> @lapsap7+ooo:
> Yes, this fix implements the 16 basic html-color-names for Math.
> 
> To test the patch directly, you would have to build OpenOffice yourself. If
> you will test the result, you can use the daily builds from the buildbots.
> But you have to wait some days, it is not committed yet.

I don't have the environment to build the app.  I'd wait the daily build then.

> I would not change the Wiki, because it is a page for OOo2.0. It should be
> discussed on the doc@openoffice.apache.org how to get a guide for Apache
> OpenOffice 4.x

OK, then I'll let you do it :)
Comment 13 Regina Henschel 2014-10-29 21:33:44 UTC
(In reply to lapsap7+ooo from comment #12)
> (In reply to Regina Henschel from comment #11)
> > Created attachment 84119 [details]
> > updated patch as discussed on dev mailing list
> 
> In file "03090600.xhp", line 426:
> white, silver, gray, white, maroon, red, purple, fuchsia, green, lime,
> olive, yellow, navy, blue, teal and aqua
> 
> should have been
> 
> white, silver, gray, black, maroon, red, purple, fuchsia, green, lime,
> olive, yellow, navy, blue, teal and aqua
> 
> But I'd like to suggest either an alphabetical order:
> aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple,
> red, silver, teal, white and yellow
> 
> or a natural spectral order:
> white, silver, gray, black, red, maroon, yellow, olive, lime, green, aqua,
> teal, blue, navy, fuchsia and purple

Thank you for finding this. I'll like the "natural spectral order" and will use that in my next patch version.

> 
> On the other hand, I don't see the matching of cyan to aqua and magenta to
> fuchsia in the "diff".

That is in main/starmath/source/node.cxx, the method SmFontNode::Arrange, in "diff" line#206 and line#207. The color "aqua" is internally called COL_LIGHTCYAN and "fuchsia" is internally called "COL_LIGHTMAGENTA".

> Yes, I understood this.  I was just wondering if OO Math could do like this:
> I type in "color cyan " in the editor
> As soon as I press the spacebar after the word "cyan", the editor changes it
> to "aqua" to make user aware that the new name is aqua.

In theory it would be possible, but it would be much more work, and I would have to learn a lot more about the code to do it.
Comment 14 SVN Robot 2014-10-30 18:41:25 UTC
"regina" committed SVN revision 1635583 into trunk:
#i118191# Red is not red enough
Comment 15 Marcus 2017-05-20 10:45:19 UTC
Reset the assignee to the default "issues@openoffice.apache.org".
Comment 16 oooforum (fr) 2019-10-05 11:39:56 UTC
Patch seems to be commited
Comment 17 lapsap7+ooo 2019-10-09 16:04:08 UTC
(In reply to oooforum (fr) from comment #16)
> Patch seems to be commited

Yes, I confirmed that red, green and blue have the correct hex values according to HTML standard.

Thanks :)