From 9c239d75417119ca1874af98ba97fea54fc36354 Mon Sep 17 00:00:00 2001
From: James Stuckey Weber
Date: Tue, 10 Dec 2024 19:07:02 +0000
Subject: [PATCH] Adjust ratio for opacity
---
src/lib/components/ratio/ColorIssues.svelte | 18 ++++++++++++++++++
src/lib/components/ratio/index.svelte | 21 +++++++++++++++++++--
2 files changed, 37 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.
+