hello there,<br><br>i don't know it the problem is still known but the following i figured yesterday:<br><br>when using the class method <br>Color>>fromString: 'yellow'<br><br>or also<br>Color>>fromString: 'orange'
<br><br>you will always get the hex-value of black. so i figured the following mistake<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
aString first = $#<br> ifTrue: [aColorHex := aString copyFrom: 2 to: aString size]<br> ifFalse: [aColorHex := aString].<br> [aColorHex size = 6<br> ifTrue:<br> [aColorHex := aColorHex asUppercase.
<br> red := ('16r', (aColorHex copyFrom: 1 to: 2)) asNumber/255.<br> green := ('16r', (aColorHex copyFrom: 3 to: 4)) asNumber/255.<br> blue := ('16r', (aColorHex copyFrom: 5 to: 6)) asNumber/255.
<br> ^ self r: red g: green b: blue]]</blockquote><div><br>u see: aColorHex will be aString when there is no '#' within the string. but when the string has just the size of 6 (like it is given with 'yellow' or 'orange' then the statement will also be true. in fact of that you get a wrong hex for the right color :)
<br><br>i just tried the following<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">aString first = $#<br> ifTrue: [aColorHex := (aString copyFrom: 2 to: aString size) asNumber]
<br> ifFalse: [aColorHex := aString].<br> [(aColorHex isNumber)<br> ifTrue:<br> [aColorHex := aColorHex asUppercase.<br> red := ('16r', (aColorHex copyFrom: 1 to: 2)) asNumber/255.<br>
green := ('16r', (aColorHex copyFrom: 3 to: 4)) asNumber/255.<br> blue := ('16r', (aColorHex copyFrom: 5 to: 6)) asNumber/255.<br> ^ self r: red g: green b: blue]]</blockquote><div><br>but in fact i couldn't test it very deeply i don't know if it still serves well when using hex-colors higher then 10 (
e.g. A1 or FF)<br>there is also the problem that asHex is deprecated - so i can't use it instead.<br><br>thx for your patience :)<br></div><br> </div><br>