View Source Idmlx.Components.Colors (idmlx v0.2.1)
Provides functionality for parsing and working with InDesign colors.
This module handles the parsing of color definitions from IDMS files and provides utilities for working with collections of colors.
Examples
# Parse colors from an IDMS file
colors = Idmlx.Components.Colors.parse_colors("path/to/file.idms")
# Find a specific color by name
black = Idmlx.Components.Colors.find_color_by_name(colors, "Black")
Summary
Functions
Finds a color by name in a list of colors. Supports both direct name matching and "Color/" prefixed names.
Parses color definitions from an IDMS file.
Functions
@spec find_color_by_name([Idmlx.Components.Color.t()], String.t()) :: Idmlx.Components.Color.t() | nil
Finds a color by name in a list of colors. Supports both direct name matching and "Color/" prefixed names.
Parameters
- colors: List of Color structs to search
- name: Name of the color to find
Returns
Color struct or nil if not found
Examples
iex> colors = [%Color{name: "Black"}, %Color{name: "Red"}]
iex> Idmlx.Components.Colors.find_color_by_name(colors, "Black")
%Color{name: "Black", ...}
iex> Idmlx.Components.Colors.find_color_by_name(colors, "Color/Black")
%Color{name: "Black", ...}
@spec parse_colors(String.t()) :: [Idmlx.Components.Color.t()]
Parses color definitions from an IDMS file.
Parameters
- file_path: Path to the IDMS file to parse
Returns
List of Color structs
Examples
iex> Idmlx.Components.Colors.parse_colors("template.idms")
[%Idmlx.Components.Color{name: "Black", model: "Process", space: "CMYK", ...}]