The Trunk: Graphics-nice.192.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Graphics-nice.192.mcz

commits-2
Nicolas Cellier uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-nice.192.mcz

==================== Summary ====================

Name: Graphics-nice.192
Author: nice
Time: 20 February 2012, 7:30:30.765 pm
UUID: 47abe0e7-0db5-4c46-9fc2-b01316877379
Ancestors: Graphics-cmm.191

Fix one of the issues at http://code.google.com/p/pharo/issues/detail?id=5335

self assert: (Color fromString: 'darkGray') = Color darkGray.

=============== Diff against Graphics-cmm.191 ===============

Item was changed:
  ----- Method: Color class>>fromString: (in category 'instance creation') -----
  fromString: aString
  "for HTML color spec: #FFCCAA or white/black"
  "Color fromString: '#FFCCAA'.
  Color fromString: 'white'.
  Color fromString: 'orange'"
 
  | aColorHex |
  aString isEmptyOrNil ifTrue: [ ^self white ].
  aString first = $#
  ifTrue: [ aColorHex := aString allButFirst ]
  ifFalse: [ aColorHex := aString ].
  (aColorHex size = 6 and: [
  aColorHex allSatisfy: [ :each | '0123456789ABCDEFabcdef' includes: each ] ])
  ifTrue: [
  | green red blue |
  red := (Integer readFrom: (aColorHex first: 2) base: 16) / 255.
  green := (Integer readFrom: (aColorHex copyFrom: 3 to: 4) base: 16) / 255.
  blue := (Integer readFrom: (aColorHex last: 2) base: 16) / 255.
  ^self r: red g: green b: blue ].
+ "try to match aColorHex with known named colors, case insensitive"
+ ^self perform: (ColorNames detect: [:colorSymbol | aColorHex sameAs: colorSymbol] ifNone: [ #white ])!
- "try to match aColorHex with known named colors"
- ^self perform: (ColorNames like: aColorHex asLowercase ifAbsent: [ #white ])!