Raxol.UI.Theming.PaletteRegistry (Raxol v2.0.1)
View SourceRegistry for custom color palettes used in the Raxol theming system.
This module provides persistent storage and management of custom color palettes that can be used with the Colors.convert_to_palette/2 function.
Summary
Functions
Returns a specification to start this module under a supervisor.
Checks if a palette exists.
Gets a custom palette by name.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_call/3.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.
Lists all registered custom palettes.
Registers a custom color palette.
Unregisters a custom color palette.
Updates an existing palette.
Types
@type color_index() :: 0..255
@type color_rgb() :: {0..255, 0..255, 0..255}
@type palette() :: [palette_color()]
@type palette_color() :: {color_index(), color_rgb()}
@type palette_name() :: atom()
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Checks if a palette exists.
Examples
iex> exists?(:my_palette)
true
iex> exists?(:nonexistent)
false
Gets a custom palette by name.
Examples
iex> get(:my_palette)
{:ok, [{0, {0, 0, 0}}, {1, {255, 255, 255}}]}
iex> get(:nonexistent)
{:error, :not_found}
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_call/3.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.
Lists all registered custom palettes.
Examples
iex> list()
[:my_palette, :another_palette]
Registers a custom color palette.
Examples
iex> register(:my_palette, [{0, {0, 0, 0}}, {1, {255, 255, 255}}])
:ok
Unregisters a custom color palette.
Examples
iex> unregister(:my_palette)
:ok
Updates an existing palette.
Examples
iex> update(:my_palette, [{0, {0, 0, 0}}, {1, {128, 128, 128}}])
:ok