IdenticonSvg.Color (IdenticonSvg v1.0.0)

Copy Markdown View Source

Module of IdenticonSvg that contains functions related to handling colors.

Summary

Functions

Take an list of integers representing the red, green, and blue components of a color as integers in the range 0..255, and return a complementary color based on the provided value of the :compl keyword option.

Convert a hexadecimal color string with 3 characters, with or without a # prefix, to a hexadecimal color string with 6 uppercase characters. If the input hex color has 6 characters, return it untouched. Otherwise, raise an ArgumentError.

Convert a hexadecimal color string with 3 or 6 characters, with or without a # prefix, to a list of integers representing the red, green, and blue components of a color as integers in the range 0..255

Convert an integer in the range 0..255 to a zero-padded hexacedimal string

Convert a list of integers representing the red, green, and blue components of a color as integers in the range 0..255 to a hexadecimal color string with 6 characters, prefixed by "#"

Functions

color_wheel(list1, list2)

(since 0.9.0)

Take an list of integers representing the red, green, and blue components of a color as integers in the range 0..255, and return a complementary color based on the provided value of the :compl keyword option.

hex_to_hex6(hex)

(since 0.9.0)

Convert a hexadecimal color string with 3 characters, with or without a # prefix, to a hexadecimal color string with 6 uppercase characters. If the input hex color has 6 characters, return it untouched. Otherwise, raise an ArgumentError.

hex_to_rgb(hex)

(since 0.9.0)

Convert a hexadecimal color string with 3 or 6 characters, with or without a # prefix, to a list of integers representing the red, green, and blue components of a color as integers in the range 0..255

integer_to_hex(value)

(since 0.9.0)

Convert an integer in the range 0..255 to a zero-padded hexacedimal string

rgb_to_hex6(rgb)

(since 0.9.0)

Convert a list of integers representing the red, green, and blue components of a color as integers in the range 0..255 to a hexadecimal color string with 6 characters, prefixed by "#"