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

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

Issue 11263040: Make String.charCodes a getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status files with co19 issue number. Created 8 years, 1 month 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/chat/chat_server_lib.dart ('k') | samples/markdown/markdown.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' as Math; 6 import 'dart:math' as Math;
7 7
8 class Color { 8 class Color {
9 int hue; 9 int hue;
10 double saturation; 10 double saturation;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 return new Color((h.round() % 360).toInt(), s, l); 45 return new Color((h.round() % 360).toInt(), s, l);
46 } 46 }
47 47
48 factory Color.hex(String hex) => new Color.rgb( 48 factory Color.hex(String hex) => new Color.rgb(
49 _parseHex(hex.substring(1, 3))/255, 49 _parseHex(hex.substring(1, 3))/255,
50 _parseHex(hex.substring(3, 5))/255, 50 _parseHex(hex.substring(3, 5))/255,
51 _parseHex(hex.substring(5, 7))/255); 51 _parseHex(hex.substring(5, 7))/255);
52 52
53 // This should be in the core library. Issue #233 53 // This should be in the core library. Issue #233
54 static int _parseHex(String hex) { 54 static int _parseHex(String hex) {
55 final codes = hex.charCodes(); 55 final codes = hex.charCodes;
56 var number = 0; 56 var number = 0;
57 for (var i = 0; i < codes.length; i++) { 57 for (var i = 0; i < codes.length; i++) {
58 final code = codes[i]; 58 final code = codes[i];
59 var digit; 59 var digit;
60 if (code >= 48 && code <= 57) { // 0-9 60 if (code >= 48 && code <= 57) { // 0-9
61 digit = code - 48; 61 digit = code - 48;
62 } else if (code >= 97 && code <= 102) { // a-f 62 } else if (code >= 97 && code <= 102) { // a-f
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'";
(...skipping 123 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/chat/chat_server_lib.dart ('k') | samples/markdown/markdown.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698