chromium/ui/color/dynamic_color/palette_factory.cc

// 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 "ui/color/dynamic_color/palette_factory.h"

#include <array>
#include <memory>
#include <utility>
#include <vector>

#include "base/containers/flat_map.h"
#include "base/containers/span.h"
#include "third_party/material_color_utilities/src/cpp/cam/hct.h"
#include "third_party/material_color_utilities/src/cpp/palettes/core.h"
#include "third_party/material_color_utilities/src/cpp/palettes/tones.h"
#include "ui/color/color_provider_manager.h"
#include "ui/color/dynamic_color/palette.h"

namespace ui {

namespace {

Hct;
SchemeVariant;

// Returns the hue angle for `source_color` modified by the closest match in
// `hues_to_rotations`.
double GetRotatedHue(double source_hue,
                     const base::flat_map<double, double>& hues_to_rotations) {}

// Returns the chroma value from `hues_to_chroma` given a `source_hue`. If the
// `source_hue` is out of range, the first entry in `hues_to_chroma` is
// returned.
double GetAdjustedChroma(
    double source_hue,
    const base::flat_map<double, double>& hues_to_chromas) {}

class CustomPalette : public Palette {};

struct Transform {};

Transform Chroma(double chroma) {}

// Specifies the `Transform`s relative to the source color that generates a
// Palette.
struct Config {};

// Returns a `TonalPalette` constructed from `hue` transformed by `transform`.
TonalPalette MakePalette(double hue, const Transform& transform) {}

std::unique_ptr<Palette> FromConfig(SkColor seed_color, const Config& config) {}

// Returns a `base::flat_map` from two arrays of equal size.
template <class S, class T, size_t N>
base::flat_map<S, T> Zip(const std::array<S, N>& keys,
                         const std::array<T, N>& values) {}

}  // namespace

std::unique_ptr<Palette> GeneratePalette(SkColor seed_color,
                                         SchemeVariant variant) {}

}  // namespace ui