Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
bool meets_contrast(Color foreground, Color background, ContrastLevel level=ContrastLevel::aa_normal)
Check if a foreground/background pair meets a given contrast level.
std::vector< ContrastIssue > validate_theme_contrast(const Theme &theme, ContrastLevel level=ContrastLevel::aa_normal)
Validate a theme for contrast issues.
float contrast_ratio(Color a, Color b)
Compute WCAG contrast ratio between two colors.
Color blend_colors(Color a, Color b, float t)
Blend two colors by factor t in [0,1]. t=0 returns a, t=1 returns b.
Theme auto_fix_contrast(const Theme &theme, ContrastLevel level=ContrastLevel::aa_normal)
Auto-fix contrast issues in a theme by adjusting foreground colors.
Color shift_hue(Color c, float degrees)
Shift hue by degrees (wraps around 360).
canvas::Color Color
Definition theme.hpp:12
float min_contrast_for_level(ContrastLevel level)
Get the minimum contrast ratio required for a given level.
std::optional< Color > adjust_for_contrast(Color foreground, Color background, ContrastLevel level=ContrastLevel::aa_normal)
Given a background color and a desired foreground, adjust the foreground lightness until it meets the...
Color adjust_lightness(Color c, float delta)
Adjust lightness by a delta (clamped to [0,1]).
@ a
Definition input_events.hpp:39
@ c
Definition input_events.hpp:39
@ b
Definition input_events.hpp:39
@ t
Definition input_events.hpp:41
float relative_luminance(Color c)
Compute relative luminance of a color per WCAG 2.1 definition.
ContrastLevel
WCAG AA compliance levels.
Definition theme_contrast.hpp:22
@ aaa_normal
Definition theme_contrast.hpp:25
@ aaa_large
Definition theme_contrast.hpp:26
@ aa_normal
Definition theme_contrast.hpp:23
@ aa_large
Definition theme_contrast.hpp:24
HSL rgb_to_hsl(Color c)
Definition theme_contrast.hpp:52
Color hsl_to_rgb(HSL hsl, float alpha=1.0f)
Definition theme_contrast.hpp:53
canvas::Color::HSL HSL
Definition theme_contrast.hpp:50
Color with_alpha(Color c, float alpha)
Apply alpha to a color [0.0-1.0].
Color auto_contrast_foreground(Color background, ContrastLevel level=ContrastLevel::aa_normal)
Given a background color, compute an accessible foreground color.
static Color from_hsl(HSL hsl, float alpha=1.0f)
Definition theme_contrast.hpp:69
ContrastLevel required_level
Definition theme_contrast.hpp:73
std::string foreground_token
Definition theme_contrast.hpp:70
std::string background_token
Definition theme_contrast.hpp:71
float ratio
Definition theme_contrast.hpp:72