MapAccessibility 1.0.1
dotnet add package MapAccessibility --version 1.0.1
NuGet\Install-Package MapAccessibility -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MapAccessibility" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MapAccessibility" Version="1.0.1" />
<PackageReference Include="MapAccessibility" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MapAccessibility --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MapAccessibility, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MapAccessibility@1.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MapAccessibility&version=1.0.1
#tool nuget:?package=MapAccessibility&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MapAccessibility
WCAG 2.1 AA color accessibility checking for cartographic palettes. Zero dependencies — pure .NET 8+.
Check contrast ratios, simulate color vision deficiency (CVD), and score palette accessibility for maps, dashboards, and data visualization.
Install
dotnet add package MapAccessibility
Usage
using MapAccessibility;
// Contrast ratio between two colors (1.0–21.0)
double ratio = AccessibilityChecker.ContrastRatio("#1B4F72", "#FFFFFF"); // 10.53
// WCAG compliance check
bool passes = AccessibilityChecker.MeetsWcag("#1B4F72", "#FFFFFF",
level: WcagLevel.AA, textSize: TextSize.Normal); // true
// All thresholds at once
ContrastResult result = AccessibilityChecker.FullCheck("#1B4F72", "#FFFFFF");
// result.MeetsAaNormal, result.MeetsAaLarge, result.MeetsAaaNormal, result.MeetsAaaLarge
// Simulate color vision deficiency
string simulated = CvdSimulator.Simulate("#FF0000", CvdType.Deuteranopia); // "#A58400"
// Check if two colors remain distinguishable under CVD
bool distinct = CvdSimulator.IsDistinguishable("#FF0000", "#00FF00", CvdType.Deuteranopia);
// Score a palette (0.0–1.0)
PaletteScore score = PaletteScorer.Score(
new[] { "#1B4F72", "#2E86C1", "#AED6F1", "#FDEBD0", "#E74C3C" });
// Pre-built accessible palettes
string[] colors = AccessiblePalettes.Qualitative(5);
string[] blues = AccessiblePalettes.Sequential("blues", 7);
What's Included
| Class | Purpose |
|---|---|
AccessibilityChecker |
WCAG 2.1 relative luminance, contrast ratio, AA/AAA checking |
CvdSimulator |
Protanopia, deuteranopia, tritanopia simulation (Viénot/Brettel 1999) |
PaletteScorer |
Palette-level scoring: pairwise contrast (60%) + CVD safety (40%) |
AccessiblePalettes |
Curated qualitative, sequential, and diverging palettes |
ColorUtils |
Hex/RGB parsing, sRGB linearization |
Types
enum WcagLevel { AA, AAA }
enum TextSize { Normal, Large }
enum CvdType { Protanopia, Deuteranopia, Tritanopia }
readonly record struct ContrastResult(
double Ratio, bool MeetsAaNormal, bool MeetsAaLarge,
bool MeetsAaaNormal, bool MeetsAaaLarge);
readonly record struct PaletteScore(
double OverallScore, double MinPairwiseContrast, double MeanPairwiseContrast,
int CvdSafeCount, CvdType[] CvdSafeTypes, int ColorCount, string[] Warnings);
readonly record struct PaletteInfo(
string Name, string Category, string[] Colors,
int MinN, int MaxN, double AccessibilityScore, bool CvdSafe);
WCAG Thresholds
| Level | Normal text | Large text |
|---|---|---|
| AA | ≥ 4.5:1 | ≥ 3.0:1 |
| AAA | ≥ 7.0:1 | ≥ 4.5:1 |
Why This Package
- Zero dependencies — no NTS, no System.Drawing.Common, no native binaries. Runs in Blazor WASM, MAUI, Unity, console, web API.
- Cartography-focused — scoring tuned for map fills and legends, not web buttons.
- WCAG-correct — uses the right sRGB linearization threshold (0.04045 per IEC 61966-2-1, not the common 0.03928 mistake).
- Cross-language — identical algorithms and shared test vectors across Python and R companions.
Target Frameworks
- .NET 8.0+
License
MIT
Links
- GitHub
- Report an Issue
- Contact: Chris.Lyons@ky.gov
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.