Documentation

Overview

    Package color implements XEP-0392: Consistent Color Generation v0.4.

    Example
    Output:
    
    

    Index

    Examples

    Constants

    View Source
    const Size = 2

      Size is the length of the hash output.

      Variables

      This section is empty.

      Functions

      func Bytes

      func Bytes(b []byte, luma uint8, cvd CVD) color.YCbCr

        Bytes converts a byte slice to a color.YCbCr.

        For more information see Sum.

        func Hash

        func Hash(cvd CVD) hash.Hash

          Hash returns a new hash.Hash computing the Y'CbCr color. For more information see Sum.

          func String

          func String(s string, luma uint8, cvd CVD) color.YCbCr

            String converts a string to a color.YCbCr.

            For more information see Sum.

            func Sum

            func Sum(data []byte, cvd CVD) [Size]byte

              Sum returns a color in the Y'CbCr colorspace in the form [Cb, Cr] that is consistent for the same inputs.

              If a color vision deficiency constant is provided (other than None), the algorithm attempts to avoid confusable colors.

              Types

              type CVD

              type CVD uint8

                CVD represents a color vision deficiency to correct for.

                const (
                	None CVD = iota
                	RedGreen
                	Blue
                )

                  A list of color vision deficiencies.

                  func (CVD) String

                  func (i CVD) String() string