TIP 403: Web Colors for Tk

Login
FlightAware bounty program for improvements to Tcl and certain Tcl packages.
Author:         Jan Nijtmans <jan.nijtmans@users.sf.net>
State:          Final
Type:           Project
Vote:           Done
Created:        17-Jul-2011
Post-History:   
Discussions-To: Tcl Core list
Keywords:       Tk
Tcl-Version:    8.6

Abstract

This TIP proposes some modifications in the RGB values of various colors as used in Tk, bringing those colors more in line with various W3C standards.

Rationale

There is a difference between the color definitions in X11 and the color definitions in Web standards like html and css. For example HTML4 defines the basic color names aqua, fuchsia, lime, olive, silver and teal, which are currently not known to Tk. Making things worse, some colors like green and gray have a different RGB value in X11 compared to the html4 specification. See: http://www.w3.org/TR/css3-color/\#html4

Specification

This document proposes:

  • Add the colors aqua, crimson, fuchsia, indigo, lime, olive, silver and teal to the list of recognised colors, both for win32 and X11. For X11 it will be built in the wrapper function TkParseColor, which is a thin wrapper around XParseColor. The RGB values used are those from the above mentioned html4 specification (6 from the basic colors, 2 from the extended colors).

  • Modify the RGB values of gray/grey, green, maroon and purple matching the html4 specification. Those 4 colors are the only ones that differ in X11. Applications using those colors will change in visible appearance.

    POTENTIAL INCOMPATIBILITY

Compatibility

On the script level nothing changes, only applications one or more colors from the list gray, grey, green, maroon and purple will change in visible appearance. A side-by-side visible difference between those 4 colors can be seen at: http://en.wikipedia.org/wiki/X11\_color\_names\#Color\_name\_clashes

Alternatives

None

Reference Implementation

A reference implementation is available at http://core.tcl.tk/tk in branch jn-web-colors. It contains a test-case color-1.5, which checkes the RGB values of all known X11 colors with the above modifications. This test is marked nonPortable, simply because I don't know how many older X11 color lists are still in use. On win32, mac and any reasonable recent X11 package, this test passes.

Copyright

This document has been placed in the public domain.