Fledex.Color.Names (fledex v0.7.0)

View Source

This module is a bridge between color name modules and the Fledex.Color protocol. It uses the Fledex.Config to know about the configured colors

Summary

Guards

Checks whether the argument is a valid color name.

Functions

Get a detailed list of all the colors that have been configured

Retrieve information about the color with the given name

get a list of all the color names that are currently configured.

Guards

is_color_name(atom)

(macro)

Checks whether the argument is a valid color name.

For specific color modules this returns true only if the atom is a valid color name. For this facade module all atoms could be a valid color name. Thus, we loosen the definition here.

Functions

colors()

Get a detailed list of all the colors that have been configured

info(name, what \\ :hex)

@spec info(name :: atom(), what :: atom()) ::
  nil | Fledex.Color.Names.Types.color_vals_t() | any()

Retrieve information about the color with the given name

See Fledex.Color.Names.Interface for more details

names()

get a list of all the color names that are currently configured.

Contrary to normal color modules, you can't use the color name atom as a function name. You still can retrieve the information through info/1 and info/2. Alternatively you need to ensure that the configured color modules are imported.

Caution

When importing color modules, you have to be careful to only import those functions that do not overlap. You can call Fledex.Config.configured_color_modules/0 to get the list of modules and the colors that should be imported.