Raxol.Core.Accessibility.ThemeIntegration (Raxol v0.3.0)
View SourceManages the integration between accessibility settings and the active theme.
Listens for accessibility changes (e.g., high contrast toggle) and updates the active theme accordingly.
Summary
Functions
Apply the current accessibility settings to components.
This function is typically called during initialization to ensure components
reflect the persisted preferences.
Accepts a keyword list of options (e.g., [high_contrast: true, ...]
).
Clean up the theme integration.
Returns the current accessibility mode based on settings.
Defaults to :normal
if high contrast is off.
Returns the current active theme variant for accessibility-aware theming. Used by the renderer and theming system to select the correct theme variant.
Get the current theme based on accessibility settings.
Handle high contrast mode changes. Updates the theme based on high contrast setting.
Handle large text setting changes.
Handle reduced motion setting changes.
Initialize the theme integration.
Functions
Apply the current accessibility settings to components.
This function is typically called during initialization to ensure components
reflect the persisted preferences.
Accepts a keyword list of options (e.g., [high_contrast: true, ...]
).
Clean up the theme integration.
Unregisters event handlers.
Examples
iex> ThemeIntegration.cleanup()
:ok
@spec get_accessibility_mode() :: atom()
Returns the current accessibility mode based on settings.
Defaults to :normal
if high contrast is off.
@spec get_active_variant() :: atom()
Returns the current active theme variant for accessibility-aware theming. Used by the renderer and theming system to select the correct theme variant.
Examples
iex> ThemeIntegration.get_active_variant()
:normal | :high_contrast
Get the current theme based on accessibility settings.
Examples
iex> ThemeIntegration.get_theme()
%Theme{} # Returns the current theme with accessibility adjustments
Handle high contrast mode changes. Updates the theme based on high contrast setting.
Handle large text setting changes.
Examples
iex> ThemeIntegration.handle_large_text({:accessibility_large_text, true})
:ok
Handle reduced motion setting changes.
Examples
iex> ThemeIntegration.handle_reduced_motion({:accessibility_reduced_motion, true})
:ok
Initialize the theme integration.
Registers event handlers for accessibility setting changes.
Examples
iex> ThemeIntegration.init()
:ok