colorcontrast

package module
v0.0.0-...-012bca6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2021 License: MIT Imports: 3 Imported by: 0

README

go-color-contrast-ratio

Calculate the color contrast ratio specified in WCAG 2.1

package main

import (
	"fmt"
	"github.com/Gioni06/go-color-contrast-ratio"
	"image/color"
)

func main()  {
	colorA := color.RGBA{
		R: 255,
		G: 255,
		B: 255,
		A: 255,
	}
	colorB := color.RGBA{
		R: 231,
		G: 48,
		B: 55,
		A: 255,
	}
	// 4.307044780466779
	fmt.Println(colorcontrast.Calculate(colorA, colorB))
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Calculate

func Calculate(a, b color.Color) float64

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL