diff --git a/DuckDuckGo/Assets.xcassets/Colors/MutedTabIconColor.colorset/Contents.json b/DuckDuckGo/Assets.xcassets/Colors/MutedTabIconColor.colorset/Contents.json new file mode 100644 index 0000000000..3fe9b59242 --- /dev/null +++ b/DuckDuckGo/Assets.xcassets/Colors/MutedTabIconColor.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0x00", + "red" : "0x00" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xFF", + "green" : "0xFF", + "red" : "0xFE" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DuckDuckGo/Assets.xcassets/Colors/PinnedTabMuteStateCircleColor.colorset/Contents.json b/DuckDuckGo/Assets.xcassets/Colors/PinnedTabMuteStateCircleColor.colorset/Contents.json new file mode 100644 index 0000000000..802fa68a4c --- /dev/null +++ b/DuckDuckGo/Assets.xcassets/Colors/PinnedTabMuteStateCircleColor.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xFF", + "green" : "0xFF", + "red" : "0xFE" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0x00", + "red" : "0x00" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DuckDuckGo/PinnedTabs/View/PinnedTabView.swift b/DuckDuckGo/PinnedTabs/View/PinnedTabView.swift index a877386433..170ab3092c 100644 --- a/DuckDuckGo/PinnedTabs/View/PinnedTabView.swift +++ b/DuckDuckGo/PinnedTabs/View/PinnedTabView.swift @@ -205,7 +205,7 @@ struct PinnedTabInnerView: View { ZStack { Circle() .stroke(Color.gray.opacity(0.5), lineWidth: 0.5) - .background(Circle().foregroundColor(colorScheme == .dark ? Color.black : Color.white)) + .background(Circle().foregroundColor(Color("PinnedTabMuteStateCircleColor"))) .frame(width: 14, height: 14) Image("Audio-Mute") .resizable() diff --git a/DuckDuckGo/TabBar/View/TabBarViewItem.swift b/DuckDuckGo/TabBar/View/TabBarViewItem.swift index 62cb475990..2db24aaf81 100644 --- a/DuckDuckGo/TabBar/View/TabBarViewItem.swift +++ b/DuckDuckGo/TabBar/View/TabBarViewItem.swift @@ -55,8 +55,7 @@ final class TabBarViewItem: NSCollectionViewItem { enum Constants { static let textFieldPadding: CGFloat = 32 static let textFieldPaddingNoFavicon: CGFloat = 12 - static let textFieldTrailingNoMuteIcon: CGFloat = 8 - static let textFieldTrailingMuteIconPresent: CGFloat = 32 + static let textFieldPaddingMuteIconPresent: CGFloat = 56 } var widthStage: WidthStage { @@ -98,7 +97,6 @@ final class TabBarViewItem: NSCollectionViewItem { @IBOutlet weak var titleTextField: NSTextField! @IBOutlet weak var titleTextFieldLeadingConstraint: NSLayoutConstraint! - @IBOutlet weak var titleTextFieldTrailingConstraint: NSLayoutConstraint! @IBOutlet weak var closeButton: MouseOverButton! @IBOutlet weak var rightSeparatorView: ColorView! @IBOutlet weak var mouseOverView: MouseOverView! @@ -127,7 +125,6 @@ final class TabBarViewItem: NSCollectionViewItem { setupMenu() updateTitleTextFieldMask() closeButton.isHidden = true - setupMuteOrUnmutedIcon() } override func viewDidLayout() { @@ -135,7 +132,6 @@ final class TabBarViewItem: NSCollectionViewItem { updateSubviews() updateTitleTextFieldMask() - setupMuteOrUnmutedIcon() } override func viewWillDisappear() { @@ -349,6 +345,7 @@ final class TabBarViewItem: NSCollectionViewItem { mouseOverView.mouseOverColor = isSelected || isDragged ? NSColor.clear : NSColor.tabMouseOverColor } + setupMuteOrUnmutedIcon() let showCloseButton = (isMouseOver && !widthStage.isCloseButtonHidden) || isSelected closeButton.isHidden = !showCloseButton updateSeparatorView() @@ -432,16 +429,32 @@ final class TabBarViewItem: NSCollectionViewItem { } private func setupMuteOrUnmutedIcon() { + setupMutedTabIconVisibility() + setupMutedTabIconColor() + setupMutedTabIconPosition() + } + + private func setupMutedTabIconVisibility() { switch delegate?.tabBarViewItemAudioState(self) { case .muted: mutedTabIcon.isHidden = false default: mutedTabIcon.isHidden = true } + } - titleTextFieldTrailingConstraint.constant = mutedTabIcon.isHidden ? Constants.textFieldTrailingNoMuteIcon : Constants.textFieldTrailingMuteIconPresent + private func setupMutedTabIconColor() { + mutedTabIcon.image?.isTemplate = true + mutedTabIcon.contentTintColor = NSColor(named: "MutedTabIconColor") } + private func setupMutedTabIconPosition() { + if !mutedTabIcon.isHidden { + titleTextFieldLeadingConstraint.constant = Constants.textFieldPaddingMuteIconPresent + } else { + titleTextFieldLeadingConstraint.constant = faviconWrapperView.isHidden ? Constants.textFieldPaddingNoFavicon : Constants.textFieldPadding + } + } } extension TabBarViewItem: NSMenuDelegate { diff --git a/DuckDuckGo/TabBar/View/TabBarViewItem.xib b/DuckDuckGo/TabBar/View/TabBarViewItem.xib index 1e9d4995ac..97b8979631 100644 --- a/DuckDuckGo/TabBar/View/TabBarViewItem.xib +++ b/DuckDuckGo/TabBar/View/TabBarViewItem.xib @@ -14,12 +14,12 @@ @@ -29,7 +29,7 @@ - + @@ -133,7 +133,6 @@ - @@ -147,9 +146,9 @@ - + @@ -176,15 +175,14 @@ - + -