Browse files

small RGB input problem fix

  • Loading branch information...
1 parent f85659e commit cd172e48938b9dd5aef3b8f5942d7644b4a69837 Max Degterev committed Mar 19, 2012
Showing with 15 additions and 11 deletions.
  1. +9 −6 javascript/javascript.js
  2. +6 −5 test_math.html
View
15 javascript/javascript.js
@@ -166,12 +166,15 @@ window.cssMath = {
},
/* String to Hexadecimals */
s2Hex: function (value, allValues) {
- if (value.indexOf('rgb') > -1) {
- return '#' + cssMath.da2ha(value.replace(/^rgb\s?\(\s?(.*?)\s?\)$/, '$1').split(/,\s?/)).join('');
- }
- else {
- return cssMath.h2lh(value);
- }
+ // if (value.indexOf('rgb') > -1) {
+ // return '#' + cssMath.da2ha(value.replace(/^rgb\s?\(\s?(.*?)\s?\)$/, '$1').split(/,\s?/)).join('');
+ // }
+ // else {
+ // return cssMath.h2lh(value);
+ // }
+
+ // No messing with RGB(A) here - let user decide what's best
+ return cssMath.h2lh(value);
},
// dont include an AA in this hex
shortHex : function (value, allValues) {
View
11 test_math.html
@@ -197,11 +197,12 @@
'cssMath.s2c(\'#CCFF33FF\', 1)', 'returns: ', cssMath.s2c('#CCFF33FF'), '\n'
);
-console.log(
- 'Testing s2xm: function (s)', '\n',
- 'String to channels, hexadecimals, or units Moved', '\n',
- 'cssMath.s2xm(\'FFFEFF\', 1)', 'returns: ', cssMath.s2xm('FFFEFF', 1), '\n'
-);
+// No such function in javascript.js - not sure if this test is relevant
+// console.log(
+// 'Testing s2xm: function (s)', '\n',
+// 'String to channels, hexadecimals, or units Moved', '\n',
+// 'cssMath.s2xm(\'FFFEFF\', 1)', 'returns: ', cssMath.s2xm('FFFEFF', 1), '\n'
+// );
</script>
</head>

0 comments on commit cd172e4

Please sign in to comment.