Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
theme_contrast.hpp File Reference
#include <pulp/view/theme.hpp>
#include <string>
#include <vector>
#include <optional>

Go to the source code of this file.

Classes

struct  pulp::view::ContrastIssue

Namespaces

namespace  pulp
namespace  pulp::view
 Hover-cursor tracking for platform window hosts.

Typedefs

using pulp::view::HSL = canvas::Color::HSL

Enumerations

enum class  pulp::view::ContrastLevel { pulp::view::aa_normal , pulp::view::aa_large , pulp::view::aaa_normal , pulp::view::aaa_large }
 WCAG AA compliance levels. More...

Functions

float pulp::view::relative_luminance (Color c)
 Compute relative luminance of a color per WCAG 2.1 definition.
float pulp::view::contrast_ratio (Color a, Color b)
 Compute WCAG contrast ratio between two colors.
float pulp::view::min_contrast_for_level (ContrastLevel level)
 Get the minimum contrast ratio required for a given level.
bool pulp::view::meets_contrast (Color foreground, Color background, ContrastLevel level=ContrastLevel::aa_normal)
 Check if a foreground/background pair meets a given contrast level.
Color pulp::view::auto_contrast_foreground (Color background, ContrastLevel level=ContrastLevel::aa_normal)
 Given a background color, compute an accessible foreground color.
std::optional< Color > pulp::view::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 required contrast level.
HSL pulp::view::rgb_to_hsl (Color c)
Color pulp::view::hsl_to_rgb (HSL hsl, float alpha=1.0f)
Color pulp::view::shift_hue (Color c, float degrees)
 Shift hue by degrees (wraps around 360).
Color pulp::view::adjust_lightness (Color c, float delta)
 Adjust lightness by a delta (clamped to [0,1]).
Color pulp::view::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.
Color pulp::view::with_alpha (Color c, float alpha)
 Apply alpha to a color [0.0-1.0].
std::vector< ContrastIssue > pulp::view::validate_theme_contrast (const Theme &theme, ContrastLevel level=ContrastLevel::aa_normal)
 Validate a theme for contrast issues.
Theme pulp::view::auto_fix_contrast (const Theme &theme, ContrastLevel level=ContrastLevel::aa_normal)
 Auto-fix contrast issues in a theme by adjusting foreground colors.