Aegis2D
Modular C++26 2D game engine for networked games
Loading...
Searching...
No Matches
color_vision.hpp File Reference

How colors look to players with a color vision deficiency, and how far apart they look, to check that a palette stays readable for everyone. More...

#include <aegis2d/render/color.hpp>
#include <aegis2d/render/export.hpp>
#include <array>
#include <cstdint>

Go to the source code of this file.

Namespaces

namespace  aegis2d
 Root namespace of the engine.
 
namespace  aegis2d::render
 OpenGL renderer: sprites, text and camera (client only).
 

Enumerations

enum class  aegis2d::render::ColorVision : std::uint8_t {
  aegis2d::render::Typical , aegis2d::render::Protanopia , aegis2d::render::Deuteranopia , aegis2d::render::Tritanopia ,
  aegis2d::render::Achromatopsia
}
 Kind of color vision. More...
 

Functions

Color aegis2d::render::simulate (Color color, ColorVision vision) noexcept
 Color as seen with a color vision.
 
float aegis2d::render::relative_luminance (Color color) noexcept
 Relative luminance of a color, as defined by WCAG 2.
 
float aegis2d::render::contrast_ratio (Color first, Color second) noexcept
 WCAG 2 contrast ratio between two colors.
 
float aegis2d::render::lightness (Color color) noexcept
 Perceived lightness of a color, CIE L*.
 
float aegis2d::render::color_difference (Color first, Color second) noexcept
 Perceived difference between two colors, CIE76 ΔE*ab in CIELAB (D65).
 

Variables

constexpr std::array aegis2d::render::color_visions
 Every ColorVision, to check a palette against each of them.
 

Detailed Description

How colors look to players with a color vision deficiency, and how far apart they look, to check that a palette stays readable for everyone.