- this.__styleSheet.set(function(x) {
- return x.setHue(hue).setSaturation(x.hsb[1] + saturation).setBrightness(x.hsb[2] + lightness);
- });
+
+ var back = {hue: this.__styleValues.hue, lightness: this.__styleValues.lightness, saturation: this.__styleValues.saturation};
+ var front = {hue: this.__styleValues.textHue, lightness: this.__styleValues.textLightness, saturation: this.__styleValues.textSaturation};
+
+ if(!this.__styleValues.textHue && !this.__styleValues.textLightness && !this.__styleValues.textSaturation)
+ front = back;
+
+ var colours = {
+ back: back,
+ front: front
+ };
+
+ this.__styleSheet.set(function() {
+ var mode = arguments[0];
+ if(mode == "c") {
+ var t = colours[arguments[2]];
+ var x = new Color(arguments[1]);
+ var c = x.setHue(t.hue).setSaturation(x.hsb[1] + t.saturation).setBrightness(x.hsb[2] + t.lightness);
+ if(c == "255,255,255") /* IE confuses white with transparent... */
+ c = "255,255,254";
+
+ return "rgb(" + c + ")";
+ } else if(mode == "o") {
+ return this.uiOptions[arguments[1]] ? arguments[2] : arguments[3];
+ }
+ }.bind(this));