Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8701] Android: Color "brown" is not supported

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-02-27T22:03:16.000+0000
Affected Version/sRelease 1.8.2
Fix Version/sRelease 3.1.0, 2013 Sprint 05 API, 2013 Sprint 05
ComponentsAndroid
Labelsapi, exalture, module_window, parity, qe-testadded
ReporterPaul Dowsett
AssigneeSunila
Created2012-04-12T10:15:29.000+0000
Updated2013-06-19T10:22:34.000+0000

Description

Problem

Web color name brown is not supported, despite it being included in the [HTML color names](http://en.wikipedia.org/wiki/Web_colors#HTML_color_names) standard, and also supposedly-supported by iOS, according to the [Webcolor.m](https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/Webcolor.m) code.

Test case

Run this code to test each color name in turn, by clicking the window.
// According to the following test case:
// Android does not currently support: brown. The color yellow is used when a name is not recognised.
// iOS does not currently support: aqua, fuchsia, lime and maroon.  The color black is used when a name is not recognised.

// stripped for tableview background color still to be tested

var webcolor = [
  'black', 'gray', 'darkgray', 'lightgray', 'white', 'red', 'green', 'blue', 'cyan', 'yellow',
  'magenta', 'orange', 'purple', 'brown', 'transparent',
  'aqua', 'fuchsia', 'lime', 'maroon', 'pink', 'navy', 'silver', 'olive', 'teal'];

var webcolorPointer = 0;

var win = Ti.UI.createWindow({
  backgroundColor: webcolor[webcolorPointer],
  exitOnClose: true,
  fullscreen: false,
  layout: 'vertical',
  title: 'Webcolor Demo'
});

var label = Ti.UI.createLabel({
  backgroundColor: 'white',
  text: webcolor[webcolorPointer]
});
webcolorPointer++;

win.add(label);

// click window to iterate through color array
win.addEventListener('click', function(e){
  e.source.backgroundColor = webcolor[webcolorPointer];
  label.text = webcolor[webcolorPointer];
  webcolorPointer++;
  if(webcolorPointer === webcolor.length){
    webcolorPointer = 0;
  }
});

win.open();

Comments

  1. Vishal Duggal 2013-02-21

    IOS definition + (UIColor *)brownColor; // 0.6, 0.4, 0.2 RGB
  2. Sunila 2013-02-27

    https://github.com/appcelerator/titanium_mobile/pull/3912
  3. Paras Mishra 2013-03-12

    Every color mentioned above is being displayed on the run including Brown color. Verified on: Device : Google Nexus, Android Version: 4.1 SDK version: 3.1.0.v20130311192922 CLI version : 3.0.24 OS : MAC OSX 10.7.5 XCode : 4.5.1

JSON Source