Revision: 4837
http://sourceforge.net/p/vexi/code/4837
Author: mkpg2
Date: 2015-12-19 19:32:11 +0000 (Sat, 19 Dec 2015)
Log Message:
-----------
Fix. Make getReadableColor support named colors.
Modified Paths:
--------------
branches/vexi3/org.vexi-core.main/src/main/jpp/org/vexi/core/Vexi.jpp
branches/vexi3/org.vexi-vexi.widgets/src_main/vexi/util/color.t
Modified: branches/vexi3/org.vexi-core.main/src/main/jpp/org/vexi/core/Vexi.jpp
===================================================================
--- branches/vexi3/org.vexi-core.main/src/main/jpp/org/vexi/core/Vexi.jpp
2015-12-19 06:32:58 UTC (rev 4836)
+++ branches/vexi3/org.vexi-core.main/src/main/jpp/org/vexi/core/Vexi.jpp
2015-12-19 19:32:11 UTC (rev 4837)
@@ -342,7 +342,6 @@
case "ui.mouse": return getSub(name);
case "ui.screen": return getSub(name);
case "ui.loadImage": return METHOD;
-
case "desktop": return org.vexi.plat.Desktop.get();
/* The version of the current Vexi core
* @type(String)
@@ -473,7 +472,8 @@
* @initial_value(#000000)
* @type(String) */
case "ui.textcolor": return
JSU.S(Color.colorToString(BoxVisual.DEFAULT_COLOR));
-
+ case "ui.colorAsHex": return METHOD;
+
/* <p>The current default fontsize, in points.</p>
*
* <p>put to this property adjust all boxes whose fontsize is set to
<code>"medium"</code>
@@ -803,7 +803,9 @@
return ret;
case "ui.loadImage":
Picture.load(args);
- return null;
+ return null;
+ case "ui.colorAsHex":
+ return
JSU.S(Color.colorToString(Color.stringToColor(JSU.toString(args[0]))));
case "unclone": return args[0].unclone();
//#end
break;
Modified: branches/vexi3/org.vexi-vexi.widgets/src_main/vexi/util/color.t
===================================================================
--- branches/vexi3/org.vexi-vexi.widgets/src_main/vexi/util/color.t
2015-12-19 06:32:58 UTC (rev 4836)
+++ branches/vexi3/org.vexi-vexi.widgets/src_main/vexi/util/color.t
2015-12-19 19:32:11 UTC (rev 4837)
@@ -29,7 +29,14 @@
var r = readable[c];
if (r) return r;
- if (c.charAt(0)!='#') throw "Color must be in hex format";
+ if (c.charAt(0)!='#'){
+ c = vexi.ui.colorAsHex(c);
+ if (c.charAt(0)!='#'){
+ throw "Not a valid color '"+c+"'";
+ }
+ }
+
+
r = vexi.string.parseInt(c.substring(1,3), 16)
+ vexi.string.parseInt(c.substring(3,5), 16)
+ vexi.string.parseInt(c.substring(5,7), 16);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
Vexi-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vexi-svn