chromium/chrome/browser/ui/profiles/profile_colors_util.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "chrome/browser/ui/profiles/profile_colors_util.h"

#include "base/containers/contains.h"
#include "base/functional/callback.h"
#include "base/rand_util.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/new_tab_page/chrome_colors/generated_colors_info.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/profiles/profile_avatar_icon_util.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/common/themes/autogenerated_theme_util.h"
#include "components/signin/public/base/signin_switches.h"
#include "ui/color/color_id.h"
#include "ui/color/color_provider.h"
#include "ui/color/color_provider_manager.h"
#include "ui/gfx/color_utils.h"
#include "ui/native_theme/native_theme.h"

namespace {

// Minimum saturation for a color to be autoselected (as picking 'colorful'
// colors is needed to distinguish colors from each other).
constexpr double kMinimumSaturation =;

// Maximum diff in lightness of an autoselected color to the color of the
// current profile (so that the interception UI does not look bad).
constexpr double kMaximumLightnessDiff =;

// This is the core definition of how ProfileThemeColors are obtained.
ProfileThemeColors GetProfileThemeColorsFromHighlightColor(
    const ui::ColorProvider& color_provider,
    SkColor highlight_color,
    SkColor seed_color = SK_ColorTRANSPARENT) {}

size_t GenerateRandomIndex(size_t size) {}

std::vector<int> GetAvailableColorIndices(
    const std::set<ProfileThemeColors>& used_theme_colors,
    std::optional<double> current_color_lightness) {}

const ui::ColorProvider* GetDefaultColorProvider() {}

double ExtractCurrentColorLightness(ProfileAttributesEntry* current_profile) {}

}  // namespace

bool ShouldUseDefaultProfileColors(const ThemeService& theme_service) {}

profiles::PlaceholderAvatarIconParams
GetPlaceholderAvatarIconParamsVisibleAgainstColor(SkColor background_color) {}

profiles::PlaceholderAvatarIconParams
GetPlaceholderAvatarIconParamsDependingOnTheme(
    ThemeService* theme_service,
    ui::ColorId background_color_id,
    const ui::ColorProvider& color_provider) {}

ProfileThemeColors GetProfileThemeColorsForAutogeneratedColor(
    SkColor autogenerated_color) {}

ProfileThemeColors GetCurrentProfileThemeColors(
    const ui::ColorProvider& color_provider,
    const ThemeService& theme_service) {}

ProfileThemeColors GetDefaultProfileThemeColors(
    const ui::ColorProvider* color_provider) {}

SkColor GetProfileForegroundTextColor(SkColor profile_highlight_color) {}

SkColor GetProfileForegroundIconColor(SkColor profile_highlight_color) {}

DefaultAvatarColors GetDefaultAvatarColors(
    const ui::ColorProvider& color_provider,
    SkColor profile_highlight_color) {}

bool IsSaturatedForAutoselection(SkColor color) {}

bool IsLightForAutoselection(SkColor color, double reference_lightness) {}

chrome_colors::ColorInfo GenerateNewProfileColorWithGenerator(
    ProfileAttributesStorage& storage,
    base::OnceCallback<size_t(size_t count)> random_generator,
    ProfileAttributesEntry* current_profile) {}

chrome_colors::ColorInfo GenerateNewProfileColor(
    ProfileAttributesEntry* current_profile) {}