Skip to content

Commit

Permalink
[color] Add tab strip material color mixer
Browse files Browse the repository at this point in the history
This CL adds an initial color mixer for tab strip colors. Follow up work
will be needed to correctly address various state colors.

Bug: 1399942
Change-Id: Ief283791c26422d383befb137ddb44356ae574e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4347396
Commit-Queue: Thomas Lukaszewicz <tluk@chromium.org>
Reviewed-by: Allen Bauer <kylixrd@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1118527}
  • Loading branch information
Thomas Lukaszewicz authored and Chromium LUCI CQ committed Mar 17, 2023
1 parent b34759e commit 179adb9
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
2 changes: 2 additions & 0 deletions chrome/browser/ui/color/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ source_set("mixers") {
"chrome_color_provider_utils.h",
"material_side_panel_color_mixer.cc",
"material_side_panel_color_mixer.h",
"material_tab_strip_color_mixer.cc",
"material_tab_strip_color_mixer.h",
"native_chrome_color_mixer.cc",
"native_chrome_color_mixer.h",
"new_tab_page_color_mixer.cc",
Expand Down
2 changes: 2 additions & 0 deletions chrome/browser/ui/color/chrome_color_mixers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/color/chrome_color_mixer.h"
#include "chrome/browser/ui/color/material_side_panel_color_mixer.h"
#include "chrome/browser/ui/color/material_tab_strip_color_mixer.h"
#include "chrome/browser/ui/color/native_chrome_color_mixer.h"
#include "chrome/browser/ui/color/new_tab_page_color_mixer.h"
#include "chrome/browser/ui/color/omnibox_color_mixer.h"
Expand Down Expand Up @@ -63,6 +64,7 @@ void AddChromeColorMixers(ui::ColorProvider* provider,

if (features::IsChromeRefresh2023()) {
AddMaterialSidePanelColorMixer(provider, key);
AddMaterialTabStripColorMixer(provider, key);
}

// Must be the last one in order to override other mixer colors.
Expand Down
32 changes: 32 additions & 0 deletions chrome/browser/ui/color/material_tab_strip_color_mixer.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/color/material_tab_strip_color_mixer.h"

#include "chrome/browser/ui/color/chrome_color_id.h"
#include "ui/color/color_id.h"
#include "ui/color/color_mixer.h"
#include "ui/color/color_provider.h"
#include "ui/color/color_recipe.h"

void AddMaterialTabStripColorMixer(ui::ColorProvider* provider,
const ui::ColorProviderManager::Key& key) {
ui::ColorMixer& mixer = provider->AddMixer();

// TODO(crbug.com/1399942): Validate final mappings for Gm3 color.
mixer[kColorTabBackgroundActiveFrameActive] = {ui::kColorSysBase};
mixer[kColorTabBackgroundActiveFrameInactive] = {
kColorTabBackgroundActiveFrameActive};
mixer[kColorTabBackgroundInactiveFrameActive] = {ui::kColorSysHeader};
mixer[kColorTabBackgroundInactiveFrameInactive] = {
ui::kColorSysHeaderInactive};

mixer[kColorTabForegroundActiveFrameActive] = {ui::kColorSysOnSurface};
mixer[kColorTabForegroundActiveFrameInactive] = {
kColorTabForegroundActiveFrameActive};
mixer[kColorTabForegroundInactiveFrameActive] = {
ui::kColorSysOnSurfaceSecondary};
mixer[kColorTabForegroundInactiveFrameInactive] = {
kColorTabForegroundInactiveFrameActive};
}
19 changes: 19 additions & 0 deletions chrome/browser/ui/color/material_tab_strip_color_mixer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_COLOR_MATERIAL_TAB_STRIP_COLOR_MIXER_H_
#define CHROME_BROWSER_UI_COLOR_MATERIAL_TAB_STRIP_COLOR_MIXER_H_

#include "ui/color/color_provider_manager.h"

namespace ui {
class ColorProvider;
}

// Adds a color mixer that contains recipes for tab strip colors to `provider`
// with |key|.
void AddMaterialTabStripColorMixer(ui::ColorProvider* provider,
const ui::ColorProviderManager::Key& key);

#endif // CHROME_BROWSER_UI_COLOR_MATERIAL_TAB_STRIP_COLOR_MIXER_H_

0 comments on commit 179adb9

Please sign in to comment.