From d8b5bba461c257ae701f495d9c62314b6be3e1f3 Mon Sep 17 00:00:00 2001
From: James Stuckey Weber
Date: Tue, 10 Dec 2024 18:49:27 +0000
Subject: [PATCH] Account for opacity
---
src/lib/components/ratio/ColorIssues.svelte | 18 +++++++++++++++++
src/lib/components/ratio/index.svelte | 22 +++++++++++++++++++--
2 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/src/lib/components/ratio/ColorIssues.svelte b/src/lib/components/ratio/ColorIssues.svelte
index f83f1e3..2fd3f43 100644
--- a/src/lib/components/ratio/ColorIssues.svelte
+++ b/src/lib/components/ratio/ColorIssues.svelte
@@ -54,6 +54,24 @@
adjust the color to be in gamut.
+
Background Color Alpha Values
+
+
+ WCAG 2 contrast does not consider alpha values. Because we don't know
+ what is behind your background color, we can't estimate the contrast. If
+ the background color is not opaque, the contrast ratio is computed
+ without background or foreground opacity.
+
+
+
Foreground Color Alpha Values
+
+
+ WCAG 2 contrast does not consider alpha values, but we can approximate a
+ ratio by premultiplying a semi-transparent foreground color in the sRGB
+ space. In practice, the displayed foreground color may vary, depending
+ on the display and browser.
+