View Source Weather.Colors (Weather v0.3.5)

Provides ANSI color codes for use in the Weather module.

Summary

Functions

Colorizes a string according to a color code.

Formats and colorizes a temperature.

Returns the default ANSI color codes associated with temperature categories.

Prints colorized text with associated color codes.

Prints the current color configuration.

Removes ANSI characters from a given string.

Types

@type category() ::
  :arctic
  | :freezing
  | :cold
  | :chilly
  | :cool
  | :mild
  | :warm
  | :hot
  | :very_hot
  | :scorching
@type codes() :: %{required(category()) => integer()}

Functions

@spec colorize(String.t(), integer()) :: String.t()

Colorizes a string according to a color code.

Link to this function

colorize_temp(temp, opts \\ Weather.Opts.new())

View Source
@spec colorize_temp(integer(), Weather.Opts.t()) :: String.t()

Formats and colorizes a temperature.

@spec default_color_codes() :: codes()

Returns the default ANSI color codes associated with temperature categories.

@spec list() :: :ok

Prints colorized text with associated color codes.

Link to this function

list_current(opts \\ Weather.Opts.new())

View Source
@spec list_current(Weather.Opts.t()) :: :ok

Prints the current color configuration.

@spec remove_ansi(String.t()) :: String.t()

Removes ANSI characters from a given string.