1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "ui/message_center/message_center_style.h" 6 7 #include <algorithm> 8 9 namespace message_center { 10 11 // Exported values ///////////////////////////////////////////////////////////// 12 13 // Colors. 14 const SkColor kMessageCenterBorderColor = SkColorSetRGB(0xC7, 0xCA, 0xCE); 15 const SkColor kMessageCenterShadowColor = SkColorSetARGB(0.5 * 255, 0, 0, 0); 16 17 // Within a notification /////////////////////////////////////////////////////// 18 19 // Colors. 20 const SkColor kNotificationBackgroundColor = SkColorSetRGB(255, 255, 255); 21 const SkColor kIconBackgroundColor = SkColorSetRGB(0xf5, 0xf5, 0xf5); 22 const SkColor kImageBackgroundColor = SkColorSetRGB(0x22, 0x22, 0x22); 23 const SkColor kRegularTextColor = SkColorSetRGB(0x33, 0x33, 0x33); 24 const SkColor kDimTextColor = SkColorSetRGB(0x7f, 0x7f, 0x7f); 25 const SkColor kFocusBorderColor = SkColorSetRGB(64, 128, 250); 26 27 // Limits. 28 29 gfx::Size GetImageSizeForContainerSize(const gfx::Size& container_size, 30 const gfx::Size& image_size) { 31 if (container_size.IsEmpty() || image_size.IsEmpty()) 32 return gfx::Size(); 33 34 gfx::Size scaled_size = image_size; 35 double proportion = 36 scaled_size.height() / static_cast<double>(scaled_size.width()); 37 // We never want to return an empty image given a non-empty container and 38 // image, so round the height to 1. 39 scaled_size.SetSize(container_size.width(), 40 std::max(0.5 + container_size.width() * proportion, 1.0)); 41 if (scaled_size.height() > container_size.height()) { 42 scaled_size.SetSize( 43 std::max(0.5 + container_size.height() / proportion, 1.0), 44 container_size.height()); 45 } 46 47 return scaled_size; 48 } 49 50 const size_t kNotificationMaximumItems = 5; 51 52 // Timing. 53 const int kAutocloseDefaultDelaySeconds = 8; 54 const int kAutocloseHighPriorityDelaySeconds = 25; 55 56 // Colors. 57 const SkColor kBackgroundLightColor = SkColorSetRGB(0xf1, 0xf1, 0xf1); 58 const SkColor kBackgroundDarkColor = SkColorSetRGB(0xe7, 0xe7, 0xe7); 59 const SkColor kShadowColor = SkColorSetARGB(0.3 * 255, 0, 0, 0); 60 const SkColor kMessageCenterBackgroundColor = SkColorSetRGB(0xee, 0xee, 0xee); 61 const SkColor kFooterDelimiterColor = SkColorSetRGB(0xcc, 0xcc, 0xcc); 62 const SkColor kFooterTextColor = SkColorSetRGB(0x7b, 0x7b, 0x7b); 63 64 } // namespace message_center 65