#ifdef UNSAFE_BUFFERS_BUILD
#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 {
constexpr double kMinimumSaturation = …;
constexpr double kMaximumLightnessDiff = …;
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) { … }
}
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) { … }