View Source ColorPalette.DataConverter (ColorPalette v0.1.10)
The functions in ColorPalette.DataConverter
are all pure functions for testability (as opposed
to those in ColorPalette
which reference statically compiled data).
Summary
Functions
Link to this function
ansi_color_codes_to_color_names(ansi_color_codes, hex_to_color_names)
View Source@spec ansi_color_codes_to_color_names([ColorPalette.ANSIColorCode.t()], %{ required(ColorPalette.ANSIColorCode.hex()) => [ColorPalette.Color.name()] }) :: %{required(ColorPalette.ANSIColorCode.t()) => [ColorPalette.Color.name()]}
@spec codes_by_frequency_count(%{ required(ColorPalette.Color.name()) => [ColorPalette.Color.t()] }) :: %{ ColorPalette.ANSIColorCode => integer() }
@spec codes_to_name_counts(%{ required(ColorPalette.Color.name()) => [ColorPalette.Color.t()] }) :: %{ ColorPalette.ANSIColorCode => integer() }
@spec codes_to_names(%{ required(ColorPalette.Color.name()) => [ColorPalette.Color.t()] }) :: %{ ColorPalette.ANSIColorCode => [ColorPalette.Color.name()] }
@spec collate_colors_by_name([ColorPalette.Color.t()]) :: %{ required(ColorPalette.Color.name()) => [ColorPalette.Color.t()] }
@spec color_groups_to_ansi_color_codes([ColorPalette.ANSIColorCode.t()], [ ColorPalette.ColorGroup.t() ]) :: %{required(ColorPalette.ColorGroup.t()) => [ColorPalette.ANSIColorCode.t()]}
@spec color_name_to_atom(String.t()) :: [ColorPalette.Color.name()]
@spec color_names_to_colors([ColorPalette.Color.t()]) :: %{ required(ColorPalette.Color.name()) => [ColorPalette.Color.t()] }
@spec combine_colors_with_same_name(%{ required(ColorPalette.Color.name()) => [ColorPalette.Color.t()] }) :: %{required(ColorPalette.Color.name()) => [ColorPalette.Color.t()]}
@spec combine_colors_with_same_name_and_code([ColorPalette.Color.t()]) :: ColorPalette.Color.t()
@spec compute_stats(%{required(ColorPalette.Color.name()) => [ColorPalette.Color.t()]}) :: %{ required(ColorPalette.ANSIColorCode.code()) => %{ sources: [ColorPalette.Color.source()], other_names: [ColorPalette.Color.name()] } }
Link to this function
convert_raw_color_data_to_colors(raw_color_data, source, ansi_color_codes)
View Source@spec convert_raw_color_data_to_colors([map()], ColorPalette.Color.source(), [ ColorPalette.ANSIColorCode.t() ]) :: [[ColorPalette.Color.t()]]
Link to this function
create_names_for_missing_colors(all_colors, color_codes_missing_names)
View Source@spec create_names_for_missing_colors( %{required(ColorPalette.Color.name()) => ColorPalette.Color.t()}, [ColorPalette.ANSIColorCode.code()] ) :: %{required(ColorPalette.Color.name()) => ColorPalette.Color.t()}
@spec fill_in_same_as_field( %{required(ColorPalette.Color.name()) => ColorPalette.Color.t()}, %{ required(ColorPalette.ANSIColorCode.hex()) => [ColorPalette.Color.name()] } ) :: %{required(ColorPalette.Color.name()) => ColorPalette.Color.t()}
@spec find_by_code( %{required(ColorPalette.Color.name()) => ColorPalette.Color.t()}, ColorPalette.ANSIColorCode.code() ) :: [ColorPalette.Color.t()]
@spec find_by_code( %{required(ColorPalette.Color.name()) => ColorPalette.Color.t()}, ColorPalette.ANSIColorCode.code() ) :: [ColorPalette.Color.t()]
@spec find_by_hex( %{required(ColorPalette.Color.name()) => ColorPalette.Color.t()}, ColorPalette.ANSIColorCode.hex() ) :: [ColorPalette.Color.t()]
@spec group_by_name_frequency(%{ required(ColorPalette.Color.name()) => [ColorPalette.Color.t()] }) :: %{ required(ColorPalette.Color.name()) => ColorPalette.Color.t() }
@spec hex_to_color_names(%{ required(ColorPalette.Color.name()) => ColorPalette.Color.t() }) :: %{ required(ColorPalette.ANSIColorCode.hex()) => [ColorPalette.Color.name()] }
@spec normalize_data(map(), ColorPalette.ANSIColorCode.code()) :: map()
Link to this function
normalize_name_that_color_data(name_that_color_raw_data, data_with_text_contrast_color)
View Source@spec unnamed_ansi_color_codes(%{ required(ColorPalette.Color.name()) => ColorPalette.Color.t() }) :: [ ColorPalette.ANSIColorCode.code() ]