Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Side by Side Diff: samples/logo/logo.dart

Issue 10919146: Get rid of a lot of () for getters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « samples/leap/leap_script.dart ('k') | samples/maps/js.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #import('dart:html'); 5 #import('dart:html');
6 #import('dart:math', prefix: 'Math'); 6 #import('dart:math', prefix: 'Math');
7 7
8 class Color { 8 class Color {
9 int hue; 9 int hue;
10 double saturation; 10 double saturation;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 digit = code - 97 + 10; 63 digit = code - 97 + 10;
64 } else { 64 } else {
65 throw "Invalid hex string: '$hex'"; 65 throw "Invalid hex string: '$hex'";
66 } 66 }
67 number *= 16; // shift previous digits left one place 67 number *= 16; // shift previous digits left one place
68 number += digit; 68 number += digit;
69 } 69 }
70 return number; 70 return number;
71 } 71 }
72 72
73 String get hex() { 73 String get hex {
74 final h = (hue % 360) / 360; 74 final h = (hue % 360) / 360;
75 final s = saturation; 75 final s = saturation;
76 final l = lightness; 76 final l = lightness;
77 77
78 // HSL to RGB algorithm from the CSS spec 78 // HSL to RGB algorithm from the CSS spec
79 // http://www.w3.org/TR/css3-color/#hsl-color 79 // http://www.w3.org/TR/css3-color/#hsl-color
80 final m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s; 80 final m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
81 final m1 = l * 2 - m2; 81 final m1 = l * 2 - m2;
82 final r = _hueToRgb(m1, m2, h + 1/3); 82 final r = _hueToRgb(m1, m2, h + 1/3);
83 final g = _hueToRgb(m1, m2, h); 83 final g = _hueToRgb(m1, m2, h);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 document.query("input[name=invert]").on.change.add((Event e) { 190 document.query("input[name=invert]").on.change.add((Event e) {
191 InputElement invert = e.target; 191 InputElement invert = e.target;
192 if (invert.checked) { 192 if (invert.checked) {
193 logo.classes = ['inverse']; 193 logo.classes = ['inverse'];
194 } else { 194 } else {
195 logo.classes = []; 195 logo.classes = [];
196 } 196 }
197 }); 197 });
198 } 198 }
OLDNEW
« no previous file with comments | « samples/leap/leap_script.dart ('k') | samples/maps/js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698