OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 /** | 6 /** |
7 * @fileoverview Specifications for NTP design, and an accessor to presets. | 7 * @fileoverview Specifications for NTP design, and an accessor to presets. |
8 */ | 8 */ |
9 | 9 |
10 var THUMBNAIL_FALLBACK = { | 10 var THUMBNAIL_FALLBACK = { |
11 DOT: 'dot' // Draw single dot. | 11 DOT: 'dot' // Draw single dot. |
12 }; | 12 }; |
13 | 13 |
14 /** | 14 /** |
15 * Specifications for an NTP design (not comprehensive). | 15 * Specifications for an NTP design (not comprehensive). |
16 * | 16 * |
17 * name: A unique identifier for the style. | 17 * name: A unique identifier for the style. |
18 * fontFamily: Font family to use for title and thumbnail <iframe>s. | 18 * fontFamily: Font family to use for title and thumbnail <iframe>s. |
19 * fontSize: Font size to use for the <iframe>s, in px. | 19 * fontSize: Font size to use for the <iframe>s, in px. |
20 * tileWidth: The width of each suggestion tile, in px. | 20 * tileWidth: The width of each suggestion tile, in px. |
21 * tileMargin: Spacing between successive tiles, in px. | 21 * tileMargin: Spacing between successive tiles, in px. |
22 * titleColor: The RRGGBB color of title text. | 22 * titleColor: The RRGGBBAA color of title text. |
23 * titleColorAgainstDark: The RRGGBB color of title text against a dark theme. | 23 * titleColorAgainstDark: The RRGGBBAA color of title text against a dark theme. |
24 * titleTextAlign: (Optional) The alignment of title text. If unspecified, the | 24 * titleTextAlign: (Optional) The alignment of title text. If unspecified, the |
25 * default value is 'center'. | 25 * default value is 'center'. |
26 * titleTextFade: (Optional) The number of pixels beyond which title | 26 * titleTextFade: (Optional) The number of pixels beyond which title |
27 * text begins to fade. This overrides the default ellipsis style. | 27 * text begins to fade. This overrides the default ellipsis style. |
28 * thumbnailTextColor: The RRGGBB color that thumbnail <iframe> may use to | 28 * thumbnailTextColor: The RRGGBBAA color that thumbnail <iframe> may use to |
29 * display text message in place of missing thumbnail. | 29 * display text message in place of missing thumbnail. |
30 * thumbnailFallback: (Optional) A value in THUMBNAIL_FALLBACK to specify the | 30 * thumbnailFallback: (Optional) A value in THUMBNAIL_FALLBACK to specify the |
31 * thumbnail fallback strategy. If unassigned, then the thumbnail.html | 31 * thumbnail fallback strategy. If unassigned, then the thumbnail.html |
32 * <iframe> would handle the fallback. | 32 * <iframe> would handle the fallback. |
33 * showFakeboxHint: Whether to display text in the fakebox. | 33 * showFakeboxHint: Whether to display text in the fakebox. |
34 * | 34 * |
35 * @typedef {{ | 35 * @typedef {{ |
36 * name: string, | 36 * name: string, |
37 * fontFamily: string, | 37 * fontFamily: string, |
38 * fontSize: number, | 38 * fontSize: number, |
(...skipping 17 matching lines...) Expand all Loading... |
56 * @return {NtpDesign} The NTP design corresponding to name. | 56 * @return {NtpDesign} The NTP design corresponding to name. |
57 */ | 57 */ |
58 function getNtpDesign(opt_name) { | 58 function getNtpDesign(opt_name) { |
59 var ntpDesign = null; | 59 var ntpDesign = null; |
60 | 60 |
61 if (opt_name === 'md') { | 61 if (opt_name === 'md') { |
62 ntpDesign = { | 62 ntpDesign = { |
63 name: opt_name, | 63 name: opt_name, |
64 fontFamily: 'arial, sans-serif', | 64 fontFamily: 'arial, sans-serif', |
65 fontSize: 12, | 65 fontSize: 12, |
66 tileWidth: 146, | 66 tileWidth: 156, |
67 tileMargin: 12, | 67 tileMargin: 16, |
68 titleColor: '000000', | 68 titleColor: '323232ff', |
69 titleColorAgainstDark: 'd2d2d2', | 69 titleColorAgainstDark: 'd2d2d2ff', |
70 titleTextAlign: 'inherit', | 70 titleTextAlign: 'inherit', |
71 titleTextFade: 112 - 24, // 112px wide title with 24 pixel fade at end. | 71 titleTextFade: 122 - 36, // 112px wide title with 32 pixel fade at end. |
72 thumbnailTextColor: '777777', | 72 thumbnailTextColor: '323232ff', // Unused. |
73 thumbnailFallback: THUMBNAIL_FALLBACK.DOT, | 73 thumbnailFallback: THUMBNAIL_FALLBACK.DOT, |
74 showFakeboxHint: true | 74 showFakeboxHint: true |
75 }; | 75 }; |
76 } else { | 76 } else { |
77 ntpDesign = { | 77 ntpDesign = { |
78 name: 'classical', | 78 name: 'classical', |
79 fontFamily: 'arial, sans-serif', | 79 fontFamily: 'arial, sans-serif', |
80 fontSize: 11, | 80 fontSize: 11, |
81 tileWidth: 140, | 81 tileWidth: 140, |
82 tileMargin: 20, | 82 tileMargin: 20, |
83 titleColor: '777777', | 83 titleColor: '777777ff', |
84 titleColorAgainstDark: '777777', | 84 titleColorAgainstDark: '777777ff', |
85 titleTextAlign: 'center', | 85 titleTextAlign: 'center', |
86 titleTextFade: null, // Default to ellipsis. | 86 titleTextFade: null, // Default to ellipsis. |
87 thumbnailTextColor: '777777', | 87 thumbnailTextColor: '777777ff', |
88 thumbnailFallback: null, // Default to false. | 88 thumbnailFallback: null, // Default to false. |
89 showFakeboxHint: false | 89 showFakeboxHint: false |
90 }; | 90 }; |
91 } | 91 } |
92 return ntpDesign; | 92 return ntpDesign; |
93 } | 93 } |
OLD | NEW |