#ifndef ASH_STYLE_STYLE_UTIL_H_
#define ASH_STYLE_STYLE_UTIL_H_
#include <optional>
#include "ash/ash_export.h"
#include "ui/color/color_id.h"
#include "ui/compositor_extra/shadow.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/insets.h"
namespace ui {
class ColorProvider;
}
namespace views {
class Background;
class Button;
class FocusRing;
class InkDrop;
class InkDropHighlight;
class InkDropRipple;
class View;
namespace corewm {
class TooltipViewAura;
}
}
namespace ash {
class ASH_EXPORT StyleUtil {
public:
enum InkDropAttributes {
kBaseColor = 1,
kInkDropOpacity = 1 << 1,
kHighlightOpacity = 1 << 2
};
static constexpr float kLightInkDropOpacity = 0.08f;
static constexpr float kDarkInkDropOpacity = 0.06f;
static float GetInkDropOpacity();
static std::unique_ptr<views::InkDrop> CreateInkDrop(
views::Button* host,
bool highlight_on_hover = false,
bool highlight_on_focus = false);
static std::unique_ptr<views::InkDropRipple> CreateInkDropRipple(
const gfx::Insets& insets,
const views::View* host,
SkColor background_color = gfx::kPlaceholderColor);
static std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight(
const views::View* host,
SkColor background_color);
static void SetRippleParams(
views::View* host,
const gfx::Insets& insets,
SkColor background_color = gfx::kPlaceholderColor);
static void SetUpInkDropForButton(
views::Button* button,
const gfx::Insets& ripple_insets = gfx::Insets(),
bool highlight_on_hover = false,
bool highlight_on_focus = false,
SkColor background_color = gfx::kPlaceholderColor);
static void ConfigureInkDropAttributes(
views::View* view,
uint32_t attributes,
SkColor background_color = gfx::kPlaceholderColor);
static views::FocusRing* SetUpFocusRingForView(
views::View* view,
std::optional<int> halo_inset = std::nullopt);
static void InstallRoundedCornerHighlightPathGenerator(
views::View* view,
const gfx::RoundedCornersF& corners);
static std::unique_ptr<views::Background>
CreateThemedFullyRoundedRectBackground(ui::ColorId color_id);
static std::unique_ptr<views::corewm::TooltipViewAura>
CreateAshStyleTooltipView();
static ui::Shadow::ElevationToColorsMap CreateShadowElevationToColorsMap(
const ui::ColorProvider* color_provider);
private:
StyleUtil() = default;
StyleUtil(const StyleUtil&) = delete;
StyleUtil& operator=(const StyleUtil&) = delete;
~StyleUtil() = default;
};
}
#endif