Skip to content

Commit

Permalink
Updated sidebar item icons - bookmarks/wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
simonhong authored and muliswilliam committed Mar 16, 2022
1 parent d056a5d commit 213b5a9
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 110 deletions.
2 changes: 1 addition & 1 deletion app/theme/brave_theme_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<if expr="enable_sidebar">
<structure type="chrome_scaled_image" name="IDR_SIDEBAR_BOOKMARKS_FOCUSED" file="brave/sidebar_bookmark_focused.png" />
<structure type="chrome_scaled_image" name="IDR_SIDEBAR_BRAVE_TOGETHER_FOCUSED" file="brave/sidebar_brave_together_focused.png" />
<structure type="chrome_scaled_image" name="IDR_SIDEBAR_BRAVE_TALK_FOCUSED" file="brave/sidebar_brave_talk_focused.png" />
<structure type="chrome_scaled_image" name="IDR_SIDEBAR_CRYPTO_WALLET_FOCUSED" file="brave/sidebar_crypto_wallet_focused.png" />
<structure type="chrome_scaled_image" name="IDR_SIDEBAR_HISTORY_FOCUSED" file="brave/sidebar_history_focused.png" />
<structure type="chrome_scaled_image" name="IDR_SIDEBAR_ITEM_HIGHLIGHT" file="brave/sidebar_item_highlight.png" />
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/vector_icons/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ aggregate_vector_icons("brave_vector_icons") {
sources += [
"sidebar_add_item.icon",
"sidebar_bookmarks.icon",
"sidebar_brave_together.icon",
"sidebar_brave_talk.icon",
"sidebar_crypto_wallet.icon",
"sidebar_history.icon",
"sidebar_item_added_check.icon",
Expand Down
88 changes: 45 additions & 43 deletions app/vector_icons/sidebar_bookmarks.icon
Original file line number Diff line number Diff line change
@@ -1,47 +1,49 @@
CANVAS_DIMENSIONS, 16,
MOVE_TO, 13.59f, 1.23f,
H_LINE_TO, 2.72f,
R_CUBIC_TO, -0.46f, 0, -0.82f, 0.33f, -0.82f, 0.71f,
R_V_LINE_TO, 11.6f,
R_ARC_TO, 0.62f, 0.62f, 0, 1, 1, -1.23f, 0,
V_LINE_TO, 1.94f,
CUBIC_TO, 0.67f, 0.86f, 1.6f, 0, 2.72f, 0,
R_H_LINE_TO, 10.98f,
R_CUBIC_TO, 0.62f, 0, 1.12f, 0.49f, 1.12f, 1.11f,
R_V_LINE_TO, 10.77f,
R_ARC_TO, 0.62f, 0.62f, 0, 1, 1, -1.23f, 0,
V_LINE_TO, 1.23f,
CANVAS_DIMENSIONS, 24,
MOVE_TO, 20.38f, 1.85f,
H_LINE_TO, 4.08f,
R_CUBIC_TO, -0.7f, 0, -1.23f, 0.49f, -1.23f, 1.06f,
R_V_LINE_TO, 17.4f,
R_ARC_TO, 0.92f, 0.92f, 0, 1, 1, -1.85f, 0,
V_LINE_TO, 2.91f,
CUBIC_TO, 1, 1.28f, 2.39f, 0, 4.08f, 0,
R_H_LINE_TO, 16.47f,
R_CUBIC_TO, 0.93f, 0, 1.68f, 0.74f, 1.68f, 1.66f,
R_V_LINE_TO, 16.16f,
R_ARC_TO, 0.92f, 0.92f, 0, 0, 1, -1.85f, 0,
V_LINE_TO, 1.85f,
CLOSE,
MOVE_TO, 14.82f, 14.77f,
R_ARC_TO, 0.62f, 0.62f, 0, 1, 1, 0, 1.23f,
H_LINE_TO, 3.16f,
CUBIC_TO, 1.79f, 16, 0.67f, 14.9f, 0.67f, 13.54f,
R_CUBIC_TO, 0, -1.36f, 1.12f, -2.46f, 2.5f, -2.46f,
H_LINE_TO, 14.82f,
R_ARC_TO, 0.62f, 0.62f, 0, 1, 1, 0, 1.23f,
H_LINE_TO, 3.16f,
R_CUBIC_TO, -0.7f, 0, -1.26f, 0.55f, -1.26f, 1.23f,
R_CUBIC_TO, 0, 0.68f, 0.56f, 1.23f, 1.26f, 1.23f,
H_LINE_TO, 14.82f,
NEW_PATH,
MOVE_TO, 22.23f, 22.15f,
R_ARC_TO, 0.92f, 0.92f, 0, 0, 1, 0, 1.85f,
H_LINE_TO, 4.75f,
CUBIC_TO, 2.68f, 24, 1, 22.35f, 1, 20.31f,
R_CUBIC_TO, 0, -2.04f, 1.68f, -3.69f, 3.74f, -3.69f,
H_LINE_TO, 22.23f,
R_ARC_TO, 0.92f, 0.92f, 0, 0, 1, 0, 1.85f,
H_LINE_TO, 4.74f,
R_CUBIC_TO, -1.05f, 0, -1.9f, 0.83f, -1.9f, 1.85f,
R_CUBIC_TO, 0, 1.02f, 0.85f, 1.85f, 1.9f, 1.85f,
H_LINE_TO, 22.23f,
CLOSE,
MOVE_TO, 14.44f, 15.22f,
R_ARC_TO, 0.62f, 0.62f, 0, 1, 1, -1.18f, 0.33f,
R_ARC_TO, 7.39f, 7.39f, 0, 0, 1, 0, -4.03f,
R_ARC_TO, 0.62f, 0.62f, 0, 0, 1, 1.19f, 0.33f,
R_ARC_TO, 6.16f, 6.16f, 0, 0, 0, 0, 3.36f,
NEW_PATH,
MOVE_TO, 21.66f, 22.83f,
R_ARC_TO, 0.92f, 0.92f, 0, 1, 1, -1.78f, 0.5f,
R_ARC_TO, 11.08f, 11.08f, 0, 0, 1, 0, -6.04f,
R_ARC_TO, 0.92f, 0.92f, 0, 0, 1, 1.78f, 0.5f,
R_ARC_TO, 9.24f, 9.24f, 0, 0, 0, 0, 5.04f,
CLOSE,
MOVE_TO, 9.9f, 0.62f,
R_ARC_TO, 0.62f, 0.62f, 0, 0, 1, 1.23f, 0,
V_LINE_TO, 6.77f,
R_CUBIC_TO, 0, 0.52f, -0.6f, 0.81f, -1, 0.48f,
R_LINE_TO, -2.07f, -1.7f,
R_LINE_TO, -2.07f, 1.7f,
R_ARC_TO, 0.62f, 0.62f, 0, 0, 1, -1, -0.48f,
V_LINE_TO, 0.62f,
R_ARC_TO, 0.62f, 0.62f, 0, 1, 1, 1.23f, 0,
R_V_LINE_TO, 4.85f,
LINE_TO, 7.66f, 4.27f,
R_ARC_TO, 0.62f, 0.62f, 0, 0, 1, 0.78f, 0,
R_LINE_TO, 1.46f, 1.19f,
V_LINE_TO, 0.62f,
MOVE_TO, 14.85f, 0.92f,
R_ARC_TO, 0.92f, 0.92f, 0, 0, 1, 1.85f, 0,
R_V_LINE_TO, 9.23f,
R_ARC_TO, 0.92f, 0.92f, 0, 0, 1, -1.51f, 0.71f,
LINE_TO, 12.08f, 8.32f,
LINE_TO, 8.97f, 10.87f,
R_ARC_TO, 0.92f, 0.92f, 0, 0, 1, -1.51f, -0.71f,
V_LINE_TO, 0.92f,
R_ARC_TO, 0.92f, 0.92f, 0, 0, 1, 1.85f, 0,
R_V_LINE_TO, 7.28f,
LINE_TO, 11.49f, 6.41f,
R_CUBIC_TO, 0.34f, -0.28f, 0.83f, -0.28f, 1.17f, 0,
R_LINE_TO, 2.18f, 1.79f,
V_LINE_TO, 0.92f,
CLOSE
File renamed without changes.
85 changes: 42 additions & 43 deletions app/vector_icons/sidebar_crypto_wallet.icon
Original file line number Diff line number Diff line change
@@ -1,47 +1,46 @@
CANVAS_DIMENSIONS, 16,
MOVE_TO, 6.67f, 0.67f,
R_CUBIC_TO, 0.94f, 0, 1.82f, 0.39f, 2.43f, 1.06f,
ARC_TO, 3.33f, 3.33f, 0, 0, 1, 14, 4.67f,
R_ARC_TO, 2, 2, 0, 0, 1, 2, 2,
R_V_LINE_TO, 6.67f,
R_ARC_TO, 2, 2, 0, 0, 1, -2, 2,
H_LINE_TO, 2,
R_ARC_TO, 2, 2, 0, 0, 1, -2, -2,
V_LINE_TO, 4.67f,
R_CUBIC_TO, 0, -0.04f, 0, -0.08f, 0.01f, -0.12f,
ARC_TO, 2.1f, 2.1f, 0, 0, 1, 0, 4.33f,
R_CUBIC_TO, 0, -0.92f, 0.75f, -1.67f, 1.67f, -1.67f,
H_LINE_TO, 3.61f,
R_CUBIC_TO, 0.51f, -1.18f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0.67f, -0.67f,
V_LINE_TO, 6.67f,
ARC_TO, 0.67f, 0.67f, 0, 0, 0, 14, 6,
H_LINE_TO, 3.33f,
R_MOVE_TO, 21, 5.12f,
R_H_LINE_TO, -7.31f,
R_ARC_TO, 1, 1, 0, 0, 0, -1, 1,
R_V_LINE_TO, 2.84f,
R_ARC_TO, 1, 1, 0, 0, 0, 1, 1,
H_LINE_TO, 23,
V_LINE_TO, 11.27f,
CLOSE,
MOVE_TO, 4.78f, 4.67f,
R_H_LINE_TO, 2.55f,
R_CUBIC_TO, 0, -0.79f, 0.28f, -1.52f, 0.74f, -2.09f,
R_ARC_TO, 2, 2, 0, 0, 0, -3.29f, 2.09f,
CLOSE,
R_MOVE_TO, 3.89f, 0,
R_H_LINE_TO, 4,
R_ARC_TO, 2, 2, 0, 0, 0, -4, 0,
CLOSE,
MOVE_TO, 12, 11.33f,
R_ARC_TO, 1.33f, 1.33f, 0, 1, 0, 0, -2.67f,
R_ARC_TO, 1.33f, 1.33f, 0, 0, 0, 0, 2.67f,
MOVE_TO, 2, 3.61f,
R_CUBIC_TO, 0, 0.34f, 0.27f, 0.61f, 0.61f, 0.61f,
R_H_LINE_TO, 17.22f,
V_LINE_TO, 4,
R_ARC_TO, 1, 1, 0, 0, 0, -1, -1,
H_LINE_TO, 2.61f,
ARC_TO, 0.61f, 0.61f, 0, 0, 0, 2, 3.61f,
CLOSE
53 changes: 31 additions & 22 deletions browser/ui/views/sidebar/sidebar_items_contents_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image_skia_operations.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/gfx/vector_icon_types.h"
#include "ui/views/background.h"
#include "ui/views/controls/menu/menu_runner.h"
#include "ui/views/controls/separator.h"
Expand Down Expand Up @@ -413,33 +414,41 @@ gfx::ImageSkia SidebarItemsContentsView::GetImageForBuiltInItems(
base_button_color = theme_provider->GetColor(
BraveThemeProperties::COLOR_SIDEBAR_BUTTON_BASE);
}
constexpr int kBuiltInIconSize = 16;
int focused_image_resource = -1;
const gfx::VectorIcon* normal_image_icon = nullptr;
auto& bundle = ui::ResourceBundle::GetSharedInstance();
if (type == sidebar::SidebarItem::BuiltInItemType::kWallet) {
if (focused)
return *bundle.GetImageSkiaNamed(IDR_SIDEBAR_CRYPTO_WALLET_FOCUSED);
return gfx::CreateVectorIcon(kSidebarCryptoWalletIcon, base_button_color);
switch (type) {
case sidebar::SidebarItem::BuiltInItemType::kWallet:
focused_image_resource = IDR_SIDEBAR_CRYPTO_WALLET_FOCUSED;
normal_image_icon = &kSidebarCryptoWalletIcon;
break;
case sidebar::SidebarItem::BuiltInItemType::kBraveTalk:
focused_image_resource = IDR_SIDEBAR_BRAVE_TALK_FOCUSED;
normal_image_icon = &kSidebarBraveTalkIcon;
break;
case sidebar::SidebarItem::BuiltInItemType::kBookmarks:
focused_image_resource = IDR_SIDEBAR_BOOKMARKS_FOCUSED;
normal_image_icon = &kSidebarBookmarksIcon;
break;
case sidebar::SidebarItem::BuiltInItemType::kHistory:
focused_image_resource = IDR_SIDEBAR_HISTORY_FOCUSED;
normal_image_icon = &kSidebarHistoryIcon;
break;
default:
NOTREACHED();
return gfx::ImageSkia();
}

if (type == sidebar::SidebarItem::BuiltInItemType::kBraveTalk) {
if (focused)
return *bundle.GetImageSkiaNamed(IDR_SIDEBAR_BRAVE_TOGETHER_FOCUSED);
return gfx::CreateVectorIcon(kSidebarBraveTogetherIcon, base_button_color);
if (focused) {
return gfx::ImageSkiaOperations::CreateResizedImage(
*bundle.GetImageSkiaNamed(focused_image_resource),
skia::ImageOperations::RESIZE_BEST,
gfx::Size{kBuiltInIconSize, kBuiltInIconSize});
}

if (type == sidebar::SidebarItem::BuiltInItemType::kBookmarks) {
if (focused)
return *bundle.GetImageSkiaNamed(IDR_SIDEBAR_BOOKMARKS_FOCUSED);
return gfx::CreateVectorIcon(kSidebarBookmarksIcon, base_button_color);
}

if (type == sidebar::SidebarItem::BuiltInItemType::kHistory) {
if (focused)
return *bundle.GetImageSkiaNamed(IDR_SIDEBAR_HISTORY_FOCUSED);
return gfx::CreateVectorIcon(kSidebarHistoryIcon, base_button_color);
}

NOTREACHED();
return gfx::ImageSkia();
return gfx::CreateVectorIcon(*normal_image_icon, kBuiltInIconSize,
base_button_color);
}

void SidebarItemsContentsView::OnWidgetDestroying(views::Widget* widget) {
Expand Down

0 comments on commit 213b5a9

Please sign in to comment.