Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/wcag-contrast

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/wcag-contrast

TypeScript definitions for wcag-contrast

  • 3.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
30K
increased by19.54%
Maintainers
1
Weekly downloads
 
Created
Source

Installation

npm install --save @types/wcag-contrast

Summary

This package contains type definitions for wcag-contrast (https://github.com/tmcw/wcag-contrast).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/wcag-contrast.

index.d.ts

/**
 * Get the contrast ratio between two relative luminance values
 * @param a luminance value
 * @param b luminance value
 * @returns contrast ratio
 * @example
 * luminance(1, 1); // = 1
 */
export function luminance(a: number, b: number): number;

/**
 * Get a score for the contrast between two colors as rgb triplets
 * @param a
 * @param b
 * @returns contrast ratio
 * @example
 * rgb([0, 0, 0], [255, 255, 255]); // = 21
 */
export function rgb(a: RGBColor, b: RGBColor): number;

/**
 * Get a score for the contrast between two colors as hex strings
 * @param a hex value
 * @param b hex value
 * @returns contrast ratio
 * @example
 * hex('#000', '#fff'); // = 21
 */
export function hex(a: string, b: string): number;

/**
 * Get a textual score from a numeric contrast value
 * @param contrast
 * @returns score
 * @example
 * score(10); // = 'AAA'
 */
export function score(contrast: number): Score;

/** Color as RGB triplet */
export type RGBColor = [number, number, number];

/** Textual score */
export type Score = "AAA" | "AA" | "AA Large" | "Fail";

Additional Details

  • Last updated: Wed, 18 Oct 2023 11:45:07 GMT
  • Dependencies: none

Credits

These definitions were written by York Yao, and Piotr Błażejewicz.

FAQs

Package last updated on 18 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc